Index: sys/compat/linux/linux_mmap.h =================================================================== --- sys/compat/linux/linux_mmap.h +++ sys/compat/linux/linux_mmap.h @@ -39,7 +39,10 @@ #define LINUX_MAP_PRIVATE 0x0002 #define LINUX_MAP_FIXED 0x0010 #define LINUX_MAP_ANON 0x0020 +#define LINUX_MAP_32BIT 0x0040 #define LINUX_MAP_GROWSDOWN 0x0100 +#define LINUX_MAP_POPULATE 0x8000 +#define LINUX_MAP_NONBLOCK 0x10000 int linux_mmap_common(struct thread *, uintptr_t, size_t, int, int, Index: sys/compat/linux/linux_mmap.c =================================================================== --- sys/compat/linux/linux_mmap.c +++ sys/compat/linux/linux_mmap.c @@ -105,6 +105,19 @@ bsd_flags |= MAP_STACK; /* + * According to the Linux mmap(2) man page, "MAP_32BIT flag + * is ignored when MAP_FIXED is set." + */ + if ((flags & LINUX_MAP_32BIT) && (flags & LINUX_MAP_FIXED) == 0) + bsd_flags |= MAP_32BIT; + + /* + * "Since Linux 2.6.23, this flag causes MAP_POPULATE to do nothing." + */ + if ((flags & LINUX_MAP_POPULATE) && (flags & LINUX_MAP_NONBLOCK) == 0) + bsd_flags |= MAP_PREFAULT_READ; + + /* * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC * on Linux/i386 if the binary requires executable stack. * We do this only for IA32 emulation as on native i386 this is does not