Skip to content

Commit

Permalink
[AUDIT] Log correct syscall args for i386 processes on x86_64
Browse files Browse the repository at this point in the history
The i386 syscall ABI uses different registers. Log those instead of the
x86_64 ones.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
David Woodhouse committed May 3, 2005
1 parent 0dd8e06 commit 488f2ea
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions arch/x86_64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,6 @@ 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 */
Expand All @@ -641,11 +639,19 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
&& (current->ptrace & PT_PTRACED))
syscall_trace(regs);

if (unlikely(current->audit_context))
audit_syscall_entry(current, audit_arch(), regs->orig_rax,
regs->rdi, regs->rsi,
regs->rdx, regs->r10);

if (unlikely(current->audit_context)) {
if (test_thread_flag(TIF_IA32)) {
audit_syscall_entry(current, AUDIT_ARCH_I386,
regs->orig_rax,
regs->rbx, regs->rcx,
regs->rdx, regs->rsi);
} else {
audit_syscall_entry(current, AUDIT_ARCH_X86_64,
regs->orig_rax,
regs->rdi, regs->rsi,
regs->rdx, regs->r10);
}
}
}

asmlinkage void syscall_trace_leave(struct pt_regs *regs)
Expand Down

0 comments on commit 488f2ea

Please sign in to comment.