summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-03-17 03:19:31 +0000
committeralc <alc@FreeBSD.org>2002-03-17 03:19:31 +0000
commit227f4f1377adfc8f4a63826da35c5e87456a473e (patch)
tree3fd13b03ff318882c0192220ac50fc5876b14702 /sys/vm/vm_map.c
parent0fa4622b6586ab2df8824be20c60990998953acd (diff)
downloadFreeBSD-src-227f4f1377adfc8f4a63826da35c5e87456a473e.zip
FreeBSD-src-227f4f1377adfc8f4a63826da35c5e87456a473e.tar.gz
Acquire a read lock on the map inside of vm_map_check_protection() rather
than expecting the caller to do so. This (1) eliminates duplicated code in kernacc() and useracc() and (2) fixes missing synchronization in munmap().
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 3e1b4ab..094372a 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -2071,31 +2071,37 @@ vm_map_check_protection(vm_map_t map, vm_offset_t start, vm_offset_t end,
GIANT_REQUIRED;
+ vm_map_lock_read(map);
if (!vm_map_lookup_entry(map, start, &tmp_entry)) {
+ vm_map_unlock_read(map);
return (FALSE);
}
entry = tmp_entry;
while (start < end) {
if (entry == &map->header) {
+ vm_map_unlock_read(map);
return (FALSE);
}
/*
* No holes allowed!
*/
if (start < entry->start) {
+ vm_map_unlock_read(map);
return (FALSE);
}
/*
* Check protection associated with entry.
*/
if ((entry->protection & protection) != protection) {
+ vm_map_unlock_read(map);
return (FALSE);
}
/* go to next entry */
start = entry->end;
entry = entry->next;
}
+ vm_map_unlock_read(map);
return (TRUE);
}
OpenPOWER on IntegriCloud