public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH v4 00/15] arm64: Unmap linear alias of kernel data/bss
@ 2026-04-27 15:34 Ard Biesheuvel
  2026-04-27 15:34 ` [PATCH v4 01/15] arm64: mm: Map the linear alias of text/rodata as tagged Ard Biesheuvel
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2026-04-27 15:34 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, will, catalin.marinas, mark.rutland, Ard Biesheuvel,
	Ryan Roberts, Anshuman Khandual, Liz Prucka, Seth Jenkins,
	Kees Cook, Mike Rapoport, David Hildenbrand, Andrew Morton,
	linux-mm, linux-hardening

From: Ard Biesheuvel <ardb@kernel.org>

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 (i.e., a substantial fraction of all
Android phones) 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 v3:
- Drop bogus patch adding hierarchical PXN to the fixmap mapping, which
  breaks the KPTI trampoline (thanks to Sashiko)
- Add generic patch to move the empty_zero_page to __ro_after_init, as
  it now lives in generic code.
- Add patches to remap the linear aliases of the fixmap page tables
  read-only too - these live at an a priori known offset in the linear
  map if physical KASLR was omitted, and control a priori known
  addresses in the virtual kernel space.
- Rebase onto v7.1-rc1

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@arm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Liz Prucka <lizprucka@google.com>
Cc: Seth Jenkins <sethjenkins@google.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-hardening@vger.kernel.org

Ard Biesheuvel (15):
  arm64: mm: Map the linear alias of text/rodata as tagged
  mm: Make empty_zero_page __ro_after_init
  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: 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
  arm64: mm: Generalize manipulation code of read-only descriptors
  arm64: mm: Remap linear aliases of the fixmap page tables read-only

 arch/arm64/include/asm/pgtable.h  |  33 ++--
 arch/arm64/include/asm/sections.h |   1 +
 arch/arm64/kernel/vmlinux.lds.S   |  14 +-
 arch/arm64/mm/fixmap.c            |   8 +-
 arch/arm64/mm/mmu.c               | 167 +++++++++++---------
 mm/mm_init.c                      |   2 +-
 6 files changed, 130 insertions(+), 95 deletions(-)


base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.54.0.rc2.544.gc7ae2d5bb8-goog



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-04-27 15:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 15:34 [PATCH v4 00/15] arm64: Unmap linear alias of kernel data/bss Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 01/15] arm64: mm: Map the linear alias of text/rodata as tagged Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 02/15] mm: Make empty_zero_page __ro_after_init Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 03/15] arm64: mm: Preserve existing table mappings when mapping DRAM Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 04/15] arm64: mm: Preserve non-contiguous descriptors " Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 05/15] arm64: mm: Remove bogus stop condition from map_mem() loop Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 06/15] arm64: mm: Drop redundant pgd_t* argument from map_mem() Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 07/15] arm64: mm: Permit contiguous descriptors to be rewritten Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 08/15] arm64: kfence: Avoid NOMAP tricks when mapping the early pool Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 09/15] arm64: mm: Permit contiguous attribute for preliminary mappings Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 10/15] arm64: Move fixmap page tables to end of kernel image Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 11/15] arm64: mm: Don't abuse memblock NOMAP to check for overlaps Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 12/15] arm64: mm: Map the kernel data/bss read-only in the linear map Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 13/15] arm64: mm: Unmap kernel data/bss entirely from " Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 14/15] arm64: mm: Generalize manipulation code of read-only descriptors Ard Biesheuvel
2026-04-27 15:34 ` [PATCH v4 15/15] arm64: mm: Remap linear aliases of the fixmap page tables read-only Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox