From owner-svn-src-head@freebsd.org Thu Mar 16 05:13:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A705D0E002; Thu, 16 Mar 2017 05:13:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB1F51B32; Thu, 16 Mar 2017 05:13:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B655210A7B9; Thu, 16 Mar 2017 01:13:32 -0400 (EDT) From: John Baldwin To: Kristof Provost Cc: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r315136 - head/sys/netpfil/pf Date: Wed, 15 Mar 2017 22:10:40 -0700 Message-ID: <2786760.AftPCYT2ud@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <00566E96-2330-4354-9095-6D8F77C3AB26@FreeBSD.org> References: <201703120542.v2C5gvM4075391@repo.freebsd.org> <1803226.Igex2bR0P8@ralph.baldwin.cx> <00566E96-2330-4354-9095-6D8F77C3AB26@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 16 Mar 2017 01:13:32 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Mar 2017 05:13:41 -0000 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=20 > > interrupt > > after 'wakeup_one(pf_purge_thread)' and before 'tsleep(..., 0)' in > > pf_unload(). If the interrupt preempts and results in the purge=20= > > thread > > running and issuing its wakeup before the thread executing pf_unloa= d() > > resumes, then eventually when pf_unload() resumes it will do a=20 > > tsleep() with > > no timeout that will never be awoken. > > > Thank you for the thorough explanation. I=E2=80=99ll work on a fix an= d post it=20 > for > review as soon as I can. >=20 > > You obviously didn't test this in a debug kernel since there is a=20= > > KASSERT > > explicitly to catch obvious tsleep races in _sleep(): > > > > KASSERT(sbt !=3D 0 || mtx_owned(&Giant) || lock !=3D NULL, > > ("sleeping without a lock")); > > > I=E2=80=99m sure I did test this with both INVARIANTS and WITNESS ena= bled. > 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. --=20 John Baldwin