linux/arch/sparc/kernel
Eric W. Biederman 686bf79203 signal: Replace force_fatal_sig with force_exit_sig when in doubt
commit fcb116bc43 upstream.

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>
Cc: Thomas Backlund <tmb@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-25 09:49:07 +01:00
..
syscalls compat: remove some compat entry points 2021-09-08 15:32:35 -07:00
.gitignore
adi_64.c
apc.c
asm-offsets.c
audit.c
auxio_32.c
auxio_64.c
btext.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
central.c
cherrs.S
chmc.c
compat_audit.c
cpu.c
cpumap.c
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
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
hvapi.c
hvcalls.S
hvtramp.S
idprom.c
iommu_common.h
iommu-common.c
iommu.c sparc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR 2021-08-09 17:13:06 +02:00
ioport.c sparc32: page align size in arch_dma_alloc 2021-09-14 14:35:17 +02:00
irq_32.c
irq_64.c softirq: Move do_softirq_own_stack() to generic asm header 2021-02-10 23:34:16 +01:00
irq.h
itlb_miss.S
ivec.S
jump_label.c
kernel.h
kgdb_32.c
kgdb_64.c
kprobes.c kprobes: Do not increment probe miss count in the fault handler 2021-06-03 15:47:26 +02:00
kstack.h
ktlb.S
ldc.c
led.c sparc: fix led.c driver when PROC_FS is not enabled 2021-02-18 16:31:13 -08:00
leon_kernel.c
leon_pci_grpci1.c
leon_pci_grpci2.c
leon_pci.c
leon_pmc.c sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
leon_smp.c
Makefile
mdesc.c sparc: avoid stringop-overread errors 2021-09-15 13:42:33 -07:00
misctrap.S
module.c
nmi.c
of_device_32.c
of_device_64.c
of_device_common.c
of_device_common.h
pci_common.c
pci_fire.c
pci_impl.h
pci_msi.c
pci_psycho.c
pci_sabre.c
pci_schizo.c
pci_sun4v_asm.S
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.c
pcic.c
pcr.c
perf_event.c
pmc.c
power.c
process_32.c isystem: trim/fixup stdarg.h and other headers 2021-08-19 09:02:55 +09:00
process_64.c arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
process.c
prom_32.c
prom_64.c
prom_common.c
prom_irqtrans.c
prom.h
psycho_common.c
psycho_common.h
ptrace_32.c
ptrace_64.c
reboot.c
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
sbus.c
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
signal_32.c signal: Replace force_fatal_sig with force_exit_sig when in doubt 2021-11-25 09:49:07 +01:00
signal_64.c arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
signal32.c arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
sigutil_32.c
sigutil_64.c
sigutil.h
smp_32.c sched/core: Initialize the idle task with preemption disabled 2021-05-12 13:01:45 +02:00
smp_64.c Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -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
starfire.c
sun4d_irq.c
sun4d_smp.c
sun4m_irq.c
sun4m_smp.c
sun4v_ivec.S
sun4v_mcd.S
sun4v_tlb_miss.S
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
sys_sparc32.c
sys32.S
syscalls.S
sysfs.c
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
systbls.h
time_32.c
time_64.c
trampoline_32.S
trampoline_64.S
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
urtt_fill.S
utrap.S
vdso.c
vio.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
viohs.c
visemul.c
vmlinux.lds.S
windows.c signal: Replace force_fatal_sig with force_exit_sig when in doubt 2021-11-25 09:49:07 +01:00
winfixup.S
wof.S
wuf.S