Re: [PATCH v5 0/3] mm: make persistent huge zero folio read-only
From: Andrew Morton
Date: Mon Jul 27 2026 - 14:35:40 EST
On Mon, 27 Jul 2026 22:34:23 +0800 Xueyuan Chen <xueyuan.chen21@xxxxxxxxx> wrote:
> The persistent huge zero folio is shared globally and should stay zero
> after initialization. As Jann Horn pointed out[1], kernel bugs have ended
> up writing to pages that were meant to be read-only, including in
> security-sensitive cases. Making the folio read-only in the direct map
> turns such writes into faults instead of silent zero-page corruption.
>
> This series adds set_direct_map_ro_noflush() so mm code can make a
> direct-map range read-only, then uses it for the persistent huge zero
> folio. The helper is direct-map specific, takes an address-based range as
> discussed for set_direct_map* helpers[2], and leaves TLB invalidation to
> the caller.
Thanks. AI review asked about a few things, some pre-existing. Includes
a possible pre-existing ARM barrier issue in arch/arm64/mm/pageattr.c
https://sashiko.dev/#/patchset/20260727143426.1077133-1-xueyuan.chen21@xxxxxxxxx