[PATCH v3 00/13] arm64: Unmap linear alias of kernel data/bss

From: Ard Biesheuvel

Date: Fri Mar 20 2026 - 11:18:50 EST


From: Ard Biesheuvel <ardb@xxxxxxxxxx>

One of the reasons the lack of randomization of the linear map on arm64
is considered problematic is the fact that bootloaders adhering to the
original arm64 boot protocol may place the kernel at the base of DRAM,
and therefore at the base of the non-randomized linear map. This puts a
writable alias of the kernel's data and bss regions at a predictable
location, removing the need for an attacker to guess where KASLR mapped
the kernel.

Let's unmap this linear, writable alias entirely, so that knowing the
location of the linear alias does not give write access to the kernel's
data and bss regions.

Changes since v2:
- Keep bm_pte[] in the region that is remapped r/o or unmapped, as it is
only manipulated via its kernel alias
- Drop check that prohibits any manipulation of descriptors with the
CONT bit set
- Add Ryan's ack to a couple of patches
- Rebase onto v7.0-rc4

Changes since v1:
- Put zero page patch at the start of the series
- Tweak __map_memblock() API to respect existing table and contiguous
mappings, so that the logic to map the kernel alias can be simplified
- Stop abusing the MEMBLOCK_NOMAP flag to initially omit the kernel
linear alias from the linear map
- Some additional cleanup patches
- Use proper API [set_memory_valid()] to (un)map the linear alias of
data/bss.

Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx>
Cc: Liz Prucka <lizprucka@xxxxxxxxxx>
Cc: Seth Jenkins <sethjenkins@xxxxxxxxxx>
Cc: Kees Cook <kees@xxxxxxxxxx>
Cc: linux-hardening@xxxxxxxxxxxxxxx

Ard Biesheuvel (13):
arm64: Move the zero page to rodata
arm64: mm: Preserve existing table mappings when mapping DRAM
arm64: mm: Preserve non-contiguous descriptors when mapping DRAM
arm64: mm: Remove bogus stop condition from map_mem() loop
arm64: mm: Drop redundant pgd_t* argument from map_mem()
arm64: mm: Permit contiguous descriptors to be rewritten
arm64: mm: Use hierarchical XN mapping for the fixmap
arm64: kfence: Avoid NOMAP tricks when mapping the early pool
arm64: mm: Permit contiguous attribute for preliminary mappings
arm64: Move fixmap page tables to end of kernel image
arm64: mm: Don't abuse memblock NOMAP to check for overlaps
arm64: mm: Map the kernel data/bss read-only in the linear map
arm64: mm: Unmap kernel data/bss entirely from the linear map

arch/arm64/include/asm/pgtable.h | 4 +
arch/arm64/include/asm/sections.h | 1 +
arch/arm64/kernel/vmlinux.lds.S | 6 +
arch/arm64/mm/fixmap.c | 8 +-
arch/arm64/mm/mmu.c | 138 +++++++++++---------
5 files changed, 90 insertions(+), 67 deletions(-)


base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
--
2.53.0.959.g497ff81fa9-goog