Do not require pos parameter to be zero in MAP_ANONYMOUS mmap requests
in Linux emulation layer. Linux seems to only require that pos is page-aligned, but otherwise ignores it. Default FreeBSD mmap parameter checking is too strict to allow some Linux binaries to run. tsMuxeR is one example of such a binary. Discussed with: jhb MFC after: 1 week
This commit is contained in:
parent
e35649401c
commit
46bba0ff81
@ -835,9 +835,13 @@ linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot,
|
||||
bsd_args.flags |= MAP_PRIVATE;
|
||||
if (flags & LINUX_MAP_FIXED)
|
||||
bsd_args.flags |= MAP_FIXED;
|
||||
if (flags & LINUX_MAP_ANON)
|
||||
if (flags & LINUX_MAP_ANON) {
|
||||
/* Enforce pos to be on page boundary, then ignore. */
|
||||
if ((pos & PAGE_MASK) != 0)
|
||||
return (EINVAL);
|
||||
pos = 0;
|
||||
bsd_args.flags |= MAP_ANON;
|
||||
else
|
||||
} else
|
||||
bsd_args.flags |= MAP_NOSYNC;
|
||||
if (flags & LINUX_MAP_GROWSDOWN)
|
||||
bsd_args.flags |= MAP_STACK;
|
||||
|
@ -667,9 +667,13 @@ linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot,
|
||||
bsd_args.flags |= MAP_PRIVATE;
|
||||
if (flags & LINUX_MAP_FIXED)
|
||||
bsd_args.flags |= MAP_FIXED;
|
||||
if (flags & LINUX_MAP_ANON)
|
||||
if (flags & LINUX_MAP_ANON) {
|
||||
/* Enforce pos to be on page boundary, then ignore. */
|
||||
if ((pos & PAGE_MASK) != 0)
|
||||
return (EINVAL);
|
||||
pos = 0;
|
||||
bsd_args.flags |= MAP_ANON;
|
||||
else
|
||||
} else
|
||||
bsd_args.flags |= MAP_NOSYNC;
|
||||
if (flags & LINUX_MAP_GROWSDOWN)
|
||||
bsd_args.flags |= MAP_STACK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user