24
24
#include <linux/smp.h>
25
25
#include <linux/user.h>
26
26
#include <linux/security.h>
27
+ #include <linux/tracehook.h>
27
28
#include <linux/audit.h>
28
29
#include <linux/seccomp.h>
29
30
@@ -540,28 +541,9 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
540
541
/* do the secure computing check first */
541
542
secure_computing_strict (regs -> regs [2 ]);
542
543
543
- if (!( current -> ptrace & PT_PTRACED ))
544
- goto out ;
544
+ if (test_thread_flag ( TIF_SYSCALL_TRACE ))
545
+ ptrace_report_syscall ( regs ) ;
545
546
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 :
565
547
audit_syscall_entry (audit_arch (), regs -> regs [2 ],
566
548
regs -> regs [4 ], regs -> regs [5 ],
567
549
regs -> regs [6 ], regs -> regs [7 ]);
@@ -582,26 +564,8 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
582
564
583
565
audit_syscall_exit (regs );
584
566
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 );
605
569
606
570
user_enter ();
607
571
}
0 commit comments