svn commit: r276532 - head/sys/kern

Hans Petter Selasky hselasky at FreeBSD.org
Fri Jan 2 13:10:34 UTC 2015


Author: hselasky
Date: Fri Jan  2 13:10:33 2015
New Revision: 276532
URL: https://svnweb.freebsd.org/changeset/base/276532

Log:
  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

Modified:
  head/sys/kern/kern_cons.c

Modified: head/sys/kern/kern_cons.c
==============================================================================
--- head/sys/kern/kern_cons.c	Fri Jan  2 08:57:36 2015	(r276531)
+++ head/sys/kern/kern_cons.c	Fri Jan  2 13:10:33 2015	(r276532)
@@ -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;
 }
 


More information about the svn-src-head mailing list