mtx_unlock(NULL) in kern/kern_timeout.c::softclock()

From: Eygene Ryabinkin <rea-fbsd_at_codelabs.ru>
Date: Sat, 21 Apr 2007 22:58:45 +0400
Good day.

About two weeks ago I started to notice ;)) the kernel panics on
my -CURRENT just after the PPP link establishment. The panics were
in the softclock() function, upon the line 293.

Investigation revealed that I can reproduce this situation with the
100% confidence when the ULE scheduler is used, the pflog(4) is
running in the promiscious mode and the PPP link is activated using
the ppp(8). I have both INVARIANTS and WITNESS compiled in, this
neither affects the crash, nor produces additional messages.  For
the BSD scheduler all is OK, no crashes at all.

The attached patch had fixed my problem: it just checks if we're
going to unlock the NULL mutex and avoids this. I am not very well
educated in the FreeBSD mutexes, but my investigation of the
/sys/sys/mutex.h showed that mtx_unlock(NULL) is not a very bright
idea. Moreover, the softclock() code grabs the c_mtx only when
(c_mtx != NULL), so it should release it only in this case.

May be my case is the sign of some deeper breakage, I do not know.
I had failed to save the kgdb() traces for panics and had recompiled
the kernel since then a number of times, so I am unable to provide
the backtraces now. But I can revert my changes and make the traces
if this will be needed.
-- 
Eygene

Received on Sat Apr 21 2007 - 16:58:52 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:09 UTC