ptrace_32.c (c459dbf294b4a3d70490a468a7ca3907fb2c2f57) ptrace_32.c (ab99c733ae73cce31f2a2434f7099564e5a73d95)
1/*
2 * linux/arch/sh/kernel/ptrace.c
3 *
4 * Original x86 implementation:
5 * By Ross Biro 1/23/92
6 * edited by Linus Torvalds
7 *
8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka

--- 7 unchanged lines hidden (view full) ---

16#include <linux/ptrace.h>
17#include <linux/user.h>
18#include <linux/slab.h>
19#include <linux/security.h>
20#include <linux/signal.h>
21#include <linux/io.h>
22#include <linux/audit.h>
23#include <linux/seccomp.h>
1/*
2 * linux/arch/sh/kernel/ptrace.c
3 *
4 * Original x86 implementation:
5 * By Ross Biro 1/23/92
6 * edited by Linus Torvalds
7 *
8 * SuperH version: Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka

--- 7 unchanged lines hidden (view full) ---

16#include <linux/ptrace.h>
17#include <linux/user.h>
18#include <linux/slab.h>
19#include <linux/security.h>
20#include <linux/signal.h>
21#include <linux/io.h>
22#include <linux/audit.h>
23#include <linux/seccomp.h>
24#include <linux/tracehook.h>
24#include <asm/uaccess.h>
25#include <asm/pgtable.h>
26#include <asm/system.h>
27#include <asm/processor.h>
28#include <asm/mmu_context.h>
29
30/*
31 * does not yet catch signals sent when the child dies.

--- 179 unchanged lines hidden (view full) ---

211 default:
212 ret = ptrace_request(child, request, addr, data);
213 break;
214 }
215
216 return ret;
217}
218
25#include <asm/uaccess.h>
26#include <asm/pgtable.h>
27#include <asm/system.h>
28#include <asm/processor.h>
29#include <asm/mmu_context.h>
30
31/*
32 * does not yet catch signals sent when the child dies.

--- 179 unchanged lines hidden (view full) ---

212 default:
213 ret = ptrace_request(child, request, addr, data);
214 break;
215 }
216
217 return ret;
218}
219
219asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
220asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
220{
221{
221 struct task_struct *tsk = current;
222 long ret = 0;
222
223 secure_computing(regs->regs[0]);
224
223
224 secure_computing(regs->regs[0]);
225
225 if (unlikely(current->audit_context) && entryexit)
226 audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
227 regs->regs[0]);
226 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
227 tracehook_report_syscall_entry(regs))
228 /*
229 * Tracing decided this syscall should not happen.
230 * We'll return a bogus call number to get an ENOSYS
231 * error, but leave the original number in regs->regs[0].
232 */
233 ret = -1L;
228
234
229 if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
230 !test_thread_flag(TIF_SINGLESTEP))
231 goto out;
232 if (!(tsk->ptrace & PT_PTRACED))
233 goto out;
234
235 /* the 0x80 provides a way for the tracing parent to distinguish
236 between a syscall stop and SIGTRAP delivery */
237 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
238 !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
239
240 /*
241 * this isn't the same as continuing with a signal, but it will do
242 * for normal use. strace only continues with a signal if the
243 * stopping signal is not SIGTRAP. -brl
244 */
245 if (tsk->exit_code) {
246 send_sig(tsk->exit_code, tsk, 1);
247 tsk->exit_code = 0;
248 }
249
250out:
251 if (unlikely(current->audit_context) && !entryexit)
235 if (unlikely(current->audit_context))
252 audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[3],
253 regs->regs[4], regs->regs[5],
254 regs->regs[6], regs->regs[7]);
255
236 audit_syscall_entry(AUDIT_ARCH_SH, regs->regs[3],
237 regs->regs[4], regs->regs[5],
238 regs->regs[6], regs->regs[7]);
239
240 return ret ?: regs->regs[0];
256}
241}
242
243asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
244{
245 int step;
246
247 if (unlikely(current->audit_context))
248 audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
249 regs->regs[0]);
250
251 step = test_thread_flag(TIF_SINGLESTEP);
252 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
253 tracehook_report_syscall_exit(regs, step);
254}