git: c0a303b60b8c - stable/13 - issignal(): ignore signals when process is single-threading for exit
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Jun 2022 19:36:56 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0a303b60b8c40c9fd27ec26b6a05d60dbe54547 commit c0a303b60b8c40c9fd27ec26b6a05d60dbe54547 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-05-26 19:18:57 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-06-24 14:45:45 +0000 issignal(): ignore signals when process is single-threading for exit (cherry picked from commit 02a2aacbe2c81be455811fa9d4200101f70a86d2) --- sys/kern/kern_sig.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index a178193d3d1d..b132eaa8de98 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2948,7 +2948,7 @@ sigprocess(struct thread *td, int sig) /* * We should allow pending but ignored signals below - * only if there is sigwait() active, or P_TRACED was + * if there is sigwait() active, or P_TRACED was * on when they were posted. */ if (SIGISMEMBER(ps->ps_sigignore, sig) && @@ -2957,6 +2957,16 @@ sigprocess(struct thread *td, int sig) return (SIGSTATUS_IGNORE); } + /* + * If the process is going to single-thread mode to prepare + * for exit, there is no sense in delivering any signal + * to usermode. Another important consequence is that + * msleep(..., PCATCH, ...) now is only interruptible by a + * suspend request. + */ + if ((p->p_flag2 & P2_WEXIT) != 0) + return (SIGSTATUS_IGNORE); + if ((p->p_flag & (P_TRACED | P_PPTRACE)) == P_TRACED) { /* * If traced, always stop.