which were found by more Peter Holm' tests and syzcaller. Around half of it is really fixes for thread_single(MODE_ALLPROC) revealed after use in PROC_REAP_KILL.
Per-commit view is available at https://kib.kiev.ua/git/gitweb.cgi?p=deviant3.git;a=shortlog;h=refs/heads/reap
Below is the git log
commit c4866e78d24571fc056e7244865ff245eea0ecc0 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Tue May 17 02:47:20 2022 +0300 reap_kill_proc(): avoid singlethreading any other process if we are exiting This is racy because curproc process lock is not used, but allows the process to exit faster. It is userspace issue to create such race anyway, and not fullfilling the guarantee that all reaper descendants are signalled should be fine. In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit f28453bc15d24777ad98b3971cb504596b4a9958 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Mon May 16 01:52:09 2022 +0300 reap_kill_subtree(): hold the reaper when entering it into the queue to handle later We drop proctree_lock, which allows the process to exit while memoized in the list to proceed. Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit d4b4dad7a0d54747eecc0754aa1c8482f2b49471 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Tue May 10 00:41:23 2022 +0300 reap_kill_subtree_once(): handle proctree_lock unlock in reap_kill_proc() Recorded reaper might loose its reaper status, so we should not assert it, but check and avoid signalling if this happens. Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 week commit 21beeb0b991cd0d4df74911d3d5e9795fd21446f Author: Konstantin Belousov <kib@FreeBSD.org> Date: Tue May 3 22:49:37 2022 +0300 reap_kill_proc: do not retry on thread_single() failure The failure means that the process does single-threading itself, which makes our action not needed. Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit cb736e0ab0226ec30667f1d722385c7210a46267 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Sun May 1 02:29:25 2022 +0300 Make stop_all_proc_block interruptible to avoid deadlock with parallel suspension If we try to single-thread a process which thread entered procctl(REAP_KILL_SUBTREE), and sleeping waiting for us unlocking stop_all_proc_blocker, we must be able to finish single-threading. This requires the sleep to be interruptible. Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit be3ba48d127222080da8e8e2538936ce61e7e695 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Thu May 12 14:47:40 2022 +0300 thread_single(): remove already checked conditional expression Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit 33c8f199c340c30e194d20a28885bb446fc91917 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Mon May 16 00:55:32 2022 +0300 Do not single-thread itself when the process single-threaded some another process Since both self single-threading and remote single-threading rely on suspending the thread doing thread_single(), it cannot be mixed: thread doing thread_suspend_switch() might be subject to thread_suspend_one() and vice versa. In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit ce9be75f8c31136d93784faa8b81754596e7c966 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Wed May 11 02:37:58 2022 +0300 weed_inhib(): correct the condition to re-suspend a thread suspended for SINGLE_ALLPROC mode. There is no need to check for boundary state. It is only required to see that the suspension comes from the ALLPROC mode. In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit ff86aefa6bf49b8958707aa209746dbdf00bb4a6 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Sun May 1 02:30:13 2022 +0300 weed_inhib(): do not double-suspend already suspended thread if the loop reiterates In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit f34b993c950e824ff1c7872a4174c60c625a01b8 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Tue May 3 22:48:50 2022 +0300 thread_single: wait for P_STOPPED_SINGLE to pass to avoid ALLPROC mode to try to race with any other single-threading mode. In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit ab92a6f353fdca4741d67ac12baa29e7a2876464 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Thu May 5 02:57:26 2022 +0300 P2_WEXIT: avoid thread_single() for exiting process earlier before the process itself does thread_single(SINGLE_EXIT). We cannot single-thread such process in ALLPROC (external) mode, and properly detect and report the failure to do so due to the process becoming zombie is easier to prevent than handle. In collaboration with: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks