summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_resource.c
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-09-21 22:07:17 +0000
committerjake <jake@FreeBSD.org>2002-09-21 22:07:17 +0000
commit2b71a04b1e46f7a598269467b77323fad8f53189 (patch)
tree5a29a2272e4b65acf468c2f877289cf21786b297 /sys/kern/kern_resource.c
parent5ea401e1a679065a9e8506758d9735855dc7a419 (diff)
downloadFreeBSD-src-2b71a04b1e46f7a598269467b77323fad8f53189.zip
FreeBSD-src-2b71a04b1e46f7a598269467b77323fad8f53189.tar.gz
Use the fields in the sysentvec and in the vm map header in place of the
constants VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK and PS_STRINGS. This is mainly so that they can be variable even for the native abi, based on different machine types. Get stack protections from the sysentvec too. This makes it trivial to map the stack non-executable for certain abis, on machines that support it.
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r--sys/kern/kern_resource.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 8f02c13..535756c 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -52,6 +52,7 @@
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sx.h>
+#include <sys/sysent.h>
#include <sys/time.h>
#include <vm/vm.h>
@@ -593,13 +594,15 @@ dosetrlimit(td, which, limp)
vm_prot_t prot;
if (limp->rlim_cur > alimp->rlim_cur) {
- prot = VM_PROT_ALL;
+ prot = p->p_sysent->sv_stackprot;
size = limp->rlim_cur - alimp->rlim_cur;
- addr = USRSTACK - limp->rlim_cur;
+ addr = p->p_sysent->sv_usrstack -
+ limp->rlim_cur;
} else {
prot = VM_PROT_NONE;
size = alimp->rlim_cur - limp->rlim_cur;
- addr = USRSTACK - alimp->rlim_cur;
+ addr = p->p_sysent->sv_usrstack -
+ alimp->rlim_cur;
}
addr = trunc_page(addr);
size = round_page(size);
OpenPOWER on IntegriCloud