]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fork: Suspend other threads if both RFPROC and RFMEM are not set
authorMark Johnston <markj@FreeBSD.org>
Thu, 13 May 2021 12:33:23 +0000 (08:33 -0400)
committerMark Johnston <markj@FreeBSD.org>
Thu, 13 May 2021 12:33:23 +0000 (08:33 -0400)
commit9246b3090cbc82c54350391601b9acef2aa9a625
treef40350462945ea1ea491e183e08d30e2a243fd58
parentb23362afa9956a22225dc4edd5dd4d5883e39de8
fork: Suspend other threads if both RFPROC and RFMEM are not set

Otherwise, a multithreaded parent process may trigger races in
vm_forkproc() if one thread calls rfork() with RFMEM set and another
calls rfork() without RFMEM.

Also simplify vm_forkproc() a bit, vmspace_unshare() already checks to
see if the address space is shared.

Reported by: syzbot+0aa7c2bec74c4066c36f@syzkaller.appspotmail.com
Reported by: syzbot+ea84cb06937afeae609d@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30220
sys/kern/kern_fork.c
sys/vm/vm_glue.c
sys/vm/vm_map.c