13 #include <linux/kernel.h>
14 #include <linux/sched.h>
17 #include <linux/errno.h>
18 #include <linux/ptrace.h>
21 #include <linux/signal.h>
23 #include <linux/audit.h>
24 #include <linux/seccomp.h>
26 #include <linux/elf.h>
28 #include <linux/hw_breakpoint.h>
29 #include <asm/uaccess.h>
30 #include <asm/pgtable.h>
31 #include <asm/processor.h>
32 #include <asm/mmu_context.h>
33 #include <asm/syscalls.h>
36 #define CREATE_TRACE_POINTS
48 return (*((
int *)stack));
61 *(
unsigned long *) stack = data;
66 struct perf_sample_data *data,
struct pt_regs *
regs)
87 ptrace_breakpoint_init(&
attr);
105 attr.disabled =
false;
120 if (ptrace_get_breakpoints(child) < 0)
123 set_single_step(child, pc);
124 ptrace_put_breakpoints(child);
144 unsigned int pos,
unsigned int count,
145 void *kbuf,
void __user *ubuf)
150 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
152 0, 16 *
sizeof(
unsigned long));
155 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
160 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
168 unsigned int pos,
unsigned int count,
169 const void *kbuf,
const void __user *ubuf)
174 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
176 0, 16 *
sizeof(
unsigned long));
177 if (!ret && count > 0)
178 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
183 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
192 unsigned int pos,
unsigned int count,
193 void *kbuf,
void __user *ubuf)
202 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
203 &target->
thread.xstate->hardfpu, 0, -1);
205 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
206 &target->
thread.xstate->softfpu, 0, -1);
211 unsigned int pos,
unsigned int count,
212 const void *kbuf,
const void __user *ubuf)
223 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
224 &target->
thread.xstate->hardfpu, 0, -1);
226 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
227 &target->
thread.xstate->softfpu, 0, -1);
240 unsigned int pos,
unsigned int count,
241 void *kbuf,
void __user *ubuf)
247 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs,
250 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
258 unsigned int pos,
unsigned int count,
259 const void *kbuf,
const void __user *ubuf)
265 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs,
268 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
274 static int dspregs_active(
struct task_struct *target,
279 return regs->
sr & SR_DSP ? regset->
n : 0;
332 .size =
sizeof(
long),
333 .
align =
sizeof(
long),
343 .
align =
sizeof(
long),
353 .size =
sizeof(
long),
354 .
align =
sizeof(
long),
357 .active = dspregs_active,
365 .regsets = sh_regsets,
371 return &user_sh_native_view;
375 unsigned long addr,
unsigned long data)
377 unsigned long __user *datap = (
unsigned long __user *)data;
386 if ((addr & 3) || addr < 0 ||
387 addr >
sizeof(
struct user) - 3)
390 if (addr <
sizeof(
struct pt_regs))
391 tmp = get_stack_long(child, addr);
405 tmp = ((
unsigned long *)child->
thread.xstate)
411 tmp = child->
mm->start_code;
413 tmp = child->
mm->start_data;
415 tmp = child->
mm->end_code;
417 tmp = child->
mm->end_code - child->
mm->start_code;
426 if ((addr & 3) || addr < 0 ||
427 addr >
sizeof(
struct user) - 3)
430 if (addr <
sizeof(
struct pt_regs))
431 ret = put_stack_long(child, addr, data);
440 ((
unsigned long *)child->
thread.xstate)
450 return copy_regset_to_user(child, &user_sh_native_view,
455 return copy_regset_from_user(child, &user_sh_native_view,
461 return copy_regset_to_user(child, &user_sh_native_view,
466 return copy_regset_from_user(child, &user_sh_native_view,
473 return copy_regset_to_user(child, &user_sh_native_view,
478 return copy_regset_from_user(child, &user_sh_native_view,
491 static inline int audit_arch(
void)
495 #ifdef CONFIG_CPU_LITTLE_ENDIAN
506 secure_computing_strict(regs->
regs[0]);
509 tracehook_report_syscall_entry(regs))
518 trace_sys_enter(regs, regs->
regs[0]);
520 audit_syscall_entry(audit_arch(), regs->
regs[3],
524 return ret ?: regs->
regs[0];
531 audit_syscall_exit(regs);
534 trace_sys_exit(regs, regs->
regs[0]);
538 tracehook_report_syscall_exit(regs, step);