Module Name: src Committed By: christos Date: Mon Jan 10 18:04:20 UTC 2022
Modified Files: src/sys/uvm: uvm_unix.c Log Message: Use p->p_stackbase instead of USRSTACK because the stackbase can move because of ASLR. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/uvm/uvm_unix.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_unix.c diff -u src/sys/uvm/uvm_unix.c:1.50 src/sys/uvm/uvm_unix.c:1.51 --- src/sys/uvm/uvm_unix.c:1.50 Sat Jan 6 11:41:24 2018 +++ src/sys/uvm/uvm_unix.c Mon Jan 10 13:04:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_unix.c,v 1.50 2018/01/06 16:41:24 kamil Exp $ */ +/* $NetBSD: uvm_unix.c,v 1.51 2022/01/10 18:04:20 christos Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_unix.c,v 1.50 2018/01/06 16:41:24 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_unix.c,v 1.51 2022/01/10 18:04:20 christos Exp $"); #include "opt_pax.h" @@ -150,9 +150,9 @@ uvm_grow(struct proc *p, vaddr_t sp) * For common case of already allocated (from trap). */ #ifdef __MACHINE_STACK_GROWS_UP - if (sp < USRSTACK + ctob(vm->vm_ssize)) + if (sp < p->p_stackbase + ctob(vm->vm_ssize)) #else - if (sp >= USRSTACK - ctob(vm->vm_ssize)) + if (sp >= p->p_stackbase - ctob(vm->vm_ssize)) #endif return (1); @@ -160,9 +160,9 @@ uvm_grow(struct proc *p, vaddr_t sp) * Really need to check vs limit and increment stack size if ok. */ #ifdef __MACHINE_STACK_GROWS_UP - nss = btoc(sp - USRSTACK); + nss = btoc(sp - p->p_stackbase); #else - nss = btoc(USRSTACK - sp); + nss = btoc(p->p_stackbase - sp); #endif if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) return (0);