diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-10-08 17:03:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-10-08 17:03:10 +0000 |
commit | fe825386fe2ea5bdb3a71e8fbf0b6f41e55b9276 (patch) | |
tree | b130c7b85a64e0cac6a7bca5867f1eca503746e1 | |
parent | bac7aaedc056563406364103b198d96ce0516cb3 (diff) |
The stack can also be marked immutable, because we expect no sane program
to try to change the permissions of it. We won't know who's trying that
until we enable it and see what breaks.
A tricky piece relating to setrlimit stack size changing was previously commited.
ok kettenis
-rw-r--r-- | sys/kern/kern_exec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index af474ee7d8d..8f9fc6ec8cd 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.233 2022/10/08 16:58:34 deraadt Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.234 2022/10/08 17:03:09 deraadt Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -476,6 +476,9 @@ sys_execve(struct proc *p, void *v, register_t *retval) goto exec_abort; #endif + uvm_map_immutable(&p->p_vmspace->vm_map, (vaddr_t)vm->vm_maxsaddr, + (vaddr_t)vm->vm_minsaddr, 1, "stack"); + memset(&arginfo, 0, sizeof(arginfo)); /* remember information about the process */ |