summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-06-01 05:47:11 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-06-01 05:47:11 +0000
commit1e24c97c7b4f03efb629394ef55cb60566c54990 (patch)
tree42808646676e78c2e62bb83d0ab316878a154935 /sys
parentcc916b1fa10e9b1fdd9ffe51b29ced6d48b5509f (diff)
Correct handling of mlock()/munlock() with len==0 to return success
instead of crashing. Add a KASSERT() to catch other bugs that might result in the tree iterators being reversed. Problem observed by Tom Doherty (tomd at singlesecond.com) ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/uvm/uvm_map.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 6ffe270b394..80b99da28a6 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.153 2012/04/19 12:42:03 ariane Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.154 2012/06/01 05:47:10 guenther Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -2054,6 +2054,8 @@ uvm_map_pageable(struct vm_map *map, vaddr_t start, vaddr_t end,
if (start > end)
return EINVAL;
+ if (start == end)
+ return 0; /* nothing to do */
if (start < map->min_offset)
return EFAULT; /* why? see first XXX below */
if (end > map->max_offset)
@@ -2106,8 +2108,10 @@ uvm_map_pageable(struct vm_map *map, vaddr_t start, vaddr_t end,
error = EINVAL;
goto out;
}
- } else
+ } else {
+ KASSERT(last != first);
last = RB_PREV(uvm_map_addr, &map->addr, last);
+ }
/*
* Wire/unwire pages here.