From a28f6e021799d121edacfc33d4302ea21e89cea7 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 19 May 2020 20:24:26 +0000 Subject: [PATCH] [LibOS] Align address 'down' if MAP_FIXED is not set Align address 'down' if MAP_FIXED is not set so that subsequent tests for the alignment of the address are passing. This solves a memory allocation issue of nodejs on ppc64. --- LibOS/shim/src/sys/shim_mmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LibOS/shim/src/sys/shim_mmap.c b/LibOS/shim/src/sys/shim_mmap.c index b362c540..6314f0d0 100644 --- a/LibOS/shim/src/sys/shim_mmap.c +++ b/LibOS/shim/src/sys/shim_mmap.c @@ -62,6 +62,9 @@ void* shim_do_mmap(void* addr, size_t length, int prot, int flags, int fd, off_t struct shim_handle* hdl = NULL; long ret = 0; + if (!(flags & MAP_FIXED) && addr) + addr = ALLOC_ALIGN_DOWN_PTR(addr); + /* * According to the manpage, both addr and offset have to be page-aligned, * but not the length. mmap() will automatically round up the length.