]> git.ipfire.org Git - thirdparty/linux.git/commit
arm64: mm: Map the kernel data/bss read-only in the linear map
authorArd Biesheuvel <ardb@kernel.org>
Fri, 29 May 2026 15:02:05 +0000 (17:02 +0200)
committerWill Deacon <will@kernel.org>
Tue, 2 Jun 2026 15:29:16 +0000 (16:29 +0100)
commitf2ba877402e5f74b27d9dbc2c8d059e7e9daf500
treeb732800da7de83755016e1e7f7985aa70cc078ed
parent0aae825f1ed7ce3eedfadc54684aa86bbbe188b0
arm64: mm: Map the kernel data/bss read-only in the linear map

On systems where the bootloader adheres to the original arm64 boot
protocol, the placement of the kernel in the physical address space is
highly predictable, and this makes the placement of its linear alias in
the kernel virtual address space equally predictable, given the lack of
randomization of the linear map.

The linear aliases of the kernel text and rodata regions are already
mapped read-only, but the kernel data and bss are mapped read-write in
this region. This is not needed, so map them read-only as well.

Note that the statically allocated kernel page tables do need to be
modifiable via the linear map, so leave these mapped read-write.

Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/mm/mmu.c