From 923856d4233894adc059e368cec7af12e796f708 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 15 Sep 2025 21:50:08 -0400 Subject: kern: vm_map: Add guard pages at end of mappings Place a guard page at the end of every mapping to catch overflows before they start corrupting the system. Signed-off-by: Ian Moffett --- src/sys/vm/vm_map.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sys/vm/vm_map.c b/src/sys/vm/vm_map.c index ed187d8..1b27a21 100644 --- a/src/sys/vm/vm_map.c +++ b/src/sys/vm/vm_map.c @@ -104,5 +104,8 @@ vm_map(struct vm_vas *vas, struct mmu_map *spec, size_t len, int prot) return -1; } + /* Place a guard page at the end */ + spec->va = spec_cpy.va + len; + __vm_map(vas, spec, DEFAULT_PAGESIZE, 0); return 0; } -- cgit v1.2.3