[Midnightbsd-cvs] src [7894] trunk/sys/vm/vm_mmap.c: For old mmap syscall, when executing on amd64 or ia64, enforce the

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Sep 14 14:50:08 EDT 2016


Revision: 7894
          http://svnweb.midnightbsd.org/src/?rev=7894
Author:   laffer1
Date:     2016-09-14 14:50:08 -0400 (Wed, 14 Sep 2016)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/sys/vm/vm_mmap.c

Modified: trunk/sys/vm/vm_mmap.c
===================================================================
--- trunk/sys/vm/vm_mmap.c	2016-09-14 18:44:38 UTC (rev 7893)
+++ trunk/sys/vm/vm_mmap.c	2016-09-14 18:50:08 UTC (rev 7894)
@@ -454,6 +454,13 @@
 	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;



More information about the Midnightbsd-cvs mailing list