summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-12-30 05:31:21 +0000
committerdyson <dyson@FreeBSD.org>1996-12-30 05:31:21 +0000
commitc232302d3fb7bc2db6053e608cf8843199fea7c1 (patch)
tree897f659fee68ca11a992ee3be71d600f4e9207dc /sys/vm/vm_mmap.c
parenta61ba0575d63937c042107bda370e8c8590d6120 (diff)
downloadFreeBSD-src-c232302d3fb7bc2db6053e608cf8843199fea7c1.zip
FreeBSD-src-c232302d3fb7bc2db6053e608cf8843199fea7c1.tar.gz
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.)
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r--sys/vm/vm_mmap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 3d89951..abd6ff6 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -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);
OpenPOWER on IntegriCloud