Let the VM system know that on certain arch's that VM_PROT_READ

also implies VM_PROT_EXEC.  We support it that way for now,
since the break system call by default gives VM_PROT_ALL.  Now
we have a better chance of coalesing map entries when mixing
mmap/break type operations.  This was contributing to excessive
numbers of map entries on the modula-3 runtime system.  The
problem is still not "solved", but the situation makes more
sense.

Eventually, when we work on architectures where VM_PROT_READ
is orthogonal to VM_PROT_EXEC, we will have to visit this
issue carefully (esp. regarding security issues.)
This commit is contained in:
John Dyson 1996-12-30 05:31:21 +00:00
parent cb9de2a646
commit d0aea04fe0
3 changed files with 19 additions and 3 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
* $Id: vmparam.h,v 1.20 1996/04/30 12:02:12 phk Exp $
* $Id: vmparam.h,v 1.21 1996/05/02 14:20:07 phk Exp $
*/
@ -47,6 +47,8 @@
* Machine dependent constants for 386.
*/
#define VM_PROT_READ_IS_EXEC /* if you can read -- then you can exec */
/*
* Virtual memory related constants, all in bytes
*/

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
* $Id: vmparam.h,v 1.20 1996/04/30 12:02:12 phk Exp $
* $Id: vmparam.h,v 1.21 1996/05/02 14:20:07 phk Exp $
*/
@ -47,6 +47,8 @@
* Machine dependent constants for 386.
*/
#define VM_PROT_READ_IS_EXEC /* if you can read -- then you can exec */
/*
* Virtual memory related constants, all in bytes
*/

View File

@ -38,7 +38,7 @@
* from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$
*
* @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94
* $Id: vm_mmap.c,v 1.55 1996/12/22 23:17:09 joerg Exp $
* $Id: vm_mmap.c,v 1.56 1996/12/28 22:40:44 dyson Exp $
*/
/*
@ -475,6 +475,10 @@ mprotect(p, uap, retval)
addr = (vm_offset_t) uap->addr;
size = uap->len;
prot = uap->prot & VM_PROT_ALL;
#if defined(VM_PROT_READ_IS_EXEC)
if (prot & VM_PROT_READ)
prot |= VM_PROT_EXECUTE;
#endif
pageoff = (addr & PAGE_MASK);
addr -= pageoff;
@ -927,6 +931,14 @@ vm_mmap(map, addr, size, prot, maxprot, flags, handle, foff)
docow = MAP_COPY_ON_WRITE | MAP_COPY_NEEDED;
}
#if defined(VM_PROT_READ_IS_EXEC)
if (prot & VM_PROT_READ)
prot |= VM_PROT_EXECUTE;
if (maxprot & VM_PROT_READ)
maxprot |= VM_PROT_EXECUTE;
#endif
rv = vm_map_find(map, object, foff, addr, size, fitit,
prot, maxprot, docow);