]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sparc64: tracehook syscall
authorRoland McGrath <roland@redhat.com>
Sun, 27 Jul 2008 07:30:50 +0000 (00:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jul 2008 00:28:55 +0000 (17:28 -0700)
This changes sparc64 syscall tracing to use the new tracehook.h entry
points.

[ Add assembly changes to force an immediate -ENOSYS return from
  the system call when syscall_trace() returns non-zero at syscall
  entry.  -DaveM ]

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/entry.h
arch/sparc64/kernel/ptrace.c
arch/sparc64/kernel/syscalls.S

index 32fbab620852063dbe525bf3e9e32720af8b2323..fc294a292899ee383906e5040e2509907776527e 100644 (file)
@@ -22,8 +22,7 @@ extern void do_notify_resume(struct pt_regs *regs,
                             unsigned long orig_i0,
                             unsigned long thread_info_flags);
 
-extern asmlinkage void syscall_trace(struct pt_regs *regs,
-                                    int syscall_exit_p);
+extern asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);
 
 extern void bad_trap_tl1(struct pt_regs *regs, long lvl);
 
index f6c9fc92921d4405693f6f23ab2817bdee3993fa..bd578cc4856d6de60ed4e3ba54cec2874b32480c 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>
 
@@ -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;
 }
index db19ed67acf67fee9df800a5f82a763b47b9635a..a2f24270ed8af9f95b95ee0f685419b621244fa2 100644 (file)
@@ -162,6 +162,8 @@ linux_syscall_trace32:
        add     %sp, PTREGS_OFF, %o0
        call    syscall_trace
         clr    %o1
+       brnz,pn %o0, 3f
+        mov    -ENOSYS, %o0
        srl     %i0, 0, %o0
        srl     %i4, 0, %o4
        srl     %i1, 0, %o1
@@ -173,6 +175,8 @@ linux_syscall_trace:
        add     %sp, PTREGS_OFF, %o0
        call    syscall_trace
         clr    %o1
+       brnz,pn %o0, 3f
+        mov    -ENOSYS, %o0
        mov     %i0, %o0
        mov     %i1, %o1
        mov     %i2, %o2