diff options
author | <dwmw2@shinybook.infradead.org> | 2005-04-29 11:08:28 -0400 |
---|---|---|
committer | <dwmw2@shinybook.infradead.org> | 2005-04-29 11:08:28 -0400 |
commit | 2fd6f58ba6efc82ea2c9c2630f7ff5ed9eeaf34a (patch) | |
tree | 87cf236a78ad242ae01f1b71c289131e6d1c0662 /arch/i386/kernel | |
parent | ea3834d9fb348fb1144ad3affea22df933eaf62e (diff) |
[AUDIT] Don't allow ptrace to fool auditing, log arch of audited syscalls.
We were calling ptrace_notify() after auditing the syscall and arguments,
but the debugger could have _changed_ them before the syscall was actually
invoked. Reorder the calls to fix that.
While we're touching ever call to audit_syscall_entry(), we also make it
take an extra argument: the architecture of the syscall which was made,
because some architectures allow more than one type of syscall.
Also add an explicit success/failure flag to audit_syscall_exit(), for
the benefit of architectures which return that in a condition register
rather than only returning a single register.
Change type of syscall return value to 'long' not 'int'.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r-- | arch/i386/kernel/ptrace.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index b2f17640ceff..5606ec7a5c2b 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c | |||
@@ -682,24 +682,18 @@ void do_syscall_trace(struct pt_regs *regs, int entryexit) | |||
682 | /* do the secure computing check first */ | 682 | /* do the secure computing check first */ |
683 | secure_computing(regs->orig_eax); | 683 | secure_computing(regs->orig_eax); |
684 | 684 | ||
685 | if (unlikely(current->audit_context)) { | 685 | if (unlikely(current->audit_context) && entryexit) |
686 | if (!entryexit) | 686 | audit_syscall_exit(current, AUDITSC_RESULT(regs->eax), regs->eax); |
687 | audit_syscall_entry(current, regs->orig_eax, | ||
688 | regs->ebx, regs->ecx, | ||
689 | regs->edx, regs->esi); | ||
690 | else | ||
691 | audit_syscall_exit(current, regs->eax); | ||
692 | } | ||
693 | 687 | ||
694 | if (!(current->ptrace & PT_PTRACED)) | 688 | if (!(current->ptrace & PT_PTRACED)) |
695 | return; | 689 | goto out; |
696 | 690 | ||
697 | /* Fake a debug trap */ | 691 | /* Fake a debug trap */ |
698 | if (test_thread_flag(TIF_SINGLESTEP)) | 692 | if (test_thread_flag(TIF_SINGLESTEP)) |
699 | send_sigtrap(current, regs, 0); | 693 | send_sigtrap(current, regs, 0); |
700 | 694 | ||
701 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 695 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
702 | return; | 696 | goto out; |
703 | 697 | ||
704 | /* the 0x80 provides a way for the tracing parent to distinguish | 698 | /* the 0x80 provides a way for the tracing parent to distinguish |
705 | between a syscall stop and SIGTRAP delivery */ | 699 | between a syscall stop and SIGTRAP delivery */ |
@@ -714,4 +708,9 @@ void do_syscall_trace(struct pt_regs *regs, int entryexit) | |||
714 | send_sig(current->exit_code, current, 1); | 708 | send_sig(current->exit_code, current, 1); |
715 | current->exit_code = 0; | 709 | current->exit_code = 0; |
716 | } | 710 | } |
711 | out: | ||
712 | if (unlikely(current->audit_context) && !entryexit) | ||
713 | audit_syscall_entry(current, AUDIT_ARCH_I386, regs->orig_eax, | ||
714 | regs->ebx, regs->ecx, regs->edx, regs->esi); | ||
715 | |||
717 | } | 716 | } |