From 9f371b9630db67a7c2de8ae621e3eeb4847b1a43 Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 10 Aug 2023 20:44:52 +0000 Subject: [PATCH] Add some KASSERT on the proc p_stat in sleep_finish() OK mpi@ --- sys/kern/kern_synch.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index d4087b5fcce..cd1f4eafcf8 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.195 2023/07/14 07:07:08 claudio Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.196 2023/08/10 20:44:52 claudio Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -397,12 +397,15 @@ sleep_finish(int timo, int do_sleep) */ if (p->p_wchan == NULL) do_sleep = 0; - atomic_clearbits_int(&p->p_flag, P_WSLEEP); + if (do_sleep) { + KASSERT(p->p_stat == SSLEEP || p->p_stat == SSTOP); p->p_ru.ru_nvcsw++; mi_switch(); } else { + KASSERT(p->p_stat == SONPROC || p->p_stat == SSLEEP || + p->p_stat == SSTOP); unsleep(p); p->p_stat = SONPROC; } -- 2.20.1