From e40c7f231ad89e1ee8bf37a1d6680880c519c901 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Thu, 27 Feb 2020 13:10:29 +0100 Subject: [PATCH] Fix mmap syscall on s390 mmap arguments must be passed in an array on s390. Signed-off-by: Ilya Leoshkevich --- src/malloc_hook_mmap_linux.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h index 34de715..e2efb05 100644 --- a/src/malloc_hook_mmap_linux.h +++ b/src/malloc_hook_mmap_linux.h @@ -61,7 +61,13 @@ static inline void* do_mmap64(void *start, size_t length, int prot, int flags, int fd, off64_t offset) __THROW { +#if defined(__s390__) + long args[6] = { (long)start, (long)length, (long)prot, (long)flags, + (long)fd, (long)offset }; + return (void*)syscall(SYS_mmap, args); +#else return (void*)syscall(SYS_mmap, start, length, prot, flags, fd, offset); +#endif } #define MALLOC_HOOK_HAVE_DO_MMAP64 1