svn commit: r315136 - head/sys/netpfil/pf

John Baldwin jhb at freebsd.org
Thu Mar 16 05:13:41 UTC 2017


On Thursday, March 16, 2017 11:32:38 AM Kristof Provost wrote:
> On 15 Mar 2017, at 15:45, John Baldwin wrote:
> > You are ignoring interrupts and preemption.  Suppose you get an 
> > interrupt
> > after 'wakeup_one(pf_purge_thread)' and before 'tsleep(..., 0)' in
> > pf_unload().  If the interrupt preempts and results in the purge 
> > thread
> > running and issuing its wakeup before the thread executing pf_unload()
> > resumes, then eventually when pf_unload() resumes it will do a 
> > tsleep() with
> > no timeout that will never be awoken.
> >
> Thank you for the thorough explanation. I’ll work on a fix and post it 
> for
> review as soon as I can.
> 
> > You obviously didn't test this in a debug kernel since there is a 
> > KASSERT
> > explicitly to catch obvious tsleep races in _sleep():
> >
> >         KASSERT(sbt != 0 || mtx_owned(&Giant) || lock != NULL,
> >             ("sleeping without a lock"));
> >
> I’m sure I did test this with both INVARIANTS and WITNESS enabled.
> Is Giant held during module load/unload?

Oh fooey, it is. :-P  That's one of the few holdouts is peeling Giant
off of that, but my apologies as that would indeed prevent this KASSERT
from firing for module load/unload.

-- 
John Baldwin


More information about the svn-src-head mailing list