summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_glue.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/vm/vm_glue.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/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index fd18159..3b09a4b 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -149,26 +149,18 @@ useracc(addr, len, rw)
{
boolean_t rv;
vm_prot_t prot;
+ vm_map_t map;
KASSERT((rw & ~VM_PROT_ALL) == 0,
("illegal ``rw'' argument to useracc (%x)\n", rw));
prot = rw;
- /*
- * XXX - check separately to disallow access to user area and user
- * page tables - they are in the map.
- *
- * XXX - VM_MAXUSER_ADDRESS is an end address, not a max. It was once
- * only used (as an end address) in trap.c. Use it as an end address
- * here too. This bogusness has spread. I just fixed where it was
- * used as a max in vm_mmap.c.
- */
- if ((vm_offset_t) addr + len > /* XXX */ VM_MAXUSER_ADDRESS
- || (vm_offset_t) addr + len < (vm_offset_t) addr) {
+ map = &curproc->p_vmspace->vm_map;
+ if ((vm_offset_t)addr + len > vm_map_max(map) ||
+ (vm_offset_t)addr + len < (vm_offset_t)addr) {
return (FALSE);
}
- rv = vm_map_check_protection(&curproc->p_vmspace->vm_map,
- trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len),
- prot);
+ rv = vm_map_check_protection(map, trunc_page((vm_offset_t)addr),
+ round_page((vm_offset_t)addr + len), prot);
return (rv == TRUE);
}
OpenPOWER on IntegriCloud