diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2008-10-08 08:41:20 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2008-10-08 08:41:20 +0000 |
commit | d4c7b6712f195a8861efb56475b39e7679a6ec60 (patch) | |
tree | df69f6a53e9e8df4b21a6ba1b99c221fe18cc7d6 /sys | |
parent | 6f4869dbfe20ece5aa30b0f68ea8286cff86d92d (diff) |
Don't extend amaps beyond what their supposed maximum. This code path is
not taken anymore, but it doesn't hurt to be correct.
from NetBSD, through mickey in pr 5812
prodded by otto@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_amap.c | 5 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 8 |
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c index c939baf29cf..4c79f7ee907 100644 --- a/sys/uvm/uvm_amap.c +++ b/sys/uvm/uvm_amap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.c,v 1.42 2008/09/12 08:55:41 otto Exp $ */ +/* $OpenBSD: uvm_amap.c,v 1.43 2008/10/08 08:41:18 art Exp $ */ /* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */ /* @@ -361,6 +361,9 @@ amap_extend(struct vm_map_entry *entry, vsize_t addsize) * XXXCDC: could we take advantage of a kernel realloc()? */ + if (slotneed >= UVM_AMAP_LARGE) + return E2BIG; + slotalloc = malloc_roundup(slotneed * MALLOC_SLOT_UNIT) / MALLOC_SLOT_UNIT; #ifdef UVM_AMAP_PPREF diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 14a2b536039..61a69aad4d1 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.104 2008/09/23 13:25:46 art Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.105 2008/10/08 08:41:19 art Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -847,10 +847,8 @@ uvm_map_p(struct vm_map *map, vaddr_t *startp, vsize_t size, if (prev_entry->aref.ar_amap) { error = amap_extend(prev_entry, size); - if (error) { - vm_map_unlock(map); - return (error); - } + if (error) + goto step3; } UVMCNT_INCR(map_backmerge); |