Date: Sun, 13 Jun 2021 10:19:18 +0200 From: Kristof Provost <kp@freebsd.org> To: Andriy Gapon <avg@freebsd.org> Cc: net@freebsd.org Subject: Re: page fault in pfioctl Message-ID: <980E0B5C-41CF-466E-AD45-7B93532199F4@freebsd.org> In-Reply-To: <cc06b2d5-5349-33f3-4bdd-aa2ba5fa75b4@FreeBSD.org> References: <cc06b2d5-5349-33f3-4bdd-aa2ba5fa75b4@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 13 Jun 2021, at 09:41, Andriy Gapon <avg@freebsd.org> wrote: >=20 > =EF=BB=BFOn 13/06/2021 10:26, Kristof Provost wrote: >>> On 12 Jun 2021, at 19:59, Andriy Gapon wrote: >>> Not sure if this has been reported, or maybe even fixed, yet. >>> The crash happened with stable/13 as of 92f49c769b4 (June 3). >>> Judging from the time I think that it happened when running a periodic r= eport (likely 520.pfdenied). >>> I have the vmcore, can take a look into it on Monday. >>>=20 >>> Ah, and I must add that this is a custom kernel configuration with INVAR= IANTS. >>>=20 >>> Kernel page fault with the following non-sleepable locks held: >>> exclusive rm pf rulesets (pf rulesets) r =3D 0 (0xffffffff85558e58) lock= ed @ /usr/devel/git/trant/sys/netpfil/pf/pf_ioctl.c:2459 >>>=20 >> This panic doesn=E2=80=99t seem to ring any bells for me. >> I=E2=80=99d be interested in seeing what kgdb can pull out of the vmcore.= >> The line number for the lock would suggest it happened in DIOCGETRULENV, a= nd the backtrace suggests it=E2=80=99s during the copyout. >> I=E2=80=99m just not sure how that=E2=80=99d panic, because we copy out t= he result of nvlist_pack() (and have checked that for NULL), using the size i= t gave us. >> Hopefully the vmcore will be more enlightening. >> That is fairly new code though, so bugs are not impossible. >=20 > Based on the panic message (page fault with non-sleepable locks held), it s= eems that the problem is with holding the lock across the copyout. Usually t= hat won't panic, but if the destination happens to be paged out... > And only with INVARIANTS, I guess... Oh right. Thanks.=20 I=E2=80=99ve gotten bitten by that one before, but had clearly garbage colle= cted the memory.=20 I=E2=80=99ll fix this one and check for others on Monday.=20 I=E2=80=99ll also see of we can persuade copyout to always panic on this bug= , not just when the destination memory is actually paged out.=20 That way we=E2=80=99ll catch this in the regression tests in the future.=20 Best regards, Kristof=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?980E0B5C-41CF-466E-AD45-7B93532199F4>