diff options
author | dg <dg@FreeBSD.org> | 1995-03-25 17:36:00 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-25 17:36:00 +0000 |
commit | 28ae667091b2cb78b2b41ca0860f0e1c5d9179ee (patch) | |
tree | 3780d53d35c9ca5ea3bba6d917cc22f85cb42b5b /sys/vm | |
parent | 11faf3ee80d1ed83a9a589e08c4e025c1b57d641 (diff) | |
download | FreeBSD-src-28ae667091b2cb78b2b41ca0860f0e1c5d9179ee.zip FreeBSD-src-28ae667091b2cb78b2b41ca0860f0e1c5d9179ee.tar.gz |
Disallow both MS_ASYNC and MS_INVALIDATE flags being set at the same time
in msync().
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_mmap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index ed5d00a..66167de 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.18 1995/03/22 05:08:41 davidg Exp $ + * $Id: vm_mmap.c,v 1.19 1995/03/25 16:55:46 davidg Exp $ */ /* @@ -323,13 +323,16 @@ msync(p, uap, retval) printf("msync(%d): addr %x len %x\n", p->p_pid, uap->addr, uap->len); #endif - if (((int) uap->addr & PAGE_MASK) || uap->addr + uap->len < uap->addr) - return (EINVAL); + map = &p->p_vmspace->vm_map; addr = (vm_offset_t) uap->addr; size = (vm_size_t) uap->len; flags = uap->flags; + if (((int) addr & PAGE_MASK) || addr + size < addr || + (flags & (MS_ASYNC|MS_INVALIDATE)) == (MS_ASYNC|MS_INVALIDATE)) + return (EINVAL); + /* * XXX Gak! If size is zero we are supposed to sync "all modified * pages with the region containing addr". Unfortunately, we don't |