Module Name: src
Committed By: christos
Date: Sat Jan 25 17:21:49 UTC 2014
Modified Files:
src/sys/uvm: uvm_mmap.c
Log Message:
deal with COMPAT_10 issue.
To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/uvm/uvm_mmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/uvm/uvm_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.146 src/sys/uvm/uvm_mmap.c:1.147
--- src/sys/uvm/uvm_mmap.c:1.146 Sat Jan 25 00:14:03 2014
+++ src/sys/uvm/uvm_mmap.c Sat Jan 25 12:21:49 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_mmap.c,v 1.146 2014/01/25 05:14:03 christos Exp $ */
+/* $NetBSD: uvm_mmap.c,v 1.147 2014/01/25 17:21:49 christos Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.146 2014/01/25 05:14:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.147 2014/01/25 17:21:49 christos Exp $");
#include "opt_compat_netbsd.h"
#include "opt_pax.h"
@@ -334,8 +334,17 @@ sys_mmap(struct lwp *l, const struct sys
* Fixup the old deprecated MAP_COPY into MAP_PRIVATE, and
* validate the flags.
*/
- if (flags & MAP_COPY)
+ if (flags & MAP_COPY) {
flags = (flags & ~MAP_COPY) | MAP_PRIVATE;
+#if defined(COMPAT_10) && defined(__i386__)
+ /*
+ * Ancient kernel on x86 did not obey PROT_EXEC on i386 at least
+ * and ld.so did not turn it on. We take care of this on amd64
+ * in compat32.
+ */
+ SCARG(&ua, prot) |= PROT_EXEC;
+#endif
+ }
if ((flags & (MAP_SHARED|MAP_PRIVATE)) == (MAP_SHARED|MAP_PRIVATE))
return (EINVAL);