mbox series

[0/2] arm64: use XN table mappings for the linear region

Message ID 20210304171145.12281-1-ardb@kernel.org (mailing list archive)
Headers show
Series arm64: use XN table mappings for the linear region | expand

Message

Ard Biesheuvel March 4, 2021, 5:11 p.m. UTC
This patch tweaks the kernel page table population code to set the UXNTable
and PXNTable bits on all table entries that cover the linear region. This
removes the ability for lower level mappings to grant executable permissions
which are never needed in the linear region. And given that swapper's PGD
level is mapped r/o and can only be updated via the fixmap API, this cannot
be trivially reverted by poking writable memory.

This does not address a known exploit or vulnerability, but it applies the
principle of least privilege in a way that does not result in any space
or runtime overhead.

Cc: maz@kernel.org
Cc: catalin.marinas@arm.com
Cc: will@kernel.org
Cc: mark.rutland@arm.com
Cc: anshuman.khandual@arm.com
Cc: qperret@google.com
Cc: kernel-team@android.com

Ard Biesheuvel (2):
  arm64: mm: add missing P4D definitions and use them consistently
  arm64: mm: use XN table mapping attributes for the linear region

 arch/arm64/include/asm/pgtable-hwdef.h | 12 ++++++++
 arch/arm64/mm/mmu.c                    | 31 ++++++++++++++------
 2 files changed, 34 insertions(+), 9 deletions(-)