svn commit: r276971 - stable/8/sys/kern

Hans Petter Selasky hselasky at FreeBSD.org
Sun Jan 11 12:21:40 UTC 2015


Author: hselasky
Date: Sun Jan 11 12:21:39 2015
New Revision: 276971
URL: https://svnweb.freebsd.org/changeset/base/276971

Log:
  MFC r276532 and r276626:
  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.

Modified:
  stable/8/sys/kern/kern_cons.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/kern_cons.c
==============================================================================
--- stable/8/sys/kern/kern_cons.c	Sun Jan 11 12:19:49 2015	(r276970)
+++ stable/8/sys/kern/kern_cons.c	Sun Jan 11 12:21:39 2015	(r276971)
@@ -419,6 +419,13 @@ cnputs(char *p)
 	int unlock_reqd = 0;
 
 	if (use_cnputs_mtx) {
+	  	/*
+		 * NOTE: Debug prints and/or witness printouts in
+		 * console driver clients can cause the "cnputs_mtx"
+		 * mutex to recurse. Simply return if that happens.
+		 */
+		if (mtx_owned(&cnputs_mtx))
+			return;
 		mtx_lock_spin(&cnputs_mtx);
 		unlock_reqd = 1;
 	}


More information about the svn-src-stable-8 mailing list