Skip to content

Commit bc3d22c

Browse files
committed
MIPS: ptrace: Use tracehook helpers.
Signed-off-by: Ralf Baechle <[email protected]>
1 parent 46e12c0 commit bc3d22c

File tree

1 file changed

+5
-41
lines changed

1 file changed

+5
-41
lines changed

arch/mips/kernel/ptrace.c

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/smp.h>
2525
#include <linux/user.h>
2626
#include <linux/security.h>
27+
#include <linux/tracehook.h>
2728
#include <linux/audit.h>
2829
#include <linux/seccomp.h>
2930

@@ -540,28 +541,9 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
540541
/* do the secure computing check first */
541542
secure_computing_strict(regs->regs[2]);
542543

543-
if (!(current->ptrace & PT_PTRACED))
544-
goto out;
544+
if (test_thread_flag(TIF_SYSCALL_TRACE))
545+
ptrace_report_syscall(regs);
545546

546-
if (!test_thread_flag(TIF_SYSCALL_TRACE))
547-
goto out;
548-
549-
/* The 0x80 provides a way for the tracing parent to distinguish
550-
between a syscall stop and SIGTRAP delivery */
551-
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?
552-
0x80 : 0));
553-
554-
/*
555-
* this isn't the same as continuing with a signal, but it will do
556-
* for normal use. strace only continues with a signal if the
557-
* stopping signal is not SIGTRAP. -brl
558-
*/
559-
if (current->exit_code) {
560-
send_sig(current->exit_code, current, 1);
561-
current->exit_code = 0;
562-
}
563-
564-
out:
565547
audit_syscall_entry(audit_arch(), regs->regs[2],
566548
regs->regs[4], regs->regs[5],
567549
regs->regs[6], regs->regs[7]);
@@ -582,26 +564,8 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
582564

583565
audit_syscall_exit(regs);
584566

585-
if (!(current->ptrace & PT_PTRACED))
586-
return;
587-
588-
if (!test_thread_flag(TIF_SYSCALL_TRACE))
589-
return;
590-
591-
/* The 0x80 provides a way for the tracing parent to distinguish
592-
between a syscall stop and SIGTRAP delivery */
593-
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ?
594-
0x80 : 0));
595-
596-
/*
597-
* this isn't the same as continuing with a signal, but it will do
598-
* for normal use. strace only continues with a signal if the
599-
* stopping signal is not SIGTRAP. -brl
600-
*/
601-
if (current->exit_code) {
602-
send_sig(current->exit_code, current, 1);
603-
current->exit_code = 0;
604-
}
567+
if (test_thread_flag(TIF_SYSCALL_TRACE))
568+
tracehook_report_syscall_exit(regs, 0);
605569

606570
user_enter();
607571
}

0 commit comments

Comments
 (0)