ARM: 7595/1: syscall: rework ordering in syscall_trace_exit
[deliverable/linux.git] / arch / arm / kernel / ptrace.c
index 518536d93fba415e301d932b4e5fe2592a262ff8..03deeffd9f6d06e6ff380126592e10dbf7bf1a25 100644 (file)
@@ -957,17 +957,23 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
        return scno;
 }
 
-asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno)
+asmlinkage void syscall_trace_exit(struct pt_regs *regs)
 {
-       current_thread_info()->syscall = scno;
-
-       if (test_thread_flag(TIF_SYSCALL_TRACE))
-               scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);
+       /*
+        * Audit the syscall before anything else, as a debugger may
+        * come in and change the current registers.
+        */
+       audit_syscall_exit(regs);
 
+       /*
+        * Note that we haven't updated the ->syscall field for the
+        * current thread. This isn't a problem because it will have
+        * been set on syscall entry and there hasn't been an opportunity
+        * for a PTRACE_SET_SYSCALL since then.
+        */
        if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
-               trace_sys_exit(regs, scno);
-
-       audit_syscall_exit(regs);
+               trace_sys_exit(regs, regs_return_value(regs));
 
-       return scno;
+       if (test_thread_flag(TIF_SYSCALL_TRACE))
+               tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);
 }
This page took 0.038597 seconds and 5 git commands to generate.