summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2017-05-16 13:30:49 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2017-05-16 13:30:49 +0000
commit83ce88026502ea33059c05201010ce93e3f6755d (patch)
treed08921dad4e52601a3323c3cc5e3768e1558765a
parent91af3722556bf90712145307ef4e2e3bf104104b (diff)
use _mtx_init instead of __mtx_init inside mtx_init on !WITNESS kernels
_mtx_init uses __MUTEX_IPL to wrap the ipl argument to __mtx_init. without this, mutexes were initted below the mp floor, which allowed deadlocks with the kernel lock to occur. reported by hrvoje popovski and pinpointed by mikeb@ tweaks from phessler@ ok mpi@ visa@
-rw-r--r--sys/sys/mutex.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 9b656d64cfc..20abc7f7f99 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.8 2017/04/20 13:57:30 visa Exp $ */
+/* $OpenBSD: mutex.h,v 1.9 2017/05/16 13:30:48 dlg Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -96,11 +96,11 @@ void _mtx_leave(struct mutex *, const char *, int);
#else /* WITNESS */
-#define mtx_init(m, ipl) __mtx_init(m, ipl)
+#define mtx_init(m, ipl) _mtx_init(m, ipl)
#define mtx_init_flags(m, ipl, name, flags) do { \
(void)(name); (void)(flags); \
- __mtx_init(m, ipl); \
+ _mtx_init(m, ipl); \
} while (0)
#define mtx_enter __mtx_enter