uvm_mmap(): If a vnode mapping is established with PROT_EXEC, mark the

vnode as VTEXT.

uvm_map_protect(): When VM_PROT_EXECUTE is added to a VA range, mark
all the vnodes mapped by the range as VTEXT.
This commit is contained in:
thorpej 2001-10-29 23:06:03 +00:00
parent 39ecb68bcf
commit 7285b2c290
2 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.108 2001/09/23 06:35:30 chs Exp $ */
/* $NetBSD: uvm_map.c,v 1.109 2001/10/29 23:06:03 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -81,6 +81,7 @@
#include <sys/malloc.h>
#include <sys/pool.h>
#include <sys/kernel.h>
#include <sys/vnode.h>
#ifdef SYSVSHM
#include <sys/shm.h>
@ -1827,6 +1828,20 @@ uvm_map_protect(map, start, end, new_prot, set_max)
/* update pmap! */
pmap_protect(map->pmap, current->start, current->end,
current->protection & MASK(entry));
/*
* If this entry points at a vnode, and the
* protection includes VM_PROT_EXECUTE, mark
* the vnode as VTEXT.
*/
if (UVM_ET_ISOBJ(current)) {
struct uvm_object *uobj =
current->object.uvm_obj;
if (UVM_OBJ_IS_VNODE(uobj) &&
(current->protection & VM_PROT_EXECUTE))
vn_marktext((struct vnode *) uobj);
}
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_mmap.c,v 1.56 2001/09/15 20:36:46 chs Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.57 2001/10/29 23:06:03 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -1069,6 +1069,13 @@ uvm_mmap(map, addr, size, prot, maxprot, flags, handle, foff, locklimit)
/* XXX for now, attach doesn't gain a ref */
VREF(vp);
/*
* If the vnode is being mapped with PROT_EXEC,
* then mark it as text.
*/
if (prot & PROT_EXEC)
vn_marktext(vp);
} else {
uobj = udv_attach((void *) &vp->v_rdev,
(flags & MAP_SHARED) ? maxprot :