From owner-freebsd-net@freebsd.org Thu Jul 16 18:39:08 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DD95369B48 for ; Thu, 16 Jul 2020 18:39:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4B731m2rX7z3f4J for ; Thu, 16 Jul 2020 18:39:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by mailman.nyi.freebsd.org (Postfix) id 61A94369F24; Thu, 16 Jul 2020 18:39:08 +0000 (UTC) Delivered-To: net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61746369F23 for ; Thu, 16 Jul 2020 18:39:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B731m1vfjz3dy1; Thu, 16 Jul 2020 18:39:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 0B64B106F7; Thu, 16 Jul 2020 18:39:08 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id D56D51F409; Thu, 16 Jul 2020 20:39:05 +0200 (CEST) From: "Kristof Provost" To: "Kajetan Staszkiewicz" Cc: net@FreeBSD.org Subject: Re: Deadlocks when using pf tags or socket owner matching Date: Thu, 16 Jul 2020 20:39:02 +0200 X-Mailer: MailMate (1.13.1r5671) Message-ID: <5C947AE8-3A7A-4584-92CB-1266143792E6@FreeBSD.org> In-Reply-To: <7572280D-1808-46FE-AD72-06F827E1512A@FreeBSD.org> References: <48de3ee4-ba52-f6a7-b2d7-c7d77a635eb9@tuxpowered.net> <7572280D-1808-46FE-AD72-06F827E1512A@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2020 18:39:08 -0000 On 10 Jul 2020, at 22:29, Kristof Provost wrote: > On 8 Jul 2020, at 12:52, Kajetan Staszkiewicz wrote: >> I have forgot to mention my system: it's FreeBSD 11.3-RELEASE-p9 >> >> I have also managed to replicate this (or a similar) issue on a test >> system built with lock debugging and I got this: >> >> Jul 8 10:32:07 hwlb-aw-01 kernel: lock order reversal: >> Jul 8 10:32:07 hwlb-aw-01 kernel: 1st 0xffffffff81850760 pf rulesets >> (pf rulesets) @ >> /usr/home/kajetan.staszkiewicz/freebsd.git/sys/netpfil/pf/pf.c:6006 >> Jul 8 10:32:07 hwlb-aw-01 kernel: 2nd 0xfffff8011f7028a8 tcpinp >> (tcpinp) @ >> /usr/home/kajetan.staszkiewicz/freebsd.git/sys/netinet/in_pcb.c:1994 > > This lock order reversal is almost certainly the reason for the > deadlock you report in your previous e-mail. > > The problem relates to the UID filtering functionality, so not using > that feature will avoid the deadlock. > I believe I’ve seen previous reports about issues in this area as > well. > > I’ll try to put this on my short-sh term todo list, but I can’t > promise anything. Free time is exceptionally rare these days. > I can’t seem to reproduce the LOR (or the deadlock). Can you share a minimal ruleset that triggers this problem? Thanks, Kristof