linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/2] ARM: prctl: Reject PR_SET_MDWE where not supported
@ 2024-02-27  1:35 Zev Weiss
  2024-02-27  1:35 ` [PATCH RESEND 1/2] prctl: Generalize PR_SET_MDWE support check to be per-arch Zev Weiss
  2024-02-27  1:35 ` [PATCH RESEND 2/2] ARM: prctl: Reject PR_SET_MDWE on pre-ARMv6 Zev Weiss
  0 siblings, 2 replies; 6+ messages in thread
From: Zev Weiss @ 2024-02-27  1:35 UTC (permalink / raw)
  To: Russell King, linux-parisc, linux-arm-kernel, Helge Deller,
	Florent Revest
  Cc: Zev Weiss, James E.J. Bottomley, Borislav Petkov (AMD),
	Yin Fengwei, Mike Rapoport (IBM), Andrew Morton, Kees Cook,
	Yang Shi, Rick Edgecombe, Oleg Nesterov, David Hildenbrand,
	Stefan Roesch, Josh Triplett, Ondrej Mosnacek, Miguel Ojeda,
	linux-kernel, openbmc, Sam James, stable

[Resending as per Russell's request...]

Hello,

I noticed after a recent kernel update that my ARM926 system started
segfaulting on any execve() after calling prctl(PR_SET_MDWE).  After
some investigation it appears that ARMv5 is incapable of providing the
appropriate protections for MDWE, since any readable memory is also
implicitly executable.

(Note that I'm not an expert in either ARM arch details or the mm
subsystem, so please bear with me if I've botched something in the
above analysis.)

The prctl_set_mdwe() function already had some special-case logic
added disabling it on PARISC (commit 793838138c15, "prctl: Disable
prctl(PR_SET_MDWE) on parisc"); this patch series (1) generalizes that
check to use an arch_*() function, and (2) adds a corresponding
override for ARM to disable MDWE on pre-ARMv6 CPUs.

With the series applied, prctl(PR_SET_MDWE) is rejected on ARMv5 and
subsequent execve() calls (as well as mmap(PROT_READ|PROT_WRITE)) can
succeed instead of unconditionally failing; on ARMv6 the prctl works
as it did previously.


Thanks,
Zev

[0] https://lore.kernel.org/all/2023112456-linked-nape-bf19@gregkh/

Zev Weiss (2):
  prctl: Generalize PR_SET_MDWE support check to be per-arch
  ARM: prctl: Reject PR_SET_MDWE on pre-ARMv6

 arch/arm/include/asm/mman.h    | 14 ++++++++++++++
 arch/parisc/include/asm/mman.h | 14 ++++++++++++++
 include/linux/mman.h           |  8 ++++++++
 kernel/sys.c                   |  7 +++++--
 4 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/mman.h
 create mode 100644 arch/parisc/include/asm/mman.h

-- 
2.43.2


_______________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2024-03-19 17:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27  1:35 [PATCH RESEND 0/2] ARM: prctl: Reject PR_SET_MDWE where not supported Zev Weiss
2024-02-27  1:35 ` [PATCH RESEND 1/2] prctl: Generalize PR_SET_MDWE support check to be per-arch Zev Weiss
2024-02-27 10:24   ` Russell King (Oracle)
2024-02-27 19:53     ` Helge Deller
2024-03-19 17:37       ` Zev Weiss
2024-02-27  1:35 ` [PATCH RESEND 2/2] ARM: prctl: Reject PR_SET_MDWE on pre-ARMv6 Zev Weiss

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).