Created attachment 616908 [details] [diff] [review]
Fix jemalloc mmap wrapper for s390x
S390 syscall interface doesn't support passing more than 5 arguments, so instead of giving the 6 arguments required for SYS_mmap, it gives one that is a pointer to a struct containing the arguments. The implementation I dif for s390 works fine on s390, but doesn't work on s390x because of expected padding: the arguments in the struct are all expected by the kernel to be 64-bits. So what happens next is that the syscall returns us a NULL pointer, and jemalloc initialization uses that pointer assuming it's not NULL, and dereferences it. Kaboom.
The patch solves the issue by using the "long" type instead of int, which happens to be the right size on both s390 and s390x. As a matter of fact, that's the type used in the kernel source itself (even for pointer members). The kernel actually uses unsigned long, but sign doesn't matter here.
Had forgotten to update this bug: