Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / arch / x86_64 / kernel / ptrace.c
index c64b9c97c7459d035c3e4852d7d2e18508010ce7..19eba9aaedd1373cee28e7d14c5f9bb81a1398e2 100644 (file)
@@ -630,25 +630,28 @@ static void syscall_trace(struct pt_regs *regs)
        }
 }
 
+#define audit_arch() (test_thread_flag(TIF_IA32) ? AUDIT_ARCH_I386 : AUDIT_ARCH_X86_64)
+
 asmlinkage void syscall_trace_enter(struct pt_regs *regs)
 {
        /* do the secure computing check first */
        secure_computing(regs->orig_rax);
 
+       if (test_thread_flag(TIF_SYSCALL_TRACE)
+           && (current->ptrace & PT_PTRACED))
+               syscall_trace(regs);
+
        if (unlikely(current->audit_context))
-               audit_syscall_entry(current, regs->orig_rax,
+               audit_syscall_entry(current, audit_arch(), regs->orig_rax,
                                    regs->rdi, regs->rsi,
                                    regs->rdx, regs->r10);
 
-       if (test_thread_flag(TIF_SYSCALL_TRACE)
-           && (current->ptrace & PT_PTRACED))
-               syscall_trace(regs);
 }
 
 asmlinkage void syscall_trace_leave(struct pt_regs *regs)
 {
        if (unlikely(current->audit_context))
-               audit_syscall_exit(current, regs->rax);
+               audit_syscall_exit(current, AUDITSC_RESULT(regs->rax), regs->rax);
 
        if ((test_thread_flag(TIF_SYSCALL_TRACE)
             || test_thread_flag(TIF_SINGLESTEP))