aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-01-03 14:23:06 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-17 16:16:56 -0500
commitb05d8447e7821695bc2fa3359431f7a664232743 (patch)
treeda90e558279c6407aa2e08d36bea5d9a21cd959c /arch/x86/kernel
parentf031cd25568a390dc2c9c3a4015054183753449a (diff)
audit: inline audit_syscall_entry to reduce burden on archs
Every arch calls: if (unlikely(current->audit_context)) audit_syscall_entry() which requires knowledge about audit (the existance of audit_context) in the arch code. Just do it all in static inline in audit.h so that arch's can remain blissfully ignorant. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/entry_64.S4
-rw-r--r--arch/x86/kernel/ptrace.c22
3 files changed, 13 insertions, 15 deletions
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index a22facf06f0e..1ccd742eba1b 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -456,7 +456,7 @@ sysenter_audit:
456 movl %ebx,%ecx /* 3rd arg: 1st syscall arg */ 456 movl %ebx,%ecx /* 3rd arg: 1st syscall arg */
457 movl %eax,%edx /* 2nd arg: syscall number */ 457 movl %eax,%edx /* 2nd arg: syscall number */
458 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */ 458 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */
459 call audit_syscall_entry 459 call __audit_syscall_entry
460 pushl_cfi %ebx 460 pushl_cfi %ebx
461 movl PT_EAX(%esp),%eax /* reload syscall number */ 461 movl PT_EAX(%esp),%eax /* reload syscall number */
462 jmp sysenter_do_call 462 jmp sysenter_do_call
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e51393dd93a3..1ca66b650123 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -549,7 +549,7 @@ badsys:
549#ifdef CONFIG_AUDITSYSCALL 549#ifdef CONFIG_AUDITSYSCALL
550 /* 550 /*
551 * Fast path for syscall audit without full syscall trace. 551 * Fast path for syscall audit without full syscall trace.
552 * We just call audit_syscall_entry() directly, and then 552 * We just call __audit_syscall_entry() directly, and then
553 * jump back to the normal fast path. 553 * jump back to the normal fast path.
554 */ 554 */
555auditsys: 555auditsys:
@@ -559,7 +559,7 @@ auditsys:
559 movq %rdi,%rdx /* 3rd arg: 1st syscall arg */ 559 movq %rdi,%rdx /* 3rd arg: 1st syscall arg */
560 movq %rax,%rsi /* 2nd arg: syscall number */ 560 movq %rax,%rsi /* 2nd arg: syscall number */
561 movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */ 561 movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */
562 call audit_syscall_entry 562 call __audit_syscall_entry
563 LOAD_ARGS 0 /* reload call-clobbered registers */ 563 LOAD_ARGS 0 /* reload call-clobbered registers */
564 jmp system_call_fastpath 564 jmp system_call_fastpath
565 565
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 8b0218758775..50267386b766 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1392,20 +1392,18 @@ long syscall_trace_enter(struct pt_regs *regs)
1392 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1392 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1393 trace_sys_enter(regs, regs->orig_ax); 1393 trace_sys_enter(regs, regs->orig_ax);
1394 1394
1395 if (unlikely(current->audit_context)) { 1395 if (IS_IA32)
1396 if (IS_IA32) 1396 audit_syscall_entry(AUDIT_ARCH_I386,
1397 audit_syscall_entry(AUDIT_ARCH_I386, 1397 regs->orig_ax,
1398 regs->orig_ax, 1398 regs->bx, regs->cx,
1399 regs->bx, regs->cx, 1399 regs->dx, regs->si);
1400 regs->dx, regs->si);
1401#ifdef CONFIG_X86_64 1400#ifdef CONFIG_X86_64
1402 else 1401 else
1403 audit_syscall_entry(AUDIT_ARCH_X86_64, 1402 audit_syscall_entry(AUDIT_ARCH_X86_64,
1404 regs->orig_ax, 1403 regs->orig_ax,
1405 regs->di, regs->si, 1404 regs->di, regs->si,
1406 regs->dx, regs->r10); 1405 regs->dx, regs->r10);
1407#endif 1406#endif
1408 }
1409 1407
1410 return ret ?: regs->orig_ax; 1408 return ret ?: regs->orig_ax;
1411} 1409}