diff options
author | dyson <dyson@FreeBSD.org> | 1996-12-30 03:56:11 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1996-12-30 03:56:11 +0000 |
commit | bc06bff4301fb86fcaae70db3ffb288fb4fa9624 (patch) | |
tree | 8d21599a817994d6ed249141f109d096e1cf2a30 /sys/vm | |
parent | 1d16d2e5a018aea3b92b0e8f18145691ed991d87 (diff) | |
download | FreeBSD-src-bc06bff4301fb86fcaae70db3ffb288fb4fa9624.zip FreeBSD-src-bc06bff4301fb86fcaae70db3ffb288fb4fa9624.tar.gz |
EEEK!!! useracc and kernacc didn't lock their respective
maps. Additionally, eliminate the map->hint distortion
associated with useracc. That may/may-not be the "right"
thing to do -- but time will tell.
Submitted by: Partially by Alan Cox <alc@cs.rice.edu>
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_glue.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 30cf0a9..c7567f8 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -59,7 +59,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_glue.c,v 1.55 1996/10/17 02:58:20 dyson Exp $ + * $Id: vm_glue.c,v 1.56 1996/12/22 23:17:09 joerg Exp $ */ #include "opt_rlimit.h" @@ -126,7 +126,9 @@ kernacc(addr, len, rw) saddr = trunc_page(addr); eaddr = round_page(addr + len); + vm_map_lock_read(kernel_map); rv = vm_map_check_protection(kernel_map, saddr, eaddr, prot); + vm_map_unlock_read(kernel_map); return (rv == TRUE); } @@ -137,6 +139,8 @@ useracc(addr, len, rw) { boolean_t rv; vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; + vm_map_t map; + vm_map_entry_t save_hint; /* * XXX - check separately to disallow access to user area and user @@ -151,8 +155,18 @@ useracc(addr, len, rw) || (vm_offset_t) addr + len < (vm_offset_t) addr) { return (FALSE); } - rv = vm_map_check_protection(&curproc->p_vmspace->vm_map, + map = &curproc->p_vmspace->vm_map; + vm_map_lock_read(map); + /* + * We save the map hint, and restore it. Useracc appears to distort + * the map hint unnecessarily. + */ + save_hint = map->hint; + rv = vm_map_check_protection(map, trunc_page(addr), round_page(addr + len), prot); + map->hint = save_hint; + vm_map_unlock_read(map); + return (rv == TRUE); } |