Re: [PATCH] mm: Check writable zero page in page table check

From: Edgecombe, Rick P
Date: Mon Sep 05 2022 - 14:51:06 EST


On Sat, 2022-09-03 at 10:13 +0800, Huang, Shaoqin wrote:
> > + BUG_ON(is_zero_pfn(pfn) && rw);
> > +
>
> Why we need use BUG_ON() here? Based on [1], we should avoid to use
> the
> BUG_ON() due to it will panic the machine.
>
> [1]:
> https://lore.kernel.org/lkml/20220824163100.224449-1-david@xxxxxxxxxx/

Yea, you are probably right. All the rest of this checker uses BUG_ON()
though. Maybe they should all be something else? Just felt weird to
have this be the only check that is different.

I don't have any objections to changing it to WARN_ON(). Should I
switch the rest of the checks here while I'm at it?