Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat move MAP_COPY in compat
details: https://anonhg.NetBSD.org/src/rev/414c30ec4d48
branches: trunk
changeset: 353314:414c30ec4d48
user: christos <christos%NetBSD.org@localhost>
date: Sat Apr 29 01:15:40 2017 +0000
description:
move MAP_COPY in compat
diffstat:
sys/compat/common/vm_43.c | 17 +++++++++++++----
sys/compat/netbsd32/netbsd32_netbsd.c | 11 ++++++++---
sys/compat/sys/mman.h | 8 +++++++-
3 files changed, 28 insertions(+), 8 deletions(-)
diffs (104 lines):
diff -r cefa18915ad1 -r 414c30ec4d48 sys/compat/common/vm_43.c
--- a/sys/compat/common/vm_43.c Sat Apr 29 00:08:46 2017 +0000
+++ b/sys/compat/common/vm_43.c Sat Apr 29 01:15:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_43.c,v 1.18 2011/02/08 20:20:26 rmind Exp $ */
+/* $NetBSD: vm_43.c,v 1.19 2017/04/29 01:15:40 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.18 2011/02/08 20:20:26 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_43.c,v 1.19 2017/04/29 01:15:40 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -110,12 +110,21 @@
SCARG(&nargs, flags) = 0;
if (SCARG(uap, flags) & OMAP_ANON)
SCARG(&nargs, flags) |= MAP_ANON;
- if (SCARG(uap, flags) & OMAP_COPY)
- SCARG(&nargs, flags) |= MAP_COPY;
if (SCARG(uap, flags) & OMAP_SHARED)
SCARG(&nargs, flags) |= MAP_SHARED;
else
SCARG(&nargs, flags) |= MAP_PRIVATE;
+ if (SCARG(uap, flags) & OMAP_COPY) {
+ SCARG(&nargs, flags) |= 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.
+ */
+ SCARGS(&nargs, prot) |= PROT_EXEC;
+#endif
+ }
if (SCARG(uap, flags) & OMAP_FIXED)
SCARG(&nargs, flags) |= MAP_FIXED;
if (SCARG(uap, flags) & OMAP_INHERIT)
diff -r cefa18915ad1 -r 414c30ec4d48 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c Sat Apr 29 00:08:46 2017 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c Sat Apr 29 01:15:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_netbsd.c,v 1.205 2016/10/19 09:44:01 skrll Exp $ */
+/* $NetBSD: netbsd32_netbsd.c,v 1.206 2017/04/29 01:15:40 christos Exp $ */
/*
* Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.205 2016/10/19 09:44:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.206 2017/04/29 01:15:40 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
@@ -90,6 +90,8 @@
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
+#include <compat/sys/mman.h>
+
#if defined(DDB)
#include <ddb/ddbvar.h>
#endif
@@ -1521,8 +1523,11 @@
* Ancient kernel on x86 did not obey PROT_EXEC on i386 at least
* and ld.so did not turn it on!
*/
- if (SCARG(&ua, flags) & MAP_COPY)
+ if (SCARG(&ua, flags) & COMPAT_MAP_COPY) {
+ SCARG(&ua, flags) = MAP_PRIVATE
+ | (SCARG(&ua, flags) & ~COMPAT_MAP_COPY);
SCARG(&ua, prot) |= PROT_EXEC;
+ }
#endif
NETBSD32TO64_UAP(fd);
NETBSD32TOX_UAP(PAD, long);
diff -r cefa18915ad1 -r 414c30ec4d48 sys/compat/sys/mman.h
--- a/sys/compat/sys/mman.h Sat Apr 29 00:08:46 2017 +0000
+++ b/sys/compat/sys/mman.h Sat Apr 29 01:15:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mman.h,v 1.2 2005/12/11 12:20:29 christos Exp $ */
+/* $NetBSD: mman.h,v 1.3 2017/04/29 01:15:40 christos Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@@ -34,6 +34,12 @@
#ifndef _COMPAT_SYS_MMAN_H_
#define _COMPAT_SYS_MMAN_H_
+/*
+ * Deprecated flag; these are treated as MAP_PRIVATE internally by
+ * the kernel.
+ */
+#define COMPAT_MAP_COPY 0x0004 /* "copy" region at mmap time */
+
__BEGIN_DECLS
int msync(void *, size_t);
int __msync13(void *, size_t, int);
Home |
Main Index |
Thread Index |
Old Index