linux-stable/arch/parisc/include/asm
Zev Weiss d5aad4c2ca prctl: generalize PR_SET_MDWE support check to be per-arch
Patch series "ARM: prctl: Reject PR_SET_MDWE where not supported".

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.

The prctl_set_mdwe() function already had some special-case logic added
disabling it on PARISC (commit 793838138c, "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.

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


This patch (of 2):

There exist systems other than PARISC where MDWE may not be feasible to
support; rather than cluttering up the generic code with additional
arch-specific logic let's add a generic function for checking MDWE support
and allow each arch to override it as needed.

Link: https://lkml.kernel.org/r/20240227013546.15769-4-zev@bewilderbeest.net
Link: https://lkml.kernel.org/r/20240227013546.15769-5-zev@bewilderbeest.net
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Acked-by: Helge Deller <deller@gmx.de>	[parisc]
Cc: Borislav Petkov <bp@alien8.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: Florent Revest <revest@chromium.org>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ondrej Mosnacek <omosnace@redhat.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Russell King (Oracle) <linux@armlinux.org.uk>
Cc: Sam James <sam@gentoo.org>
Cc: Stefan Roesch <shr@devkernel.io>
Cc: Yang Shi <yang@os.amperecomputing.com>
Cc: Yin Fengwei <fengwei.yin@intel.com>
Cc: <stable@vger.kernel.org>	[6.3+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-03-26 11:07:22 -07:00
..
Kbuild
alternative.h parisc: Mark altinstructions read-only and 32-bit aligned 2023-11-25 09:43:17 +01:00
asm-offsets.h
asmregs.h
assembly.h parisc: Avoid clobbering the C/B bits in the PSW with tophys and tovirt macros 2024-02-27 22:51:44 +01:00
atomic.h
barrier.h
bitops.h
bug.h parisc: Fix asm operand number out of range build error in bug table 2023-11-27 11:01:38 +01:00
cache.h
cacheflush.h mm: Introduce flush_cache_vmap_early() 2023-12-14 00:23:17 -08:00
cachetype.h Introduce cpu_dcache_is_aliasing() across all architectures 2024-02-22 15:27:19 -08:00
checksum.h parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds 2024-02-27 22:51:45 +01:00
cmpxchg.h
compat.h
compat_ucontext.h
current.h
delay.h
dma-mapping.h
dma.h
dwarf.h
eisa_bus.h
eisa_eeprom.h
elf.h parisc: fix mmap_base calculation when stack grows upwards 2023-11-15 15:30:09 -08:00
extable.h parisc: Fix random data corruption from exception handler 2024-01-30 17:18:58 +01:00
fb.h
fixmap.h
floppy.h
ftrace.h
futex.h
grfioctl.h
hardirq.h
hardware.h
hash.h
hugetlb.h
io.h asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr() 2023-11-23 10:37:40 +01:00
irq.h
irqflags.h
jump_label.h work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
kbdleds.h
kexec.h
kfence.h
kgdb.h
kprobes.h parisc/kprobes: always include asm-generic/kprobes.h 2024-02-16 20:18:03 +01:00
ldcw.h parisc: Mark lock_aligned variables 16-byte aligned on SMP 2023-11-25 09:43:17 +01:00
led.h
linkage.h
mman.h prctl: generalize PR_SET_MDWE support check to be per-arch 2024-03-26 11:07:22 -07:00
mmu.h
mmu_context.h
mmzone.h
module.h
page.h arch: simplify architecture specific page size configuration 2024-03-06 19:29:03 +01:00
parisc-device.h parisc: make parisc_bus_type const 2024-02-27 22:51:44 +01:00
parport.h
patch.h
pci.h
pdc.h
pdc_chassis.h
pdcpat.h
perf.h
perf_event.h
pgalloc.h
pgtable.h
prefetch.h
processor.h parisc: fix mmap_base calculation when stack grows upwards 2023-11-15 15:30:09 -08:00
psw.h
ptrace.h
ropes.h
rt_sigframe.h
runway.h
seccomp.h
sections.h
serial.h
shmparam.h
signal.h
smp.h
socket.h
sparsemem.h
special_insns.h parisc: Fix random data corruption from exception handler 2024-01-30 17:18:58 +01:00
spinlock.h
spinlock_types.h parisc: Restore __ldcw_align for PA-RISC 2.0 processors 2023-10-07 20:30:16 +02:00
string.h
superio.h
switch_to.h
syscall.h
thread_info.h
timex.h
tlb.h
tlbflush.h
topology.h
traps.h
uaccess.h parisc: Fix random data corruption from exception handler 2024-01-30 17:18:58 +01:00
ucontext.h
unaligned.h
unistd.h
unwind.h
vdso.h
vmalloc.h