1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-30 09:06:11 +00:00

Assert that P_SINTR is unset on sleep_setup() entry

__set_current_state() from sys/dev/pci/drm/drm_linux.c used to roll
parts of sleep_finish() but forgot to clear P_SINTR. This later lead to
spurious tsleep(0, INFSLP) early returns and ultimately crashes. This
affected me for a few months without being able to get a proper crash
trace, so fail early to prevent such hidden errors in the future.

ok claudio@ jsg@
This commit is contained in:
jca
2025-11-24 12:54:53 +00:00
parent 7a58c247f8
commit d972c9d879

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: kern_synch.c,v 1.232 2025/08/18 04:15:35 dlg Exp $ */
/* $OpenBSD: kern_synch.c,v 1.233 2025/11/24 12:54:53 jca Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -288,6 +288,8 @@ sleep_setup(const volatile void *ident, int prio, const char *wmesg)
#ifdef DIAGNOSTIC
if (p->p_flag & P_CANTSLEEP)
panic("sleep: %s failed insomnia", p->p_p->ps_comm);
if (p->p_flag & P_SINTR)
panic("sleep: stale P_SINTR");
if (ident == NULL)
panic("sleep: no ident");
if (p->p_stat != SONPROC)