From nobody Sat Sep 25 16:34:42 2021 X-Original-To: net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 59B6017CFAD7 for ; Sat, 25 Sep 2021 16:34:46 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGvd227ZGz4nF1; Sat, 25 Sep 2021 16:34:46 +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 "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 16CDBBCEE; Sat, 25 Sep 2021 16:34:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id E1F474182D; Sat, 25 Sep 2021 18:34:43 +0200 (CEST) From: Kristof Provost To: Andriy Gapon Cc: net@freebsd.org Subject: Re: page fault in pfioctl Date: Sat, 25 Sep 2021 18:34:42 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: In-Reply-To: References: <980E0B5C-41CF-466E-AD45-7B93532199F4@freebsd.org> List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On 25 Sep 2021, at 18:25, Andriy Gapon wrote: > On 13/06/2021 11:19, Kristof Provost wrote: >> On 13 Jun 2021, at 09:41, Andriy Gapon wrote: >>> Based on >>> the panic message (page fault with non-sleepable locks held), it seem= s that >>> the problem is with holding the lock across the copyout. Usually tha= t >>> won't panic, but if the destination happens to be paged out... And on= ly >>> with INVARIANTS, I guess... >> >> Oh right. Thanks. I=E2=80=99ve gotten bitten by that one before, but h= ad clearly >> garbage collected the memory. >> >> I=E2=80=99ll fix this one and check for others on Monday. >> >> I=E2=80=99ll also see of we can persuade copyout to always panic on th= is bug, not >> just when the destination memory is actually paged out. That way we=E2= =80=99ll catch >> this in the regression tests in the future. > > I upgraded to the latest stable/13 and hit a fresh panic of the same ty= pe. > This time it's in pf_getstatus() and it's a copyout while 'pf rulesets'= lock is held. > I believe that=E2=80=99s fixed by https://cgit.freebsd.org/src/commit/sys= /netpfil/pf/pf_ioctl.c?id=3Dcb13059663e455b3fc69c293dadec53c164490dc Best regards, Kristof