tracing: Rename FTRACE_SYSCALLS for tracepoints
[safe/jmp/linux-2.6] / arch / s390 / kernel / ptrace.c
index 75c496f..9d3dcfa 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
-#include <linux/smp_lock.h>
 #include <linux/errno.h>
 #include <linux/ptrace.h>
 #include <linux/user.h>
@@ -36,7 +35,9 @@
 #include <linux/elf.h>
 #include <linux/regset.h>
 #include <linux/tracehook.h>
-
+#include <linux/seccomp.h>
+#include <trace/syscall.h>
+#include <asm/compat.h>
 #include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -50,6 +51,9 @@
 #include "compat_ptrace.h"
 #endif
 
+DEFINE_TRACE(syscall_enter);
+DEFINE_TRACE(syscall_exit);
+
 enum s390_regset {
        REGSET_GENERAL,
        REGSET_FP,
@@ -69,7 +73,7 @@ FixPerRegisters(struct task_struct *task)
        if (per_info->single_step) {
                per_info->control_regs.bits.starting_addr = 0;
 #ifdef CONFIG_COMPAT
-               if (test_thread_flag(TIF_31BIT))
+               if (is_compat_task())
                        per_info->control_regs.bits.ending_addr = 0x7fffffffUL;
                else
 #endif
@@ -482,8 +486,7 @@ static int peek_user_compat(struct task_struct *child,
 {
        __u32 tmp;
 
-       if (!test_thread_flag(TIF_31BIT) ||
-           (addr & 3) || addr > sizeof(struct user) - 3)
+       if (!is_compat_task() || (addr & 3) || addr > sizeof(struct user) - 3)
                return -EIO;
 
        tmp = __peek_user_compat(child, addr);
@@ -584,8 +587,7 @@ static int __poke_user_compat(struct task_struct *child,
 static int poke_user_compat(struct task_struct *child,
                            addr_t addr, addr_t data)
 {
-       if (!test_thread_flag(TIF_31BIT) ||
-           (addr & 3) || addr > sizeof(struct user32) - 3)
+       if (!is_compat_task() || (addr & 3) || addr > sizeof(struct user32) - 3)
                return -EIO;
 
        return __poke_user_compat(child, addr, data);
@@ -642,6 +644,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
 {
        long ret;
 
+       /* Do the secure computing check first. */
+       secure_computing(regs->gprs[2]);
+
        /*
         * The sysc_tracesys code in entry.S stored the system
         * call number to gprs[2].
@@ -659,8 +664,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
                ret = -1;
        }
 
+       if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
+               trace_syscall_enter(regs, regs->gprs[2]);
+
        if (unlikely(current->audit_context))
-               audit_syscall_entry(test_thread_flag(TIF_31BIT) ?
+               audit_syscall_entry(is_compat_task() ?
                                        AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
                                    regs->gprs[2], regs->orig_gpr2,
                                    regs->gprs[3], regs->gprs[4],
@@ -674,6 +682,9 @@ asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
                audit_syscall_exit(AUDITSC_RESULT(regs->gprs[2]),
                                   regs->gprs[2]);
 
+       if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
+               trace_syscall_exit(regs, regs->gprs[2]);
+
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                tracehook_report_syscall_exit(regs, 0);
 }