Subject: Re: [next] arm64: allmodconfig: kernel BUG at include/linux/page-flags.h:509

From: Beau Belgrave <[email-masked]>
Date: Fri, 11 Mar 2022 10:13:28 -0800

On Fri, Mar 11, 2022 at 01:04:53PM -0500, Steven Rostedt wrote:
> On Fri, 11 Mar 2022 09:11:23 -0800
> Beau Belgrave <[email-masked]> wrote:
> 
> > Maybe I am mistaken, but I remember reading in the case of a kernel
> > allocated page shared with user space they must be reserved. It was
> > stated that the PTE may not know the PFN belongs to user or kernel.
> > 
> > If this is not the case, I don't see why we couldn't allocate zero'd
> > pages as you describe. We just need to make sure we don't crash user
> > processes touching the page if it does get paged out (and ideally not
> > slow down their execution).
> 
> Anything allocated by the kernel via alloc_page() will never be paged out.
> As the kernel may use it in any location (including NMIs). The ftrace ring
> buffer allocates its pages this way.
> 

Is that true as well for the user process that has this mapped? Will the
user process virtual memory that maps to this ever page it out? I
believe that was the concern. My understanding is by reserving in
kernel, even though it won't page out on that side, marks the user side
entry to not let it page out.

The other thing is that this patch applied to 5.10.X on ARM64 does not
appear to hit this. Is it some weird interaction with something else or
was 5.10.X just getting lucky?

Thanks,
-Beau