diff options
author | 2011-07-05 09:15:57 +0000 | |
---|---|---|
committer | 2011-07-05 09:15:57 +0000 | |
commit | 3db69410cce91f67a19556d72138026d0a2a0f25 (patch) | |
tree | 732dfa125359e5589be9b2dec9e4b5cabbec9085 | |
parent | remove comment: yes, they should be independent (diff) | |
download | wireguard-openbsd-3db69410cce91f67a19556d72138026d0a2a0f25.tar.xz wireguard-openbsd-3db69410cce91f67a19556d72138026d0a2a0f25.zip |
msync has some code that is based on *old* bsd behaviour where
msync(size == 0) did strange things based on the original mapping
segments and trying to manipulate same. This code was copied from the
original vm when we moved to uvm.
posix says nothing about this behaviour and anything that depends on it is
systemically broken, so rip it out and make sys_msync about 30% smaller.
ok deraadt@, tedu@, guenther@.
-rw-r--r-- | sys/uvm/uvm_mmap.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c index e2cda075b0f..954c2045aaf 100644 --- a/sys/uvm/uvm_mmap.c +++ b/sys/uvm/uvm_mmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_mmap.c,v 1.85 2011/07/04 20:35:35 deraadt Exp $ */ +/* $OpenBSD: uvm_mmap.c,v 1.86 2011/07/05 09:15:57 oga Exp $ */ /* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */ /* @@ -636,7 +636,7 @@ sys_msync(struct proc *p, void *v, register_t *retval) vaddr_t addr; vsize_t size, pageoff; vm_map_t map; - int rv, flags, uvmflags; + int flags, uvmflags; /* * extract syscall args from the uap @@ -668,30 +668,6 @@ sys_msync(struct proc *p, void *v, register_t *retval) map = &p->p_vmspace->vm_map; /* - * XXXCDC: do we really need this semantic? - * - * XXX Gak! If size is zero we are supposed to sync "all modified - * pages with the region containing addr". Unfortunately, we - * don't really keep track of individual mmaps so we approximate - * by flushing the range of the map entry containing addr. - * This can be incorrect if the region splits or is coalesced - * with a neighbor. - */ - if (size == 0) { - vm_map_entry_t entry; - - vm_map_lock_read(map); - rv = uvm_map_lookup_entry(map, addr, &entry); - if (rv == TRUE) { - addr = entry->start; - size = entry->end - entry->start; - } - vm_map_unlock_read(map); - if (rv == FALSE) - return (EINVAL); - } - - /* * translate MS_ flags into PGO_ flags */ uvmflags = PGO_CLEANIT; |