On Sun, Mar 01, 2020 at 02:16:20PM +0100, Mark Kettenis wrote:
> This probably means that msleep(4) has a similar issue.
Here is the diff for msleep() and rwsleep().
bluhm
Index: kern/kern_synch.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_synch.c,v
retrieving revision 1.162
diff -u -p -r1.162 kern_synch.c
--- kern/kern_synch.c 30 Jan 2020 08:51:27 -0000 1.162
+++ kern/kern_synch.c 1 Mar 2020 13:50:29 -0000
@@ -259,7 +259,6 @@ msleep(const volatile void *ident, struc
sleep_setup(&sls, ident, priority, wmesg);
sleep_setup_timeout(&sls, timo);
- sleep_setup_signal(&sls);
/* XXX - We need to make sure that the mutex doesn't
* unblock splsched. This can be made a bit more
@@ -268,6 +267,8 @@ msleep(const volatile void *ident, struc
spl = MUTEX_OLDIPL(mtx);
MUTEX_OLDIPL(mtx) = splsched();
mtx_leave(mtx);
+ /* signal may stop the process, release mutex before that */
+ sleep_setup_signal(&sls);
error = sleep_finish_all(&sls, 1);
@@ -320,9 +321,10 @@ rwsleep(const volatile void *ident, stru
sleep_setup(&sls, ident, priority, wmesg);
sleep_setup_timeout(&sls, timo);
- sleep_setup_signal(&sls);
rw_exit(rwl);
+ /* signal may stop the process, release rwlock before that */
+ sleep_setup_signal(&sls);
error = sleep_finish_all(&sls, 1);