From owner-freebsd-current@FreeBSD.ORG Mon Jul 3 20:07:19 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DBAB16A403 for ; Mon, 3 Jul 2006 20:07:19 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from ems01.seccuris.com (ems01.seccuris.com [204.112.0.35]) by mx1.FreeBSD.org (Postfix) with SMTP id 5A32943D45 for ; Mon, 3 Jul 2006 20:07:18 +0000 (GMT) (envelope-from csjp@FreeBSD.org) Received: (qmail 66610 invoked by uid 86); 3 Jul 2006 20:47:36 -0000 Received: from unknown (HELO ?127.0.0.1?) (204.112.0.37) by ems01.seccuris.com with SMTP; 3 Jul 2006 20:47:36 -0000 Message-ID: <44A978F7.1010607@FreeBSD.org> Date: Mon, 03 Jul 2006 15:07:19 -0500 From: "Christian S.J. Peron" User-Agent: Thunderbird 1.5.0.4 (Macintosh/20060530) MIME-Version: 1.0 To: Fredrik Lindberg References: <44A927AC.7080807@shapeshifter.se> <20060703181408.GB734@funkthat.com> <44A965BD.70101@shapeshifter.se> In-Reply-To: <44A965BD.70101@shapeshifter.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: John-Mark Gurney , freebsd-current@freebsd.org Subject: Re: panic: knlist locked, but should not be X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2006 20:07:19 -0000 Fredrik Lindberg wrote: > John-Mark Gurney wrote: >> >> Why not drop the lock lines and keep the 0? As you said since it's >> the same lock, locking it a bit later won't hurt... >> > > A yes of course the locks can be dropped from filt_bpfdetach(), that's > probably better. But bpfkqfilter() will have to keep its lock because it > modifies data. The lines could also be swapped (releasing the lock > before calling knlist_add) but that would just be stupid as the lock > would be acquired again in knlist_add. > > Fredrik Lindberg > > I have committed a fix for this which should make everyone happy. However, my change 1.161 didn't actually fix what I had originally set out to fix, as there is still a race between kevent(2) and close(2). I think a possible solution here might be to extend the scope of the bpf_mtx mutex in bpfclose and pickup that lock in the kqueue operations. I need to give this a bit more thought. Sorry for the breakage, and thanks for bringing this to my attention! -- Christian S.J. Peron csjp@FreeBSD.ORG FreeBSD Committer FreeBSD Security Team