]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
s390/ptrace: pass invalid syscall numbers to tracing
authorSven Schnelle <svens@linux.ibm.com>
Fri, 6 Mar 2020 12:19:34 +0000 (13:19 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:37:04 +0000 (15:37 -0400)
[ Upstream commit 00332c16b1604242a56289ff2b26e283dbad0812 ]

tracing expects to see invalid syscalls, so pass it through.
The syscall path in entry.S checks the syscall number before
looking up the handler, so it is still safe.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kernel/entry.S
arch/s390/kernel/ptrace.c

index bc85987727f095780ce016b4f0d3b62f0805ad00..c544b7a11ebb3189a7cd49a5e7f46f2cd8ac4de3 100644 (file)
@@ -368,9 +368,9 @@ ENTRY(system_call)
        jnz     .Lsysc_nr_ok
        # svc 0: system call number in %r1
        llgfr   %r1,%r1                         # clear high word in r1
+       sth     %r1,__PT_INT_CODE+2(%r11)
        cghi    %r1,NR_syscalls
        jnl     .Lsysc_nr_ok
-       sth     %r1,__PT_INT_CODE+2(%r11)
        slag    %r8,%r1,3
 .Lsysc_nr_ok:
        xc      __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
index ad71132374f0c7eecb9efe9c923e82d2e67b9872..5a2b1501d9983b70d3c406af361c54595d538c6a 100644 (file)
@@ -844,11 +844,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
         * call number to gprs[2].
         */
        if (test_thread_flag(TIF_SYSCALL_TRACE) &&
-           (tracehook_report_syscall_entry(regs) ||
-            regs->gprs[2] >= NR_syscalls)) {
+           tracehook_report_syscall_entry(regs)) {
                /*
-                * Tracing decided this syscall should not happen or the
-                * debugger stored an invalid system call number. Skip
+                * Tracing decided this syscall should not happen. Skip
                 * the system call and the system call restart handling.
                 */
                clear_pt_regs_flag(regs, PIF_SYSCALL);