Revert MAP_NOSYSCALLS patch.

This commit is contained in:
reinoud 2012-01-05 15:19:52 +00:00
parent d7f6b3d11f
commit 5bd510aeaa
6 changed files with 8 additions and 112 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mmap.2,v 1.46 2011/12/20 16:43:14 wiz Exp $
.\" $NetBSD: mmap.2,v 1.47 2012/01/05 15:19:52 reinoud Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -180,9 +180,6 @@ other processes using
will be seen.
.It Dv MAP_SHARED
Modifications are shared.
.It Dv MAP_NOSYSCALLS
No system calls are to be allowed from within this mapped region.
They instead generate an illegal instruction signal.
.El
.Pp
The

View File

@ -1,4 +1,4 @@
/* $NetBSD: mman.h,v 1.43 2011/12/20 15:39:35 reinoud Exp $ */
/* $NetBSD: mman.h,v 1.44 2012/01/05 15:19:52 reinoud Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@ -97,14 +97,6 @@ typedef __off_t off_t; /* file offset */
#define MAP_ANON 0x1000 /* allocated from memory, swap space */
#define MAP_STACK 0x2000 /* allocated from memory, swap space (stack) */
/*
* Map attributes 0x00010000 till 0x00ff0000
*/
#define MAP_ATTR(n) ((n) << MAP_ATTRIB_SHIFT)
#define MAP_ATTRIB_SHIFT 16
#define MAP_ATTRIB_MASK MAP_ATTR(0xff)
#define MAP_NOSYSCALLS MAP_ATTR(0x01) /* no syscalls allowed */
/*
* Alignment (expressed in log2). Must be >= log2(PAGE_SIZE) and
* < # bits in a pointer (26 (acorn26), 32 or 64).

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.312 2011/12/20 15:39:35 reinoud Exp $ */
/* $NetBSD: proc.h,v 1.313 2012/01/05 15:19:53 reinoud Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -353,7 +353,6 @@ struct proc {
#define PK_NOCLDWAIT 0x00020000 /* No zombies if child dies */
#define PK_32 0x00040000 /* 32-bit process (used on 64-bit kernels) */
#define PK_CLDSIGIGN 0x00080000 /* Process is ignoring SIGCHLD */
#define PK_CHKNOSYSCALL 0x00100000 /* Process needs NOSYSCALL checking */
#define PK_MARKER 0x80000000 /* Is a dummy marker process */
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_extern.h,v 1.178 2011/12/22 13:12:50 reinoud Exp $ */
/* $NetBSD: uvm_extern.h,v 1.179 2012/01/05 15:19:53 reinoud Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -680,11 +680,6 @@ void uvmspace_unshare(struct lwp *);
void uvm_whatis(uintptr_t, void (*)(const char *, ...));
void uvm_map_setattr(struct vm_map *, vaddr_t,
vaddr_t, uint32_t);
bool uvm_map_checkattr(struct vm_map *, vaddr_t,
vaddr_t, uint32_t);
/* uvm_meter.c */
int uvm_sysctl(int *, u_int, void *, size_t *,
void *, size_t, struct proc *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.309 2011/12/22 13:12:50 reinoud Exp $ */
/* $NetBSD: uvm_map.c,v 1.310 2012/01/05 15:19:53 reinoud Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.309 2011/12/22 13:12:50 reinoud Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.310 2012/01/05 15:19:53 reinoud Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@ -1672,7 +1672,6 @@ nomerge:
new_entry->protection = prot;
new_entry->max_protection = maxprot;
new_entry->inheritance = inherit;
new_entry->map_attrib = 0; /* XXX could be passed too */
new_entry->wired_count = 0;
new_entry->advice = advice;
if (flags & UVM_FLAG_OVERLAY) {
@ -4121,73 +4120,6 @@ uvm_map_checkprot(struct vm_map *map, vaddr_t start, vaddr_t end,
return (true);
}
/*
* uvm_map_setattr: set uvm-external mapping attributes in map
*
* => map must be read or write locked by caller.
*/
void
uvm_map_setattr(struct vm_map *map, vaddr_t start, vaddr_t end,
uint32_t map_attrib)
{
struct vm_map_entry *entry;
struct vm_map_entry *tmp_entry;
/* safety */
if (!uvm_map_lookup_entry(map, start, &tmp_entry))
return;
entry = tmp_entry;
while (start < end) {
/* set attributes associated with entry */
entry->map_attrib = map_attrib;
/* empty one */
if (entry == &map->header)
return;
start = entry->end;
entry = entry->next;
}
}
/*
* uvm_map_checkattr: check attribute bits in map
*
* => check if attribute is present in the region.
* => map must be read or write locked by caller.
*/
bool
uvm_map_checkattr(struct vm_map *map, vaddr_t start, vaddr_t end,
uint32_t map_attrib)
{
struct vm_map_entry *entry;
struct vm_map_entry *tmp_entry;
if (!uvm_map_lookup_entry(map, start, &tmp_entry))
return (false);
entry = tmp_entry;
while (start < end) {
if (entry == &map->header)
return (false);
/*
* check attribute associated with entry
*/
if ((entry->map_attrib & map_attrib) == map_attrib) {
return (true);
}
start = entry->end;
entry = entry->next;
}
return (false);
}
/*
* uvmspace_alloc: allocate a vmspace structure.
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_mmap.c,v 1.142 2011/12/22 13:12:50 reinoud Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.143 2012/01/05 15:19:53 reinoud 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.142 2011/12/22 13:12:50 reinoud Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.143 2012/01/05 15:19:53 reinoud Exp $");
#include "opt_compat_netbsd.h"
#include "opt_pax.h"
@ -547,25 +547,6 @@ sys_mmap(struct lwp *l, const struct sys_mmap_args *uap, register_t *retval)
/* remember to add offset */
*retval = (register_t)(addr + pageoff);
/*
* Support for map attributes; XXX preferably given as an
* extra parameter to uvm_map or merged with uvmflag.
* Implemented now as setting parameters after the mapping.
*/
if (error == 0) {
if (flags & MAP_ATTRIB_MASK) {
uvm_map_setattr(&p->p_vmspace->vm_map,
addr, addr + size,
flags & MAP_ATTRIB_MASK);
}
/* record if we need optimization for system call checking */
if ((flags & MAP_NOSYSCALLS) &&
((p->p_flag & PK_CHKNOSYSCALL) == 0)) {
mutex_enter(p->p_lock);
p->p_flag |= PK_CHKNOSYSCALL;
mutex_exit(p->p_lock);
}
}
if (fp != NULL)
fd_putfile(fd);