diff options
author | dillon <dillon@FreeBSD.org> | 2001-03-14 06:48:53 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-03-14 06:48:53 +0000 |
commit | be9d069cf0df15e40cb07b595afbe56b5359b408 (patch) | |
tree | 5400fcb9ba1e85e52bb34d8439cc6b6f68e28828 /sys/vm/vm_map.c | |
parent | 3b687e65750ed4e689dbfe35d1267ffffc702907 (diff) | |
download | FreeBSD-src-be9d069cf0df15e40cb07b595afbe56b5359b408.zip FreeBSD-src-be9d069cf0df15e40cb07b595afbe56b5359b408.tar.gz |
Fix a lock reversal problem in the VM subsystem related to threaded
programs. There is a case during a fork() which can cause a deadlock.
From Tor -
The workaround that consists of setting a flag in the vm map that
indicates that a fork is in progress and using that mark in the page
fault handling to force a revalidation failure. That change will only
affect (pessimize) page fault handling during fork for threaded
(linuxthreads style) applications and applications using aio_*().
Submited by: tegge
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r-- | sys/vm/vm_map.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 2b57b9d..6ff0ab9 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -254,6 +254,7 @@ vm_map_init(map, min, max) map->nentries = 0; map->size = 0; map->system_map = 0; + map->infork = 0; map->min_offset = min; map->max_offset = max; map->first_free = &map->header; @@ -2123,6 +2124,7 @@ vmspace_fork(vm1) vm_object_t object; vm_map_lock(old_map); + old_map->infork = 1; vm2 = vmspace_alloc(old_map->min_offset, old_map->max_offset); bcopy(&vm1->vm_startcopy, &vm2->vm_startcopy, @@ -2215,6 +2217,7 @@ vmspace_fork(vm1) } new_map->size = old_map->size; + old_map->infork = 0; vm_map_unlock(old_map); return (vm2); |