Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / sparc64 / kernel / ptrace.c
index f6c9fc9..10306e4 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/audit.h>
 #include <linux/signal.h>
 #include <linux/regset.h>
+#include <linux/tracehook.h>
 #include <linux/compat.h>
 #include <linux/elf.h>
 
@@ -442,7 +443,7 @@ static const struct user_regset sparc64_regsets[] = {
         */
        [REGSET_GENERAL] = {
                .core_note_type = NT_PRSTATUS,
-               .n = 36 * sizeof(u64),
+               .n = 36,
                .size = sizeof(u64), .align = sizeof(u64),
                .get = genregs64_get, .set = genregs64_set
        },
@@ -454,7 +455,7 @@ static const struct user_regset sparc64_regsets[] = {
         */
        [REGSET_FP] = {
                .core_note_type = NT_PRFPREG,
-               .n = 35 * sizeof(u64),
+               .n = 35,
                .size = sizeof(u64), .align = sizeof(u64),
                .get = fpregs64_get, .set = fpregs64_set
        },
@@ -800,7 +801,7 @@ static const struct user_regset sparc32_regsets[] = {
         */
        [REGSET_GENERAL] = {
                .core_note_type = NT_PRSTATUS,
-               .n = 38 * sizeof(u32),
+               .n = 38,
                .size = sizeof(u32), .align = sizeof(u32),
                .get = genregs32_get, .set = genregs32_set
        },
@@ -816,7 +817,7 @@ static const struct user_regset sparc32_regsets[] = {
         */
        [REGSET_FP] = {
                .core_note_type = NT_PRFPREG,
-               .n = 99 * sizeof(u32),
+               .n = 99,
                .size = sizeof(u32), .align = sizeof(u32),
                .get = fpregs32_get, .set = fpregs32_set
        },
@@ -1049,8 +1050,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        return ret;
 }
 
-asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p)
+asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p)
 {
+       int ret = 0;
+
        /* do the secure computing check first */
        secure_computing(regs->u_regs[UREG_G1]);
 
@@ -1064,27 +1067,14 @@ asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p)
                audit_syscall_exit(result, regs->u_regs[UREG_I0]);
        }
 
-       if (!(current->ptrace & PT_PTRACED))
-               goto out;
-
-       if (!test_thread_flag(TIF_SYSCALL_TRACE))
-               goto out;
-
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-                                ? 0x80 : 0));
-
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (current->exit_code) {
-               send_sig(current->exit_code, current, 1);
-               current->exit_code = 0;
+       if (test_thread_flag(TIF_SYSCALL_TRACE)) {
+               if (syscall_exit_p)
+                       tracehook_report_syscall_exit(regs, 0);
+               else
+                       ret = tracehook_report_syscall_entry(regs);
        }
 
-out:
-       if (unlikely(current->audit_context) && !syscall_exit_p)
+       if (unlikely(current->audit_context) && !syscall_exit_p && !ret)
                audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
                                     AUDIT_ARCH_SPARC :
                                     AUDIT_ARCH_SPARC64),
@@ -1093,4 +1083,6 @@ out:
                                    regs->u_regs[UREG_I1],
                                    regs->u_regs[UREG_I2],
                                    regs->u_regs[UREG_I3]);
+
+       return ret;
 }