2222#include <linux/signal.h>
2323#include <linux/regset.h>
2424#include <linux/elf.h>
25+ #include <linux/tracehook.h>
2526
2627#include <asm/pgtable.h>
2728#include <asm/processor.h>
@@ -603,7 +604,7 @@ void ia64_ptrace_stop(void)
603604{
604605 if (test_and_set_tsk_thread_flag (current , TIF_RESTORE_RSE ))
605606 return ;
606- tsk_set_notify_resume (current );
607+ set_notify_resume (current );
607608 unw_init_running (do_sync_rbs , ia64_sync_user_rbs );
608609}
609610
@@ -613,7 +614,6 @@ void ia64_ptrace_stop(void)
613614void ia64_sync_krbs (void )
614615{
615616 clear_tsk_thread_flag (current , TIF_RESTORE_RSE );
616- tsk_clear_notify_resume (current );
617617
618618 unw_init_running (do_sync_rbs , ia64_sync_kernel_rbs );
619619}
@@ -644,7 +644,7 @@ ptrace_attach_sync_user_rbs (struct task_struct *child)
644644 spin_lock_irq (& child -> sighand -> siglock );
645645 if (child -> state == TASK_STOPPED &&
646646 !test_and_set_tsk_thread_flag (child , TIF_RESTORE_RSE )) {
647- tsk_set_notify_resume (child );
647+ set_notify_resume (child );
648648
649649 child -> state = TASK_TRACED ;
650650 stopped = 1 ;
@@ -1232,37 +1232,16 @@ arch_ptrace (struct task_struct *child, long request, long addr, long data)
12321232}
12331233
12341234
1235- static void
1236- syscall_trace (void )
1237- {
1238- /*
1239- * The 0x80 provides a way for the tracing parent to
1240- * distinguish between a syscall stop and SIGTRAP delivery.
1241- */
1242- ptrace_notify (SIGTRAP
1243- | ((current -> ptrace & PT_TRACESYSGOOD ) ? 0x80 : 0 ));
1244-
1245- /*
1246- * This isn't the same as continuing with a signal, but it
1247- * will do for normal use. strace only continues with a
1248- * signal if the stopping signal is not SIGTRAP. -brl
1249- */
1250- if (current -> exit_code ) {
1251- send_sig (current -> exit_code , current , 1 );
1252- current -> exit_code = 0 ;
1253- }
1254- }
1255-
12561235/* "asmlinkage" so the input arguments are preserved... */
12571236
1258- asmlinkage void
1237+ asmlinkage long
12591238syscall_trace_enter (long arg0 , long arg1 , long arg2 , long arg3 ,
12601239 long arg4 , long arg5 , long arg6 , long arg7 ,
12611240 struct pt_regs regs )
12621241{
1263- if (test_thread_flag (TIF_SYSCALL_TRACE )
1264- && ( current -> ptrace & PT_PTRACED ))
1265- syscall_trace () ;
1242+ if (test_thread_flag (TIF_SYSCALL_TRACE ))
1243+ if ( tracehook_report_syscall_entry ( & regs ))
1244+ return - ENOSYS ;
12661245
12671246 /* copy user rbs to kernel rbs */
12681247 if (test_thread_flag (TIF_RESTORE_RSE ))
@@ -1283,6 +1262,7 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
12831262 audit_syscall_entry (arch , syscall , arg0 , arg1 , arg2 , arg3 );
12841263 }
12851264
1265+ return 0 ;
12861266}
12871267
12881268/* "asmlinkage" so the input arguments are preserved... */
@@ -1292,6 +1272,8 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
12921272 long arg4 , long arg5 , long arg6 , long arg7 ,
12931273 struct pt_regs regs )
12941274{
1275+ int step ;
1276+
12951277 if (unlikely (current -> audit_context )) {
12961278 int success = AUDITSC_RESULT (regs .r10 );
12971279 long result = regs .r8 ;
@@ -1301,10 +1283,9 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
13011283 audit_syscall_exit (success , result );
13021284 }
13031285
1304- if ((test_thread_flag (TIF_SYSCALL_TRACE )
1305- || test_thread_flag (TIF_SINGLESTEP ))
1306- && (current -> ptrace & PT_PTRACED ))
1307- syscall_trace ();
1286+ step = test_thread_flag (TIF_SINGLESTEP );
1287+ if (step || test_thread_flag (TIF_SYSCALL_TRACE ))
1288+ tracehook_report_syscall_exit (& regs , step );
13081289
13091290 /* copy user rbs to kernel rbs */
13101291 if (test_thread_flag (TIF_RESTORE_RSE ))
@@ -1940,7 +1921,7 @@ gpregs_writeback(struct task_struct *target,
19401921{
19411922 if (test_and_set_tsk_thread_flag (target , TIF_RESTORE_RSE ))
19421923 return 0 ;
1943- tsk_set_notify_resume (target );
1924+ set_notify_resume (target );
19441925 return do_regset_call (do_gpregs_writeback , target , regset , 0 , 0 ,
19451926 NULL , NULL );
19461927}
0 commit comments