diff options
-rw-r--r-- | arch/mips/Kconfig | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/syscall.h | 19 | ||||
-rw-r--r-- | arch/mips/include/asm/thread_info.h | 9 | ||||
-rw-r--r-- | arch/mips/include/asm/unistd.h | 7 | ||||
-rw-r--r-- | arch/mips/kernel/ptrace.c | 10 |
5 files changed, 43 insertions, 3 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d523b5489929..d2440478787b 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -19,6 +19,7 @@ config MIPS | |||
19 | select HAVE_KPROBES | 19 | select HAVE_KPROBES |
20 | select HAVE_KRETPROBES | 20 | select HAVE_KRETPROBES |
21 | select HAVE_DEBUG_KMEMLEAK | 21 | select HAVE_DEBUG_KMEMLEAK |
22 | select HAVE_SYSCALL_TRACEPOINTS | ||
22 | select ARCH_BINFMT_ELF_RANDOMIZE_PIE | 23 | select ARCH_BINFMT_ELF_RANDOMIZE_PIE |
23 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT | 24 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT |
24 | select RTC_LIB if !MACH_LOONGSON | 25 | select RTC_LIB if !MACH_LOONGSON |
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h index 087df5f26f86..81c89132c59d 100644 --- a/arch/mips/include/asm/syscall.h +++ b/arch/mips/include/asm/syscall.h | |||
@@ -59,6 +59,25 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg, | |||
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline long syscall_get_return_value(struct task_struct *task, | ||
63 | struct pt_regs *regs) | ||
64 | { | ||
65 | return regs->regs[2]; | ||
66 | } | ||
67 | |||
68 | static inline void syscall_set_return_value(struct task_struct *task, | ||
69 | struct pt_regs *regs, | ||
70 | int error, long val) | ||
71 | { | ||
72 | if (error) { | ||
73 | regs->regs[2] = -error; | ||
74 | regs->regs[7] = -1; | ||
75 | } else { | ||
76 | regs->regs[2] = val; | ||
77 | regs->regs[7] = 0; | ||
78 | } | ||
79 | } | ||
80 | |||
62 | static inline void syscall_get_arguments(struct task_struct *task, | 81 | static inline void syscall_get_arguments(struct task_struct *task, |
63 | struct pt_regs *regs, | 82 | struct pt_regs *regs, |
64 | unsigned int i, unsigned int n, | 83 | unsigned int i, unsigned int n, |
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index e0c8cf3b16ff..f9b24bfbdbae 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h | |||
@@ -116,6 +116,7 @@ static inline struct thread_info *current_thread_info(void) | |||
116 | #define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */ | 116 | #define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */ |
117 | #define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */ | 117 | #define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */ |
118 | #define TIF_LOAD_WATCH 25 /* If set, load watch registers */ | 118 | #define TIF_LOAD_WATCH 25 /* If set, load watch registers */ |
119 | #define TIF_SYSCALL_TRACEPOINT 26 /* syscall tracepoint instrumentation */ | ||
119 | #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ | 120 | #define TIF_SYSCALL_TRACE 31 /* syscall trace active */ |
120 | 121 | ||
121 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 122 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
@@ -132,20 +133,22 @@ static inline struct thread_info *current_thread_info(void) | |||
132 | #define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR) | 133 | #define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR) |
133 | #define _TIF_FPUBOUND (1<<TIF_FPUBOUND) | 134 | #define _TIF_FPUBOUND (1<<TIF_FPUBOUND) |
134 | #define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH) | 135 | #define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH) |
136 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) | ||
135 | 137 | ||
136 | #define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \ | 138 | #define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \ |
137 | _TIF_SYSCALL_AUDIT) | 139 | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT) |
138 | 140 | ||
139 | /* work to do in syscall_trace_leave() */ | 141 | /* work to do in syscall_trace_leave() */ |
140 | #define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \ | 142 | #define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \ |
141 | _TIF_SYSCALL_AUDIT) | 143 | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT) |
142 | 144 | ||
143 | /* work to do on interrupt/exception return */ | 145 | /* work to do on interrupt/exception return */ |
144 | #define _TIF_WORK_MASK \ | 146 | #define _TIF_WORK_MASK \ |
145 | (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) | 147 | (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) |
146 | /* work to do on any return to u-space */ | 148 | /* work to do on any return to u-space */ |
147 | #define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \ | 149 | #define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \ |
148 | _TIF_WORK_SYSCALL_EXIT) | 150 | _TIF_WORK_SYSCALL_EXIT | \ |
151 | _TIF_SYSCALL_TRACEPOINT) | ||
149 | 152 | ||
150 | /* | 153 | /* |
151 | * We stash processor id into a COP0 register to retrieve it fast | 154 | * We stash processor id into a COP0 register to retrieve it fast |
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h index 63c9c886173a..4d3b92886665 100644 --- a/arch/mips/include/asm/unistd.h +++ b/arch/mips/include/asm/unistd.h | |||
@@ -14,6 +14,13 @@ | |||
14 | 14 | ||
15 | #include <uapi/asm/unistd.h> | 15 | #include <uapi/asm/unistd.h> |
16 | 16 | ||
17 | #ifdef CONFIG_MIPS32_N32 | ||
18 | #define NR_syscalls (__NR_N32_Linux + __NR_N32_Linux_syscalls) | ||
19 | #elif defined(CONFIG_64BIT) | ||
20 | #define NR_syscalls (__NR_64_Linux + __NR_64_Linux_syscalls) | ||
21 | #else | ||
22 | #define NR_syscalls (__NR_O32_Linux + __NR_O32_Linux_syscalls) | ||
23 | #endif | ||
17 | 24 | ||
18 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
19 | 26 | ||
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index b996efcccc11..b52e1d2b33e0 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/tracehook.h> | 29 | #include <linux/tracehook.h> |
30 | #include <linux/audit.h> | 30 | #include <linux/audit.h> |
31 | #include <linux/seccomp.h> | 31 | #include <linux/seccomp.h> |
32 | #include <linux/ftrace.h> | ||
32 | 33 | ||
33 | #include <asm/byteorder.h> | 34 | #include <asm/byteorder.h> |
34 | #include <asm/cpu.h> | 35 | #include <asm/cpu.h> |
@@ -43,6 +44,9 @@ | |||
43 | #include <asm/bootinfo.h> | 44 | #include <asm/bootinfo.h> |
44 | #include <asm/reg.h> | 45 | #include <asm/reg.h> |
45 | 46 | ||
47 | #define CREATE_TRACE_POINTS | ||
48 | #include <trace/events/syscalls.h> | ||
49 | |||
46 | /* | 50 | /* |
47 | * Called by kernel/ptrace.c when detaching.. | 51 | * Called by kernel/ptrace.c when detaching.. |
48 | * | 52 | * |
@@ -664,6 +668,9 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs) | |||
664 | tracehook_report_syscall_entry(regs)) | 668 | tracehook_report_syscall_entry(regs)) |
665 | ret = -1; | 669 | ret = -1; |
666 | 670 | ||
671 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | ||
672 | trace_sys_enter(regs, regs->regs[2]); | ||
673 | |||
667 | audit_syscall_entry(__syscall_get_arch(), | 674 | audit_syscall_entry(__syscall_get_arch(), |
668 | regs->regs[2], | 675 | regs->regs[2], |
669 | regs->regs[4], regs->regs[5], | 676 | regs->regs[4], regs->regs[5], |
@@ -685,6 +692,9 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs) | |||
685 | 692 | ||
686 | audit_syscall_exit(regs); | 693 | audit_syscall_exit(regs); |
687 | 694 | ||
695 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | ||
696 | trace_sys_exit(regs, regs->regs[2]); | ||
697 | |||
688 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 698 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
689 | tracehook_report_syscall_exit(regs, 0); | 699 | tracehook_report_syscall_exit(regs, 0); |
690 | 700 | ||