| From: |
| Xueyuan chen <xueyuan.chen21-AT-gmail.com> |
| To: |
| akpm-AT-linux-foundation.org, linux-mm-AT-kvack.org |
| Subject: |
| [RFC PATCH 0/3] make persistent huge zero folio read-only |
| Date: |
| Wed, 27 May 2026 11:56:04 +0800 |
| Message-ID: |
| <20260527035607.14919-1-xueyuan.chen21@gmail.com> |
| Cc: |
| linux-kernel-AT-vger.kernel.org, linux-arm-kernel-AT-lists.infradead.org, x86-AT-kernel.org, catalin.marinas-AT-arm.com, will-AT-kernel.org, tglx-AT-kernel.org, mingo-AT-redhat.com, bp-AT-alien8.de, dave.hansen-AT-linux.intel.com, hpa-AT-zytor.com, david-AT-kernel.org, ljs-AT-kernel.org, ziy-AT-nvidia.com, baolin.wang-AT-linux.alibaba.com, ryan.roberts-AT-arm.com, dev.jain-AT-arm.com, lance.yang-AT-linux.dev, yang-AT-os.amperecomputing.com, jannh-AT-google.com, Xueyuan Chen <xueyuan.chen21-AT-gmail.com> |
| Archive-link: |
| Article |
From: Xueyuan Chen <xueyuan.chen21@gmail.com>
Hi all,
This series makes the persistent huge zero folio read-only in the direct
map.
The motivation comes from Jann Horn's read-only zero page work[1] and the
follow-up discussion[2] with Yang Shi. As Jann pointed out, the kernel has
had bugs, including security bugs, where pages taken with read-only
semantics were later written to. For the huge zero folio, making the direct
map read-only turns such writes into faults instead of silently corrupting
shared zero contents.
The permission change is best effort. If the architecture cannot safely
make the direct map read-only, the kernel keeps using the writable
persistent huge zero folio.
Patch 1 adds the generic support for making the persistent huge zero folio
read-only. Patches 2 and 3 add arm64 and x86 support.
[1] https://lore.kernel.org/linux-mm/20260508-ro-zeropage-v1-...
[2] https://lore.kernel.org/linux-mm/CAHbLzkrXXe7r3n3jXgDKtwZ...
Xueyuan Chen (3):
mm: make persistent huge zero folio read-only
arm64/mm: make huge zero folio read-only in linear map
x86/mm: make huge zero folio read-only in direct map
arch/arm64/Kconfig | 1 +
arch/arm64/mm/pageattr.c | 16 ++++++++++++++++
arch/x86/Kconfig | 1 +
arch/x86/mm/init.c | 11 +++++++++++
include/linux/huge_mm.h | 5 +++++
mm/Kconfig | 17 +++++++++++++++++
mm/huge_memory.c | 25 ++++++++++++++++++++++++-
7 files changed, 75 insertions(+), 1 deletion(-)
--
2.47.3