From 2029b6c9e657b767dabf9a36a9272a89d8fe240c Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 2 Jan 2015 13:10:33 +0000 Subject: [PATCH] The "cnputs_mtx" mutex must be allowed to recurse. Debug prints and/or witness printouts in the console driver clients can cause this mutex to recurse by calls to "printf()" from witness for example. In particular this can happen if "debug.witness.skipspin=0" is set in the boot environment. MFC after: 1 week --- sys/kern/kern_cons.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c index bbc0e5170923..75f9c18ee9dd 100644 --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -601,7 +601,13 @@ static void cn_drvinit(void *unused) { - mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | MTX_NOWITNESS); + /* + * NOTE: Debug prints and/or witness printouts in console + * driver clients can cause the "cnputs_mtx" mutex to + * recurse. Make sure the "MTX_RECURSE" flags is set! + */ + mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | + MTX_NOWITNESS | MTX_RECURSE); use_cnputs_mtx = 1; }