From df10aa6983e86b688e4a9b4f30db6d07ad540964 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 27 Nov 2022 22:10:10 +0100 Subject: vm_wire_all: Fix vm_map_protect case If a "wire_required" process calls vm_map_protect(0), the memory gets unwired as expected. But if the process then calls vm_map_protect(VM_PROT_READ) again, we need to wire that memory. (This happens to be exactly what glibc does for its heap) This fixes Hurd hangs on lack of memory, during which mach was swapping pieces of mach-defpager out. --- vm/vm_map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vm/vm_map.c') diff --git a/vm/vm_map.c b/vm/vm_map.c index 9f5eb13d..0dec1f20 100644 --- a/vm/vm_map.c +++ b/vm/vm_map.c @@ -1632,7 +1632,8 @@ kern_return_t vm_map_protect( */ if ((current->protection != VM_PROT_NONE) && - (current->wired_access != VM_PROT_NONE)) { + (current->wired_access != VM_PROT_NONE || + map->wiring_required)) { current->wired_access = current->protection; } -- cgit v1.2.3