OpenCloudOS-Kernel/arch/parisc/kernel
Dmitry V. Levin b7dc5a071d parisc: Fix ptrace syscall number modification
Commit 910cd32e55 ("parisc: Fix and enable seccomp filter support")
introduced a regression in ptrace-based syscall tampering: when tracer
changes syscall number to -1, the kernel fails to initialize %r28 with
-ENOSYS and subsequently fails to return the error code of the failed
syscall to userspace.

This erroneous behaviour could be observed with a simple strace syscall
fault injection command which is expected to print something like this:

$ strace -a0 -ewrite -einject=write:error=enospc echo hello
write(1, "hello\n", 6) = -1 ENOSPC (No space left on device) (INJECTED)
write(2, "echo: ", 6) = -1 ENOSPC (No space left on device) (INJECTED)
write(2, "write error", 11) = -1 ENOSPC (No space left on device) (INJECTED)
write(2, "\n", 1) = -1 ENOSPC (No space left on device) (INJECTED)
+++ exited with 1 +++

After commit 910cd32e55 it loops printing
something like this instead:

write(1, "hello\n", 6../strace: Failed to tamper with process 12345: unexpectedly got no error (return value 0, error 0)
) = 0 (INJECTED)

This bug was found by strace test suite.

Fixes: 910cd32e55 ("parisc: Fix and enable seccomp filter support")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Tested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-02-21 20:10:46 +01:00
..
syscalls parisc: add system call table generation support 2018-12-10 08:26:03 +01:00
.gitignore parisc: add arch/parisc/kernel/.gitignore 2008-10-10 16:32:28 +00:00
Makefile parisc: Split out alternative live patching code 2018-12-10 07:47:50 +01:00
alternative.c parisc: Split out alternative live patching code 2018-12-10 07:47:50 +01:00
asm-offsets.c parisc: Drop per_cpu uaccess related exception_data struct 2017-05-10 17:46:13 +02:00
audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cache.c parisc: Optimze cache flush algorithms 2018-10-20 21:10:26 +02:00
compat_audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drivers.c parisc: Convert printk(KERN_LEVEL) to pr_lvl() 2018-06-28 17:14:44 +02:00
entry.S parisc: Use LINUX_GATEWAY_SPACE constant in entry.S 2018-10-26 08:20:58 +02:00
firmware.c parisc: Add PDC PAT cell_info() and pd_get_pdc_revisions() functions 2018-10-19 22:22:07 +02:00
ftrace.c parisc: function_graph: Simplify with function_graph_enter() 2018-11-27 20:30:52 -05:00
hardware.c parisc: Move various functions and strings to init section 2018-03-27 18:52:21 +02:00
head.S parisc: Check if secondary CPUs want own PDC calls 2018-03-02 10:04:46 +01:00
hpmc.S parisc: Fix exported address of os_hpmc handler 2018-10-17 08:18:01 +02:00
inventory.c parisc: Retrieve and display the PDC PAT capabilities 2018-10-20 21:10:37 +02:00
irq.c parisc: Increase thread and stack size to 32kb 2017-07-31 08:41:26 +02:00
module.c parisc: Split out alternative live patching code 2018-12-10 07:47:50 +01:00
pa7300lc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pacache.S parisc: Optimze cache flush algorithms 2018-10-20 21:10:26 +02:00
parisc_ksyms.c parisc: Export __cmpxchg_u64 unconditionally 2017-10-19 08:48:45 +02:00
pci-dma.c dma-mapping: zero memory returned from dma_alloc_* 2018-12-20 08:13:52 +01:00
pci.c parisc: Fix section mismatches 2018-05-02 21:47:35 +02:00
pdc_chassis.c proc: introduce proc_create_single{,_data} 2018-05-16 07:23:35 +02:00
pdc_cons.c treewide: Switch DEFINE_TIMER callbacks to struct timer_list * 2017-11-21 15:57:05 -08:00
pdt.c mm/memory_failure: Remove unused trapno from memory_failure 2018-01-23 12:17:42 -06:00
perf.c parisc: Static initialization of spinlocks in perf and unwind code 2017-08-22 16:34:33 +02:00
perf_asm.S Revert "parisc: fix trivial section name warnings" 2008-06-13 10:49:45 -04:00
perf_images.h
process.c parisc: Fix and improve kernel stack unwinding 2018-08-13 09:54:17 +02:00
processor.c parisc: Add hardware description to stack traces 2018-08-21 14:46:26 +02:00
ptrace.c parisc: Fix ptrace syscall number modification 2019-02-21 20:10:46 +01:00
real2.S parisc: Fix and improve kernel stack unwinding 2018-08-13 09:54:17 +02:00
setup.c DMA mapping updates for Linux 4.21 2018-12-28 14:12:21 -08:00
signal.c parisc: Add alternative coding infrastructure 2018-10-17 17:22:26 +02:00
signal32.c signal: Unify and correct copy_siginfo_to_user32 2018-01-15 19:56:20 -06:00
signal32.h signal: Unify and correct copy_siginfo_to_user32 2018-01-15 19:56:20 -06:00
smp.c parisc: Move setup_profiling_timer() out of init section 2018-05-18 16:21:49 +02:00
stacktrace.c parisc: Consolidate unwind initialization calls 2018-08-17 17:00:08 +02:00
sys_parisc.c parisc: Restore possibility to execute 64-bit applications 2018-08-17 16:45:24 +02:00
sys_parisc32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscall.S parisc: generate uapi header and system call table files 2018-12-10 08:26:04 +01:00
time.c parisc: time: Convert read_persistent_clock() to read_persistent_clock64() 2018-04-20 20:18:21 +02:00
topology.c parisc: Add CPU topology support 2017-11-17 15:27:22 +01:00
traps.c parisc: Fix address in HPMC IVA 2018-10-17 08:18:01 +02:00
unaligned.c signal/parisc: Use force_sig_fault where appropriate 2018-04-25 10:44:06 -05:00
unwind.c parisc: Fix uninitialized variable usage in unwind.c 2018-10-16 11:37:29 +02:00
vmlinux.lds.S parisc: Add alternative coding infrastructure 2018-10-17 17:22:26 +02:00