In particular, this fixes one syzkaller report, and another case where Peter reported unkillable process in 'T' state.
Specific commits:
commit d64f8f383004106add5ffc038bb8049d02330cd7 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 03:37:55 2022 +0300 fork_norfproc(): style Sponsored by: The FreeBSD Foundation MFC after: 3 days commit cacf54d2a9fd0bc2fcf7d5f29f6118644c2e4709 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 03:19:36 2022 +0300 sleepq_check_ast_sc_locked(): update comment The relock order is important not only for a signal delivery, but also for the suspension requests. Sponsored by: The FreeBSD Foundation MFC after: 3 days commit 05ebb7725ed810df466f7b10554f328223875839 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 03:35:45 2022 +0300 sleepq_set_timeout_sbt(): correct comment to not talk about ticks It is sbt now. Also, explain what flags are. Sponsored by: The FreeBSD Foundation MFC after: 3 days commit 5946bbaed07483839ba256d93a580111878d7654 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 23:16:29 2022 +0300 exit1(): update comment about thread_single() We do not check single-threading conditions in trap, or when sleeping uninterruptible. Sponsored by: The FreeBSD Foundation MFC after: 3 days commit 0593efdac8346ac17319c5f095895a5fa7a8309f Author: Konstantin Belousov <kib@FreeBSD.org> Date: Sat Aug 13 01:12:20 2022 +0300 reap_kill_proc_locked(): remove outdated part of the comment Sponsored by: The FreeBSD Foundation MFC after: 3 days commit 3ce79f5689d1f214c346499ab46b85a00e0d3924 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Wed Aug 10 20:03:31 2022 +0300 fork_norfproc(): unlock p1 before retrying Reported by: markj Syzkaller: 647212368c3f32c6f13f Sponsored by: The FreeBSD Foundation MFC after: 1 week commit 2cf62f6fa16db9a7b338ba222cdc93c2a4ea12ce Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 22:37:08 2022 +0300 REAP_KILL_PROC: kill processes in the threaded taskqueue context There is a problem still left after the fixes to REAP_KILL_PROC. The handling of the stopping signals by sig_suspend_threads() can occur outside the stopping process context by tdsendsignal(), and it uses mostly the same mechanism of aborting sleeps as suspension. In other words, it badly interacts with thread_single(SINGLE_ALLPROC). But unlike single threading from the process context, we cannot wait by sleep for other single threading requests to pass, because we own spinlock(s). Fix this by moving the both the thread_single(p2, SINGLE_ALLPROC) and signalling, to the threaded taskqueue which cannot be single-threaded itself. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit 56070efea6f69aa596fda84b759b82977b0ace95 Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 22:59:56 2022 +0300 Remove struct proc p_singlethr member It does not serve any purpose after we stopped doing thread_single(SINGLE_ALLPROC) from stoppable user processes. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks commit 12f90de3a1aca20efce26e4a1c66fbf1c7c4dbfc Author: Konstantin Belousov <kib@FreeBSD.org> Date: Fri Aug 12 23:25:00 2022 +0300 Remove TDF_DOING_SA We cannot see a thread with the flag set in unsuspend, after we stopped doing SINGLE_ALLPROC from user processes. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks