summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-11-27 22:10:10 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-11-27 22:10:10 +0100
commitdf10aa6983e86b688e4a9b4f30db6d07ad540964 (patch)
treeab58cb4e949a1445eb206e438a6746ec9ee1f1e9 /vm
parent97314ab115206137018b0cd7196ce404ceee136c (diff)
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.
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_map.c3
1 files changed, 2 insertions, 1 deletions
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;
}