summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-08-11 07:54:19 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-08-11 07:54:19 +0000
commit492b5dffa32f533d603eb0bc84f3239697415e63 (patch)
treea8a626497f8d5d0b6eb8dc1b9826f4110b381d14 /sys/kern
parentf9cf566fe29253a10b31fb81dcd84b9d18dbfc06 (diff)
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@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sig.c8
1 files changed, 4 insertions, 4 deletions
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;