diff options
author | David S. Miller <davem@davemloft.net> | 2005-07-10 22:29:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-07-10 22:29:45 -0400 |
commit | f7ceba360cce9af3fbc4e5a5b1bd40b570b7021c (patch) | |
tree | 1d138496048bbf5851cd60dee7acb912cffc6971 /arch/sparc64/kernel/ptrace.c | |
parent | 8d8a64796fdee4e20355c6c12c9cc630a2e7494d (diff) |
[SPARC64]: Add syscall auditing support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/ptrace.c')
-rw-r--r-- | arch/sparc64/kernel/ptrace.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index c57dc9ea731b..23ad839d113f 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/security.h> | 21 | #include <linux/security.h> |
22 | #include <linux/seccomp.h> | ||
23 | #include <linux/audit.h> | ||
22 | #include <linux/signal.h> | 24 | #include <linux/signal.h> |
23 | 25 | ||
24 | #include <asm/asi.h> | 26 | #include <asm/asi.h> |
@@ -633,10 +635,22 @@ asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p) | |||
633 | /* do the secure computing check first */ | 635 | /* do the secure computing check first */ |
634 | secure_computing(regs->u_regs[UREG_G1]); | 636 | secure_computing(regs->u_regs[UREG_G1]); |
635 | 637 | ||
636 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 638 | if (unlikely(current->audit_context) && syscall_exit_p) { |
637 | return; | 639 | unsigned long tstate = regs->tstate; |
640 | int result = AUDITSC_SUCCESS; | ||
641 | |||
642 | if (unlikely(tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) | ||
643 | result = AUDITSC_FAILURE; | ||
644 | |||
645 | audit_syscall_exit(current, result, regs->u_regs[UREG_I0]); | ||
646 | } | ||
647 | |||
638 | if (!(current->ptrace & PT_PTRACED)) | 648 | if (!(current->ptrace & PT_PTRACED)) |
639 | return; | 649 | goto out; |
650 | |||
651 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | ||
652 | goto out; | ||
653 | |||
640 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | 654 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) |
641 | ? 0x80 : 0)); | 655 | ? 0x80 : 0)); |
642 | 656 | ||
@@ -649,4 +663,16 @@ asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p) | |||
649 | send_sig(current->exit_code, current, 1); | 663 | send_sig(current->exit_code, current, 1); |
650 | current->exit_code = 0; | 664 | current->exit_code = 0; |
651 | } | 665 | } |
666 | |||
667 | out: | ||
668 | if (unlikely(current->audit_context) && !syscall_exit_p) | ||
669 | audit_syscall_entry(current, | ||
670 | (test_thread_flag(TIF_32BIT) ? | ||
671 | AUDIT_ARCH_SPARC : | ||
672 | AUDIT_ARCH_SPARC64), | ||
673 | regs->u_regs[UREG_G1], | ||
674 | regs->u_regs[UREG_I0], | ||
675 | regs->u_regs[UREG_I1], | ||
676 | regs->u_regs[UREG_I2], | ||
677 | regs->u_regs[UREG_I3]); | ||
652 | } | 678 | } |