Re: [PATCH v4 02/15] mm: Make empty_zero_page __ro_after_init

From: Kees Cook

Date: Mon May 11 2026 - 14:46:21 EST


On Fri, May 08, 2026 at 07:02:51PM +0200, Jann Horn wrote:
> On Mon, Apr 27, 2026 at 5:44 PM Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
> > The empty zero page is used to back any kernel or user space mapping
> > that is supposed to remain cleared, and so the page itself is never
> > supposed to be modified.
> >
> > So make it __ro_after_init rather than __page_aligned_bss: on most
> > architectures, this ensures that both the kernel's mapping of it and any
> > aliases that are accessible via the kernel direct (linear) map are
> > mapped read-only, and cannot be used (inadvertently or maliciously) to
> > corrupt the contents of the zero page.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
>
> Reviewed-by: Jann Horn <jannh@xxxxxxxxxx>
>
> Sorry, I should have looked at this properly earlier instead of ending
> up duplicating this patch with
> <https://lore.kernel.org/all/20260508-ro-zeropage-v1-1-9808abc20b49@xxxxxxxxxx/>.

As you mention in your testing of the patch, could we add an LKDTM test
that does the same to catch any regressions?

--
Kees Cook