diff options
author | alc <alc@FreeBSD.org> | 2003-11-19 18:48:45 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-11-19 18:48:45 +0000 |
commit | e054e0d24803ae9e349c913a5aea2d6f1cdd253f (patch) | |
tree | e0e171ae2d8b0113334ac50338a22837f871df47 | |
parent | 404972795aba8ce758e0efe5d88506ff889e20b4 (diff) | |
download | FreeBSD-src-e054e0d24803ae9e349c913a5aea2d6f1cdd253f.zip FreeBSD-src-e054e0d24803ae9e349c913a5aea2d6f1cdd253f.tar.gz |
- Avoid a lock-order reversal between Giant and a system map mutex that
occurs when kmem_malloc() fails to allocate a sufficient number of vm
pages. Specifically, we avoid the lock-order reversal by not grabbing
Giant around pmap_remove() if the map is the kmem_map.
Approved by: re (jhb)
Reported by: Eugene <eugene3@web.de>
-rw-r--r-- | sys/vm/vm_map.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index ce19241..671cbac 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2173,11 +2173,13 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) vm_map_entry_unwire(map, entry); } - mtx_lock(&Giant); + if (map != kmem_map) + mtx_lock(&Giant); vm_page_lock_queues(); pmap_remove(map->pmap, entry->start, entry->end); vm_page_unlock_queues(); - mtx_unlock(&Giant); + if (map != kmem_map) + mtx_unlock(&Giant); /* * Delete the entry (which may delete the object) only after |