m68k/kernel - wire up syscall_trace_enter/leave for m68k
Subsystems (2)
PATCH v4 1/1 m68k/kernel - wire up syscall_trace_enter/leave for m68k
m68k (other than Coldfire) uses syscall_trace for both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.
Replace syscall_trace by syscall_trace_enter and syscall_trace_leave in preparation for seccomp support. Check return code of syscall_trace_enter(), and skip syscall if -1. Return code will be left at what had been set by by ptrace or seccomp (in regs->d0).
No regression seen in testing with strace on ARAnyM.
--
Changes from v3:
- change syscall_trace_enter return code test from !=0 to ==-1
--- arch/m68k/kernel/entry.S | 8 +++++--- arch/m68k/kernel/ptrace.c | 17 ----------------- 2 files changed, 5 insertions(+), 20 deletions(-)
arch/m68k/kernel/entry.S +5 -3
@@ -164,9 +164,11 @@ do_trace_entry: movel #-ENOSYS,%sp@(PT_OFF_D0)| needed for strace subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + cmpil #-1,%d0 + jeq ret_from_syscall movel %sp@(PT_OFF_ORIG_D0),%d0 cmpl #NR_syscalls,%d0 jcs syscall
@@ -177,7 +179,7 @@ badsys: do_trace_exit: subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_leave RESTORE_SWITCH_STACK addql #4,%sp jra .Lret_from_exception
@@ -186,7 +188,7 @@ ENTRY(ret_from_signal) movel %curptr@(TASK_STACK),%a1 tstb %a1@(TINFO_FLAGS+2) jge 1f - jbsr syscall_trace + jbsr syscall_trace_leave 1: RESTORE_SWITCH_STACK addql #4,%sp /* on 68040 complete pending writebacks if any */
arch/m68k/kernel/ptrace.c +0 -17
@@ -271,22 +271,6 @@ long arch_ptrace(struct task_struct *child, long request,return -EIO ; } -asmlinkage void syscall_trace(void) -{ -ptrace_notify (SIGTRAP | ((current->ptrace &PT_TRACESYSGOOD ) - ?0x80 :0 )); -/* -* this isn't the same as continuing with a signal, but it will do -* for normal use. strace only continues with a signal if the -* stopping signal is not SIGTRAP. -brl -*/ -if (current->exit_code) { -send_sig (current->exit_code, current,1 ); - current->exit_code =0 ; - } -} - -#if defined(CONFIG_COLDFIRE ) || !defined(CONFIG_MMU ) asmlinkage int syscall_trace_enter(void) {int ret =0 ;
@@ -301,4 +285,3 @@ asmlinkage void syscall_trace_leave(void)if (test_thread_flag (TIF_SYSCALL_TRACE ))tracehook_report_syscall_exit (task_pt_regs (current),0 ); } -#endif /* CONFIG_COLDFIRE */
Signature · 1 line
2.7.4
Quoted 8 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if -1. Return code will be left at what had been set by by ptrace or seccomp (inregs->d0).
s/by by/by/
arch/m68k/kernel/entry.S do_trace_entry: · line 170
Quoted 13 lines
arch/m68k/kernel/entry.S +2
-1@@ -164,9 +164,11 @@ do_trace_entry: movel #-ENOSYS,%sp@(PT_OFF_D0)| needed for strace subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + cmpil #-1,%d0
That can be optimized as addql #1,%d0.
arch/m68k/kernel/entry.S do_trace_entry: · line 171
Quoted 1 line
arch/m68k/kernel/entry.S +1
-0+ jeq ret_from_syscall
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Hi Andreas,
Quoted 11 lines · Andreas Schwab
Quoted 8 lines · Michael Schmitz
m68k (other than Coldfire) uses
syscall_tracefor both trace entry and trace exit. Seccomp support requires separate entry points for trace entry and exit which are already provided for Coldfire.Replace
syscall_tracebysyscall_trace_enterandsyscall_trace_leavein preparation for seccomp support. Check return code ofsyscall_trace_enter(), and skip syscall if -1. Return code will be left at what had been set by by ptrace or seccomp (inregs->d0).s/by by/by/
Ouch ...
Quoted 15 lines
Quoted 6 lines
arch/m68k/kernel/entry.S +0
-0arch/m68k/kernel/entry.S do_trace_entry: · line 170
Quoted 8 lines
arch/m68k/kernel/entry.S +2
-1@@ -164,9 +164,11 @@ do_trace_entry: movel #-ENOSYS,%sp@(PT_OFF_D0)| needed for strace subql #4,%sp SAVE_SWITCH_STACK - jbsr syscall_trace + jbsr syscall_trace_enter RESTORE_SWITCH_STACK addql #4,%sp + cmpil #-1,%d0That can be optimized as addql #1,%d0.
Thanks, that wasn't obvious at first glance!
Will fix in v5 ...
Cheers,
Michael
Quoted 4 lines
arch/m68k/kernel/entry.S do_trace_entry: · line 171
Quoted 2 lines
arch/m68k/kernel/entry.S +1
-0+ jeq ret_from_syscallAndreas.