Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm Use p->p_stackbase instead of USRSTACK because the s...



details:   https://anonhg.NetBSD.org/src/rev/ecbffc033158
branches:  trunk
changeset: 359574:ecbffc033158
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 10 18:04:20 2022 +0000

description:
Use p->p_stackbase instead of USRSTACK because the stackbase can move because
of ASLR.

diffstat:

 sys/uvm/uvm_unix.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 4738bd0a067f -r ecbffc033158 sys/uvm/uvm_unix.c
--- a/sys/uvm/uvm_unix.c        Mon Jan 10 17:50:18 2022 +0000
+++ b/sys/uvm/uvm_unix.c        Mon Jan 10 18:04:20 2022 +0000
@@ -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 @@
         * 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 @@
         * 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);



Home | Main Index | Thread Index | Old Index