aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/ptrace_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/ptrace_64.c')
-rw-r--r--arch/sh/kernel/ptrace_64.c50
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
224asmlinkage void syscall_trace(struct pt_regs *regs, int entryexit) 225asmlinkage 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
253out: 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
248asmlinkage 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 */