In uvm_map_protect(), make sure we select a first map entry that ends after
authorkettenis <kettenis@openbsd.org>
Sun, 22 Jul 2018 14:33:44 +0000 (14:33 +0000)
committerkettenis <kettenis@openbsd.org>
Sun, 22 Jul 2018 14:33:44 +0000 (14:33 +0000)
the start of the range of pages that we're changing.  Prevents a panic from
a somewhat convoluted test case that anton@ came up with.

ok guenther@, anton@

sys/uvm/uvm_map.c

index 756a5c2..c8a814d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_map.c,v 1.237 2018/04/18 16:05:21 deraadt Exp $   */
+/*     $OpenBSD: uvm_map.c,v 1.238 2018/07/22 14:33:44 kettenis Exp $  */
 /*     $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
 
 /*
@@ -3197,7 +3197,7 @@ uvm_map_protect(struct vm_map *map, vaddr_t start, vaddr_t end,
         */
        first = uvm_map_entrybyaddr(&map->addr, start);
        KDASSERT(first != NULL);
-       if (first->end < start)
+       if (first->end <= start)
                first = RBT_NEXT(uvm_map_addr, first);
 
        /* First, check for protection violations. */