From: claudio Date: Fri, 11 Aug 2023 07:54:18 +0000 (+0000) Subject: Move the single_thread_check() to the start of userret(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=88dbeb6fd6094817c82a7cd285c5a34274957112;p=openbsd Move the single_thread_check() to the start of userret(). This way threads stopped by SINGLE_SUSPEND will check for pending signals right after being released instead of returning to userland first. The same order of check is already used in sleep_signal_check(). OK mpi@ --- diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index fba5f72d8bf..098e199152d 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.310 2023/07/14 07:07:08 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.311 2023/08/11 07:54:18 claudio Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1970,6 +1970,9 @@ userret(struct proc *p) struct sigctx ctx; int signum; + if (p->p_flag & P_SUSPSINGLE) + single_thread_check(p, 0); + /* send SIGPROF or SIGVTALRM if their timers interrupted this thread */ if (p->p_flag & P_PROFPEND) { atomic_clearbits_int(&p->p_flag, P_PROFPEND); @@ -2003,9 +2006,6 @@ userret(struct proc *p) postsig(p, signum, &ctx); } - if (p->p_flag & P_SUSPSINGLE) - single_thread_check(p, 0); - WITNESS_WARN(WARN_PANIC, NULL, "userret: returning"); p->p_cpu->ci_schedstate.spc_curpriority = p->p_usrpri;