linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: Implement WXN using MDWE hook
@ 2024-03-14  9:48 Ard Biesheuvel
  2024-03-14  9:48 ` [PATCH 1/2] mm: Add arch hook to map_deny_write_exec() Ard Biesheuvel
  2024-03-14  9:48 ` [PATCH 2/2] arm64: mm: add support for WXN memory translation attribute Ard Biesheuvel
  0 siblings, 2 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2024-03-14  9:48 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Ard Biesheuvel, Joey Gouly, Catalin Marinas, Will Deacon,
	Marc Zyngier, Mark Rutland, Ryan Roberts, Anshuman Khandual,
	Kees Cook

From: Ard Biesheuvel <ardb@kernel.org>

While the patches to implement WXN support were under review, the kernel
grew another hook in the mmap()/mprotect() code that is more suitable
for introducing a check against an arch-defined policy whether mappings
that are both writable and executable are permitted at all.

So add this hook, and wire up WXN support on top of it.

This supersedes

cb1a393c40ee mm: add arch hook to validate mmap() prot flag
50e3ed0f93f4 arm64: mm: add support for WXN memory translation attribute

which have been reverted in the arm64/for-next core tree.

Catalin raised the question how this is supposed to interoperate with
Permission Indirection and Permission Overlays, and -while those new CPU
features are entirely undocumented as of yet- the conclusion seems to be
that WXN is only useful on cores that lack those new features, as they
are mutually exclusive with WXN, and disabling them just in favor of WXN
seems unwise. Given that WXN is too coarse grained to honour the
existing user space ABI seamlessly, PIE/POE seem better suited to harden
the use of RW vs RX mappings in user space (but WXN would seem more
appropriate for the kernel if it were limited to EL1 only).

However, Linux/arm64 is deployed widely on systems running vertically
integrated software stacks, where the ability to harden both the kernel
and user space in this manner is believed to be a useful feature.

Link: https://lore.kernel.org/all/ZfHG0oeDcF8N0ZOX@arm.com/T/#u

Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Kees Cook <keescook@chromium.org>

Ard Biesheuvel (2):
  mm: Add arch hook to map_deny_write_exec()
  arm64: mm: add support for WXN memory translation attribute

 arch/arm64/Kconfig                    | 11 +++++++
 arch/arm64/include/asm/cpufeature.h   |  8 +++++
 arch/arm64/include/asm/mman.h         | 16 ++++++++++
 arch/arm64/include/asm/mmu_context.h  | 30 +++++++++++++++++-
 arch/arm64/kernel/pi/idreg-override.c |  4 ++-
 arch/arm64/kernel/pi/map_kernel.c     | 23 ++++++++++++++
 arch/arm64/mm/proc.S                  |  6 ++++
 include/linux/mman.h                  | 32 ++++++++++++++------
 8 files changed, 119 insertions(+), 11 deletions(-)

-- 
2.44.0.278.ge034bb2e1d-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-03-14  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-14  9:48 [PATCH 0/2] arm64: Implement WXN using MDWE hook Ard Biesheuvel
2024-03-14  9:48 ` [PATCH 1/2] mm: Add arch hook to map_deny_write_exec() Ard Biesheuvel
2024-03-14  9:48 ` [PATCH 2/2] arm64: mm: add support for WXN memory translation attribute Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).