diff options
author | kib <kib@FreeBSD.org> | 2012-08-14 12:11:48 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-08-14 12:11:48 +0000 |
commit | ce7012daf678de596b53c1e821e48de660277708 (patch) | |
tree | 6a2964548360f8a3843deaf2999fed815c7b1639 /sys/vm/vm_mmap.c | |
parent | 876d70b046096b5ccd3c3f341206c6f6bd9a7b10 (diff) | |
download | FreeBSD-src-ce7012daf678de596b53c1e821e48de660277708.zip FreeBSD-src-ce7012daf678de596b53c1e821e48de660277708.tar.gz |
For old mmap syscall, when executing on amd64 or ia64, enforce the
PROT_EXEC if prot is non-zero, process is 32bit and
kern.elf32.i386_read_exec syscal is enabled. This workaround is needed
for old i386 a.out binaries, where dynamic linker did not specified
PROT_EXEC for mapping of the text.
The kern.elf32.i386_read_exec MIB name looks weird for a.out binaries,
but I reused the existing knob which already has the needed semantic.
MFC after: 1 week
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r-- | sys/vm/vm_mmap.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 90a2aaf..7c9406f 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -453,6 +453,13 @@ ommap(td, uap) nargs.addr = uap->addr; nargs.len = uap->len; nargs.prot = cvtbsdprot[uap->prot & 0x7]; +#ifdef COMPAT_FREEBSD32 +#if defined(__amd64__) || defined(__ia64__) + if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32) && + nargs.prot != 0) + nargs.prot |= PROT_EXEC; +#endif +#endif nargs.flags = 0; if (uap->flags & OMAP_ANON) nargs.flags |= MAP_ANON; |