From: Greg Kroah-Hartman Date: Sat, 24 Apr 2021 14:52:34 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.4.268~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2417bf6998e3766dab80861761bc0d7248c2033f;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: s390-ptrace-return-enosys-when-invalid-syscall-is-supplied.patch --- diff --git a/queue-5.4/s390-ptrace-return-enosys-when-invalid-syscall-is-supplied.patch b/queue-5.4/s390-ptrace-return-enosys-when-invalid-syscall-is-supplied.patch new file mode 100644 index 00000000000..503651dc99a --- /dev/null +++ b/queue-5.4/s390-ptrace-return-enosys-when-invalid-syscall-is-supplied.patch @@ -0,0 +1,74 @@ +From cd29fa798001075a554b978df3a64e6656c25794 Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Fri, 6 Mar 2020 13:18:31 +0100 +Subject: s390/ptrace: return -ENOSYS when invalid syscall is supplied + +From: Sven Schnelle + +commit cd29fa798001075a554b978df3a64e6656c25794 upstream. + +The current code returns the syscall number which an invalid +syscall number is supplied and tracing is enabled. This makes +the strace testsuite fail. + +Signed-off-by: Sven Schnelle +Signed-off-by: Vasily Gorbik +Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1895132 +[krzysztof: adjusted the backport around missing ifdef CONFIG_SECCOMP, + add Link and Fixes; apparently this should go with the referenced commit] +Fixes: 00332c16b160 ("s390/ptrace: pass invalid syscall numbers to tracing") +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Greg Kroah-Hartman +--- + arch/s390/kernel/ptrace.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/arch/s390/kernel/ptrace.c ++++ b/arch/s390/kernel/ptrace.c +@@ -867,6 +867,7 @@ long compat_arch_ptrace(struct task_stru + asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) + { + unsigned long mask = -1UL; ++ long ret = -1; + + /* + * The sysc_tracesys code in entry.S stored the system +@@ -878,27 +879,33 @@ asmlinkage long do_syscall_trace_enter(s + * Tracing decided this syscall should not happen. Skip + * the system call and the system call restart handling. + */ +- clear_pt_regs_flag(regs, PIF_SYSCALL); +- return -1; ++ goto skip; + } + + /* Do the secure computing check after ptrace. */ + if (secure_computing(NULL)) { + /* seccomp failures shouldn't expose any additional code. */ +- return -1; ++ goto skip; + } + + if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) +- trace_sys_enter(regs, regs->gprs[2]); ++ trace_sys_enter(regs, regs->int_code & 0xffff); + + if (is_compat_task()) + mask = 0xffffffff; + +- audit_syscall_entry(regs->gprs[2], regs->orig_gpr2 & mask, ++ audit_syscall_entry(regs->int_code & 0xffff, regs->orig_gpr2 & mask, + regs->gprs[3] &mask, regs->gprs[4] &mask, + regs->gprs[5] &mask); + ++ if ((signed long)regs->gprs[2] >= NR_syscalls) { ++ regs->gprs[2] = -ENOSYS; ++ ret = -ENOSYS; ++ } + return regs->gprs[2]; ++skip: ++ clear_pt_regs_flag(regs, PIF_SYSCALL); ++ return ret; + } + + asmlinkage void do_syscall_trace_exit(struct pt_regs *regs) diff --git a/queue-5.4/series b/queue-5.4/series index e69de29bb2d..3fd3cfa461b 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -0,0 +1 @@ +s390-ptrace-return-enosys-when-invalid-syscall-is-supplied.patch