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
..
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 locking/atomic: parisc: add preprocessor symbols 2023-06-05 09:57:16 +02:00
barrier.h
bitops.h Revert "parisc: Show error if wrong 32/64-bit compiler is being used" 2022-08-22 11:09:17 +02:00
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 parisc: BTLB: Initialize BTLB tables at CPU startup 2023-09-07 09:12:20 +02:00
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 locking/arch: Rename all internal __xchg() names to __arch_xchg() 2023-04-29 09:08:44 +02:00
compat.h asm-generic: compat: Cleanup duplicate definitions 2022-04-26 13:35:54 -07:00
compat_ucontext.h
current.h parisc: Reduce code size by optimizing get_current() function calls 2022-03-11 19:49:31 +01:00
delay.h
dma-mapping.h dma-mapping: no need to pass a bus_type into get_arch_dma_ops() 2023-02-15 12:35:20 +01:00
dma.h parisc: dma: Add prototype for pcxl_dma_start 2023-08-10 19:12:16 +02:00
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 arch/parisc: Implement <asm/fb.h> with generic helpers 2023-04-20 10:05:01 +02:00
fixmap.h parisc: Don't hardcode assembler bit definitions in tmpalias code 2022-05-23 13:44:24 +02:00
floppy.h arch/*/: remove CONFIG_VIRT_TO_BUS 2022-06-28 13:20:21 +02:00
ftrace.h parisc: ftrace: Add declaration for ftrace_function_trampoline() 2023-08-10 22:51:54 +02:00
futex.h uaccess: remove CONFIG_SET_FS 2022-02-25 09:36:06 +01:00
grfioctl.h parisc: Drop HP-UX constants and structs from grfioctl.h 2023-05-03 17:43:26 +02:00
hardirq.h
hardware.h parisc: Avoid printing the hardware path twice 2022-10-31 15:37:14 +01:00
hash.h
hugetlb.h mm: hugetlb: add huge page size param to set_huge_pte_at() 2023-09-29 17:20:47 -07:00
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 parisc: Check if IRQs are disabled when calling arch_local_irq_restore() 2023-06-30 17:14:13 +02:00
jump_label.h work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
kbdleds.h
Kbuild char/agp: introduce asm-generic/agp.h 2023-02-13 22:13:29 +01:00
kexec.h
kfence.h parisc: Add KFENCE support 2021-10-30 23:11:00 +02:00
kgdb.h parisc: Limit amount of kgdb breakpoints on parisc 2023-05-03 17:41:21 +02:00
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 parisc: led: Rewrite LED/LCD driver to utilizize Linux LED subsystem 2023-08-28 17:58:14 +02:00
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 parisc: Add vDSO support 2022-03-11 19:49:30 +01:00
mmu_context.h parisc: Use constants to encode the space registers like SR_KERNEL 2022-03-11 19:49:31 +01:00
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 PCI: Remove pci_get_legacy_ide_irq() and asm-generic/pci.h 2022-07-22 17:23:45 -05:00
pdc.h parisc: firmware: Simplify calling non-PA20 functions 2023-09-07 09:12:20 +02:00
pdc_chassis.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
pdcpat.h parisc: Add PDC locking functions for rendezvous code 2022-03-29 21:37:12 +02:00
perf.h
perf_event.h
pgalloc.h parisc: rename PGD_ORDER to PGD_TABLE_ORDER 2022-07-17 17:14:43 -07:00
pgtable.h Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
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 parisc: Use PRIV_USER and PRIV_KERNEL in ptrace.h 2021-11-01 07:36:00 +01:00
ropes.h parisc: sba-iommu: Fix sparse warnigs 2023-08-31 21:42:42 +02:00
rt_sigframe.h parisc: Add vDSO support 2022-03-11 19:49:30 +01:00
runway.h parisc: ccio-dma: Create private runway procfs root entry 2023-08-28 18:00:27 +02:00
seccomp.h
sections.h asm-generic: Refactor dereference_[kernel]_function_descriptor() 2022-02-16 23:25:11 +11:00
serial.h
shmparam.h parisc: shmparam.h: Document aliasing requirements of PA-RISC 2023-09-07 08:00:32 +02:00
signal.h
smp.h parisc: Implement __cpu_die() and __cpu_disable() for CPU hotplugging 2022-03-29 21:37:12 +02:00
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 parisc: Fix lightweight spinlock checks to not break futexes 2023-08-10 17:32:09 +02:00
spinlock_types.h parisc: Restore __ldcw_align for PA-RISC 2.0 processors 2023-10-07 20:30:16 +02:00
string.h Revert "parisc: Add assembly implementations for memset, strlen, strcpy, strncpy and strcat" 2021-08-29 10:13:32 -07:00
superio.h
switch_to.h
syscall.h
thread_info.h parisc: move CPU field back into thread_info 2021-11-04 11:21:47 +01:00
timex.h parisc: define get_cycles macro for arch-override 2022-05-13 23:59:23 +02:00
tlb.h
tlbflush.h parisc: Add vDSO support 2022-03-11 19:49:30 +01:00
topology.h parisc: Switch from GENERIC_CPU_DEVICES to GENERIC_ARCH_TOPOLOGY 2022-03-29 21:37:12 +02:00
traps.h parisc: Fix handling off probe non-access faults 2022-03-11 19:49:30 +01:00
uaccess.h parisc: Fix random data corruption from exception handler 2024-01-30 17:18:58 +01:00
ucontext.h
unaligned.h parisc: Drop ifdef __KERNEL__ from non-uapi kernel headers 2021-11-01 07:36:00 +01:00
unistd.h RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
unwind.h
vdso.h parisc: Add vDSO support 2022-03-11 19:49:30 +01:00
vmalloc.h