original_kernel/arch/sh/kernel
Rich Felker b0cfc315ff sh: fix syscall tracing
Addition of SECCOMP_FILTER exposed a longstanding bug in
do_syscall_trace_enter, whereby r0 (the 5th argument register) was
mistakenly used where r3 (syscall_nr) was intended. By overwriting r0
rather than r3 with -1 when attempting to block a syscall, the
existing code would instead have caused the syscall to execute with an
argument clobbered.

Commit 0bb605c2c7 then introduced skipping of the syscall when
do_syscall_trace_enter returns -1, so that the return value set by
seccomp filters would not be clobbered by -ENOSYS. This eliminated the
clobbering of the 5th argument register, but instead caused syscalls
made with a 5th argument of -1 to be misinterpreted as a request by
do_syscall_trace_enter to suppress the syscall.

Fixes: 0bb605c2c7 ("sh: Add SECCOMP_FILTER")
Fixes: ab99c733ae ("sh: Make syscall tracer use tracehook notifiers, add TIF_NOTIFY_RESUME.")
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Rich Felker <dalias@libc.org>
2020-09-13 21:22:55 -04:00
..
cpu
syscalls all arch: remove system call sys_sysctl 2020-08-14 19:56:56 -07:00
vsyscall
.gitignore
Makefile sh: remove -Werror from Makefiles 2020-08-14 22:05:13 -04:00
asm-offsets.c
crash_dump.c
debugtraps.S
disassemble.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
dma-coherent.c sh: use the generic dma coherent remap allocator 2020-08-14 22:05:18 -04:00
dumpstack.c sh: stacktrace: Remove stacktrace_ops.stack() 2020-08-14 22:05:11 -04:00
dwarf.c
entry-common.S sh: fix syscall tracing 2020-09-13 21:22:55 -04:00
ftrace.c
head_32.S
hw_breakpoint.c
idle.c
io.c
io_trapped.c sh: unexport register_trapped_io and match_trapped_io_handler 2020-08-14 22:05:16 -04:00
iomap.c iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
ioport.c sh: don't include <asm/io_trapped.h> in <asm/io.h> 2020-08-14 22:05:16 -04:00
irq.c
irq_32.c
kdebugfs.c
kgdb.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
kprobes.c
machine_kexec.c
machvec.c Cleanup, SECCOMP_FILTER support, message printing fixes, and other 2020-08-15 18:50:32 -07:00
module.c
nmi_debug.c
perf_callchain.c sh: stacktrace: Remove stacktrace_ops.stack() 2020-08-14 22:05:11 -04:00
perf_event.c
process.c
process_32.c Cleanup, SECCOMP_FILTER support, message printing fixes, and other 2020-08-15 18:50:32 -07:00
ptrace.c
ptrace_32.c sh: fix syscall tracing 2020-09-13 21:22:55 -04:00
reboot.c
relocate_kernel.S
return_address.c
setup.c
sh_bios.c
sh_ksyms_32.c
signal_32.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
smp.c
stacktrace.c sh: stacktrace: Remove stacktrace_ops.stack() 2020-08-14 22:05:11 -04:00
swsusp.c
sys_sh.c
sys_sh32.c
syscalls_32.S
time.c
topology.c
traps.c
traps_32.c
unwinder.c
vmlinux.lds.S