diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-07-30 06:55:30 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-08-01 15:39:33 -0400 |
commit | ab99c733ae73cce31f2a2434f7099564e5a73d95 (patch) | |
tree | c9eb381f05688b8b4e79d2ffe495b4d4b302f2d4 /arch/sh/kernel/ptrace_64.c | |
parent | c459dbf294b4a3d70490a468a7ca3907fb2c2f57 (diff) |
sh: Make syscall tracer use tracehook notifiers, add TIF_NOTIFY_RESUME.
This follows the changes in commits:
7d6d637dac2050f30a1b57b0a3dc5de4a10616ba
4f72c4279eab1e5f3ed1ac4e55d4527617582392
on powerpc. Adding in TIF_NOTIFY_RESUME, and cleaning up the syscall
tracing to be more generic. This is an incremental step to turning
on tracehook, as well as unifying more of the ptrace and signal code
across the 32/64 split.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/ptrace_64.c')
-rw-r--r-- | arch/sh/kernel/ptrace_64.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c index 108f3962e39a..236d8bef9ccd 100644 --- a/arch/sh/kernel/ptrace_64.c +++ b/arch/sh/kernel/ptrace_64.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/syscalls.h> | 28 | #include <linux/syscalls.h> |
29 | #include <linux/audit.h> | 29 | #include <linux/audit.h> |
30 | #include <linux/seccomp.h> | 30 | #include <linux/seccomp.h> |
31 | #include <linux/tracehook.h> | ||
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
@@ -221,40 +222,37 @@ asmlinkage int sh64_ptrace(long request, long pid, long addr, long data) | |||
221 | return sys_ptrace(request, pid, addr, data); | 222 | return sys_ptrace(request, pid, addr, data); |
222 | } | 223 | } |
223 | 224 | ||
224 | asmlinkage void syscall_trace(struct pt_regs *regs, int entryexit) | 225 | asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs) |
225 | { | 226 | { |
226 | struct task_struct *tsk = current; | 227 | long long ret = 0; |
227 | 228 | ||
228 | secure_computing(regs->regs[9]); | 229 | secure_computing(regs->regs[9]); |
229 | 230 | ||
230 | if (unlikely(current->audit_context) && entryexit) | 231 | if (test_thread_flag(TIF_SYSCALL_TRACE) && |
231 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]), | 232 | tracehook_report_syscall_entry(regs)) |
232 | regs->regs[9]); | 233 | /* |
233 | 234 | * Tracing decided this syscall should not happen. | |
234 | if (!test_thread_flag(TIF_SYSCALL_TRACE) && | 235 | * We'll return a bogus call number to get an ENOSYS |
235 | !test_thread_flag(TIF_SINGLESTEP)) | 236 | * error, but leave the original number in regs->regs[0]. |
236 | goto out; | 237 | */ |
237 | if (!(tsk->ptrace & PT_PTRACED)) | 238 | ret = -1LL; |
238 | goto out; | ||
239 | |||
240 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) && | ||
241 | !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0)); | ||
242 | |||
243 | /* | ||
244 | * this isn't the same as continuing with a signal, but it will do | ||
245 | * for normal use. strace only continues with a signal if the | ||
246 | * stopping signal is not SIGTRAP. -brl | ||
247 | */ | ||
248 | if (tsk->exit_code) { | ||
249 | send_sig(tsk->exit_code, tsk, 1); | ||
250 | tsk->exit_code = 0; | ||
251 | } | ||
252 | 239 | ||
253 | out: | 240 | if (unlikely(current->audit_context)) |
254 | if (unlikely(current->audit_context) && !entryexit) | ||
255 | audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[1], | 241 | audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[1], |
256 | regs->regs[2], regs->regs[3], | 242 | regs->regs[2], regs->regs[3], |
257 | regs->regs[4], regs->regs[5]); | 243 | regs->regs[4], regs->regs[5]); |
244 | |||
245 | return ret ?: regs->regs[9]; | ||
246 | } | ||
247 | |||
248 | asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) | ||
249 | { | ||
250 | if (unlikely(current->audit_context)) | ||
251 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]), | ||
252 | regs->regs[9]); | ||
253 | |||
254 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | ||
255 | tracehook_report_syscall_exit(regs, 0); | ||
258 | } | 256 | } |
259 | 257 | ||
260 | /* Called with interrupts disabled */ | 258 | /* Called with interrupts disabled */ |