linux-stable/arch/sparc/kernel
Eric W. Biederman fcb116bc43 signal: Replace force_fatal_sig with force_exit_sig when in doubt
Recently to prevent issues with SECCOMP_RET_KILL and similar signals
being changed before they are delivered SA_IMMUTABLE was added.

Unfortunately this broke debuggers[1][2] which reasonably expect
to be able to trap synchronous SIGTRAP and SIGSEGV even when
the target process is not configured to handle those signals.

Add force_exit_sig and use it instead of force_fatal_sig where
historically the code has directly called do_exit.  This has the
implementation benefits of going through the signal exit path
(including generating core dumps) without the danger of allowing
userspace to ignore or change these signals.

This avoids userspace regressions as older kernels exited with do_exit
which debuggers also can not intercept.

In the future is should be possible to improve the quality of
implementation of the kernel by changing some of these force_exit_sig
calls to force_fatal_sig.  That can be done where it matters on
a case-by-case basis with careful analysis.

Reported-by: Kyle Huey <me@kylehuey.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
[1] https://lkml.kernel.org/r/CAP045AoMY4xf8aC_4QU_-j7obuEPYgTcnQQP3Yxk=2X90jtpjw@mail.gmail.com
[2] https://lkml.kernel.org/r/20211117150258.GB5403@xsang-OptiPlex-9020
Fixes: 00b06da29c ("signal: Add SA_IMMUTABLE to ensure forced siganls do not get changed")
Fixes: a3616a3c02 ("signal/m68k: Use force_sigsegv(SIGSEGV) in fpsp040_die")
Fixes: 83a1f27ad7 ("signal/powerpc: On swapcontext failure force SIGSEGV")
Fixes: 9bc508cf07 ("signal/s390: Use force_sigsegv in default_trap_handler")
Fixes: 086ec444f8 ("signal/sparc32: In setup_rt_frame and setup_fram use force_fatal_sig")
Fixes: c317d306d5 ("signal/sparc32: Exit with a fatal signal when try_to_clear_window_buffer fails")
Fixes: 695dd0d634 ("signal/x86: In emulate_vsyscall force a signal instead of calling do_exit")
Fixes: 1fbd60df8a ("signal/vm86_32: Properly send SIGSEGV when the vm86 state cannot be saved.")
Fixes: 941edc5bf1 ("exit/syscall_user_dispatch: Send ordinary signals on failure")
Link: https://lkml.kernel.org/r/871r3dqfv8.fsf_-_@email.froward.int.ebiederm.org
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Kees Cook <keescook@chromium.org>
Tested-by: Kyle Huey <khuey@kylehuey.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2021-11-19 09:15:58 -06:00
..
syscalls compat: remove some compat entry points 2021-09-08 15:32:35 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
adi_64.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482 2019-06-19 17:09:52 +02:00
apc.c
asm-offsets.c
audit.c audit: add support for the openat2 syscall 2021-10-01 16:52:48 -04:00
auxio_32.c
auxio_64.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
btext.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
central.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
cherrs.S
chmc.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
compat_audit.c audit: add support for the openat2 syscall 2021-10-01 16:52:48 -04:00
cpu.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
cpumap.c sparc64: Replace zero-length array with flexible-array 2020-05-07 18:49:04 -07:00
cpumap.h
devices.c
ds.c sparc/vio: make remove callback return void 2021-05-14 13:45:58 +02:00
dtlb_miss.S
dtlb_prot.S
ebus.c
entry.h
entry.S Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc 2021-02-23 15:09:53 -08:00
etrap_32.S
etrap_64.S
fpu_traps.S
ftrace.c ftrace: Cleanup ftrace_dyn_arch_init() 2021-10-08 19:41:39 -04:00
getsetcc.S
head_32.S sparc32: get rid of fake_swapper_regs 2021-01-03 20:10:55 -05:00
head_64.S sparc64: get rid of fake_swapper_regs 2021-01-03 20:10:54 -05:00
helpers.S treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
hvapi.c
hvcalls.S
hvtramp.S
idprom.c
iommu-common.c dma-mapping: introduce dma_get_seg_boundary_nr_pages() 2020-09-03 18:12:15 +02:00
iommu.c sparc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR 2021-08-09 17:13:06 +02:00
iommu_common.h sparc: remove the mapping_error dma_map_ops method 2018-12-06 06:56:40 -08:00
ioport.c sparc32: use DMA_DIRECT_REMAP 2021-10-21 13:03:27 +02:00
irq.h
irq_32.c
irq_64.c softirq: Move do_softirq_own_stack() to generic asm header 2021-02-10 23:34:16 +01:00
itlb_miss.S
ivec.S
jump_label.c jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
kernel.h sparc: share process creation helpers between sparc and sparc64 2020-06-23 10:49:56 +02:00
kgdb_32.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
kgdb_64.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
kprobes.c kprobes: treewide: Make it harder to refer kretprobe_trampoline directly 2021-09-30 21:24:06 -04:00
kstack.h
ktlb.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
ldc.c iommu-common: move to arch/sparc 2018-05-09 06:54:27 +02:00
led.c sparc: fix led.c driver when PROC_FS is not enabled 2021-02-18 16:31:13 -08:00
leon_kernel.c sparc: Remove unused leon_trans_init 2018-11-18 13:35:22 -08:00
leon_pci.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
leon_pci_grpci1.c
leon_pci_grpci2.c
leon_pmc.c sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
leon_smp.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
Makefile sparc: share process creation helpers between sparc and sparc64 2020-06-23 10:49:56 +02:00
mdesc.c sparc: avoid stringop-overread errors 2021-09-15 13:42:33 -07:00
misctrap.S
module.c
nmi.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
of_device_32.c sparc: Use DT node full_name instead of name for resources 2018-11-18 13:35:22 -08:00
of_device_64.c sparc: Use DT node full_name instead of name for resources 2018-11-18 13:35:22 -08:00
of_device_common.c sparc32: use per-device dma_ops 2020-04-02 18:11:55 -07:00
of_device_common.h
pci.c PCI: Rename pcibios_add_device() to pcibios_device_add() 2021-09-21 15:26:09 -05:00
pci_common.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_fire.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
pci_impl.h
pci_msi.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pci_psycho.c
pci_sabre.c sparc: Use of_node_name_eq for node name comparisons 2018-11-18 13:35:21 -08:00
pci_schizo.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
pci_sun4v.c sparc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR 2021-08-09 17:13:06 +02:00
pci_sun4v.h
pci_sun4v_asm.S
pcic.c sparc/PCI: Use dev_printk() when possible 2018-05-22 07:54:06 -05:00
pcr.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
perf_event.c sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD 2019-06-02 22:16:33 -07:00
pmc.c
power.c sparc: Convert to using %pOFn instead of device_node.name 2018-11-18 13:35:20 -08:00
process.c sparc: switch to kernel_clone() 2020-08-20 13:12:58 +02:00
process_32.c sched: Add wrapper for get_wchan() to keep task blocked 2021-10-15 11:25:14 +02:00
process_64.c sched: Add wrapper for get_wchan() to keep task blocked 2021-10-15 11:25:14 +02:00
prom.h
prom_32.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
prom_64.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
prom_common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
prom_irqtrans.c sparc: Use device_type helpers to access the node type 2018-11-18 13:35:21 -08:00
psycho_common.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
psycho_common.h
ptrace_32.c sparc: switch to ->regset_get() 2020-07-27 14:31:08 -04:00
ptrace_64.c sparc: switch to ->regset_get() 2020-07-27 14:31:08 -04:00
reboot.c sparc: Use device_type helpers to access the node type 2018-11-18 13:35:21 -08:00
rtrap_32.S sparc32: Preserve clone syscall flags argument for restarts due to signals 2021-02-18 16:15:11 -08:00
rtrap_64.S sched/rt, sparc: Use CONFIG_PREEMPTION 2019-12-08 14:37:35 +01:00
sbus.c mm: replace all open encodings for NUMA_NO_NODE 2019-03-05 21:07:14 -08:00
setup_32.c sparc32: get rid of fake_swapper_regs 2021-01-03 20:10:55 -05:00
setup_64.c sparc64: get rid of fake_swapper_regs 2021-01-03 20:10:54 -05:00
signal32.c arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
signal_32.c signal: Replace force_fatal_sig with force_exit_sig when in doubt 2021-11-19 09:15:58 -06:00
signal_64.c arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
sigutil.h
sigutil_32.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
sigutil_64.c
smp_32.c sched/core: Initialize the idle task with preemption disabled 2021-05-12 13:01:45 +02:00
smp_64.c memblock: use memblock_free for freeing virtual pointers 2021-11-06 13:30:41 -07:00
sparc_ksyms.c
spiterrs.S
sstate.c kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
stacktrace.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
starfire.c
sun4d_irq.c sparc: Use of_node_name_eq for node name comparisons 2018-11-18 13:35:21 -08:00
sun4d_smp.c
sun4m_irq.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
sun4m_smp.c
sun4v_ivec.S
sun4v_mcd.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482 2019-06-19 17:09:52 +02:00
sun4v_tlb_miss.S
sys32.S net: remove compat_sys_{get,set}sockopt 2020-07-19 18:16:40 -07:00
sys_sparc32.c sparc: remove unused header file nfs_fs.h 2020-06-02 18:41:48 -07:00
sys_sparc_32.c signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP 2021-07-23 13:08:57 -05:00
sys_sparc_64.c signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP 2021-07-23 13:08:57 -05:00
syscalls.S sparc64: enable HAVE_COPY_THREAD_TLS 2020-06-23 10:49:54 +02:00
sysfs.c
systbls.h
systbls_32.S sparc: syscalls: switch to generic syscalltbl.sh 2021-05-02 00:43:34 +09:00
systbls_64.S sparc: syscalls: switch to generic syscalltbl.sh 2021-05-02 00:43:34 +09:00
time_32.c
time_64.c cpufreq: Call transition notifier only once for each policy 2019-05-10 12:20:36 +02:00
trampoline_32.S
trampoline_64.S mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
traps_32.c signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP 2021-07-23 13:08:57 -05:00
traps_64.c signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP 2021-07-23 13:08:57 -05:00
tsb.S
ttable_32.S
ttable_64.S
una_asm_32.S
una_asm_64.S
unaligned_32.c signal/sparc: si_trapno is only used with SIGILL ILL_ILLTRP 2021-07-23 13:08:57 -05:00
unaligned_64.c
uprobes.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
urtt_fill.S
utrap.S
vdso.c locking/seqlock, headers: Untangle the spaghetti monster 2020-08-06 16:13:13 +02:00
vio.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
viohs.c sparc64: viohs: Use struct_size() helper 2020-06-22 15:43:16 -07:00
visemul.c
vmlinux.lds.S vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG 2020-09-01 09:50:35 +02:00
windows.c signal: Replace force_fatal_sig with force_exit_sig when in doubt 2021-11-19 09:15:58 -06:00
winfixup.S
wof.S
wuf.S