aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/ptrace.c')
-rw-r--r--arch/sparc64/kernel/ptrace.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 80a76e2ad732..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>
@@ -628,15 +630,27 @@ out:
628 unlock_kernel(); 630 unlock_kernel();
629} 631}
630 632
631asmlinkage void syscall_trace(void) 633asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p)
632{ 634{
633#ifdef DEBUG_PTRACE 635 /* do the secure computing check first */
634 printk("%s [%d]: syscall_trace\n", current->comm, current->pid); 636 secure_computing(regs->u_regs[UREG_G1]);
635#endif 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
@@ -645,12 +659,20 @@ asmlinkage void syscall_trace(void)
645 * for normal use. strace only continues with a signal if the 659 * for normal use. strace only continues with a signal if the
646 * stopping signal is not SIGTRAP. -brl 660 * stopping signal is not SIGTRAP. -brl
647 */ 661 */
648#ifdef DEBUG_PTRACE
649 printk("%s [%d]: syscall_trace exit= %x\n", current->comm,
650 current->pid, current->exit_code);
651#endif
652 if (current->exit_code) { 662 if (current->exit_code) {
653 send_sig (current->exit_code, current, 1); 663 send_sig(current->exit_code, current, 1);
654 current->exit_code = 0; 664 current->exit_code = 0;
655 } 665 }
666
667out:
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]);
656} 678}