Re: page fault in pfioctl

From: Andriy Gapon <>
Date: Sat, 25 Sep 2021 16:43:35 UTC
On 25/09/2021 19:38, Andriy Gapon wrote:
> On 25/09/2021 19:34, Kristof Provost wrote:
>> 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 seems that
>>>>> the problem is with holding the lock across the copyout.  Usually that
>>>>> won't panic, but if the destination happens to be paged out... And only
>>>>> with INVARIANTS, I guess...
>>>> Oh right. Thanks. I’ve gotten bitten by that one before, but had clearly
>>>> garbage collected the memory.
>>>> I’ll fix this one and check for others on Monday.
>>>> I’ll also see of we can persuade copyout to always panic on this bug, not
>>>> just when the destination memory is actually paged out. That way we’ll catch
>>>> this in the regression tests in the future.
>>> I upgraded to the latest stable/13 and hit a fresh panic of the same type.
>>> This time it's in pf_getstatus() and it's a copyout while 'pf rulesets' lock 
>>> is held.
>> I believe that’s fixed by 
> Thank you for the pointer!
> I believe it should help with the witness warning.
> Still not sure what's going on with copyout_nosmap_std().

Ah, sorry for the noise, trap_fatal() is exactly because the witness did not 
like the fault.

Andriy Gapon