]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm: Make empty_zero_page[] const
authorArd Biesheuvel <ardb@kernel.org>
Fri, 29 May 2026 15:02:04 +0000 (17:02 +0200)
committerWill Deacon <will@kernel.org>
Tue, 2 Jun 2026 15:29:16 +0000 (16:29 +0100)
commit0aae825f1ed7ce3eedfadc54684aa86bbbe188b0
treee45bc42a316730a2a3d91dc1e8d73d1ccdeade17
parent99bad3e992e26addd2a7d779cfbe42c048abd808
mm: Make empty_zero_page[] const

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 mark it as const, which moves it into .rodata rather than .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.

Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Jann Horn <jannh@google.com>
Reviewed-by: Feng Tang <feng.tang@linux.alibaba.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
include/linux/pgtable.h
mm/mm_init.c