[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.
This commit is contained in:
Stefan Berger
2020-05-21 18:38:53 +00:00
committed by Dmitrii Kuvaiskii
parent a8158f1e1c
commit a28f6e0217
+3
View File
@@ -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.