From 9f4e9fc9c86f6c8ab1c1cf246d58d998924e0f88 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 22 Jul 2018 14:33:44 +0000 Subject: [PATCH] In uvm_map_protect(), make sure we select a first map entry that ends after 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 756a5c28134..c8a814d8e3c 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -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. */ -- 2.20.1