]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fork: avoid endless wait with PTRACE_FORK and RFSTOPPED.
authorKonstantin Belousov <kib@FreeBSD.org>
Thu, 21 Jun 2018 21:12:49 +0000 (21:12 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Thu, 21 Jun 2018 21:12:49 +0000 (21:12 +0000)
commit6e22bbf66e37e82f572d8cf7a2be5b333c8f41f8
tree443c3f0811caa72c6fd5689fac483c808d3d2008
parentac4bc0c171f8839e74d9f0bcd8e5e31322167361
fork: avoid endless wait with PTRACE_FORK and RFSTOPPED.

An RFSTOPPED thread can't clean TDB_STOPATFORK, which is done in the
fork_return() in its context, so parent is stuck forever.  Triggered
when trying to ptrace linux process.  Instead of waiting for the new
thread to clear TDB_STOPATFORK, tag it as traced and reparent to the
debugger in do_fork(), and let it only notify the debugger when run.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
Reviewed by: jhb
MFC after: 1 week
X-MFC-Note: keep p_dbgwait placeholder intact
Differential revision: https://reviews.freebsd.org/D15857
sys/kern/kern_fork.c
sys/kern/kern_proc.c
sys/kern/kern_sig.c
sys/sys/proc.h