/Linux-v4.19/tools/testing/selftests/powerpc/ptrace/ |
D | Makefile | 2 TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \ 3 ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \ 4 ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak ptrace-pkey core-pkey \ 14 ptrace-pkey core-pkey: child.h 15 ptrace-pkey core-pkey: LDLIBS += -pthread 17 $(TEST_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
|
D | .gitignore | 1 ptrace-gpr 2 ptrace-tm-gpr 3 ptrace-tm-spd-gpr 4 ptrace-tar 5 ptrace-tm-tar 6 ptrace-tm-spd-tar 7 ptrace-vsx 8 ptrace-tm-vsx 9 ptrace-tm-spd-vsx 10 ptrace-tm-spr [all …]
|
D | ptrace.h | 68 ret = ptrace(PTRACE_ATTACH, child, NULL, NULL); in start_trace() 85 ret = ptrace(PTRACE_DETACH, child, NULL, NULL); in stop_trace() 97 ret = ptrace(PTRACE_CONT, child, NULL, NULL); in cont_trace() 116 ret = ptrace(PTRACE_GETREGSET, child, type, &iov); in ptrace_read_regs() 136 ret = ptrace(PTRACE_SETREGSET, child, type, &iov); in ptrace_write_regs() 158 ret = ptrace(PTRACE_GETREGSET, child, NT_PPC_TAR, &iov); in show_tar_registers() 166 ret = ptrace(PTRACE_GETREGSET, child, NT_PPC_PPR, &iov); in show_tar_registers() 174 ret = ptrace(PTRACE_GETREGSET, child, NT_PPC_DSCR, &iov); in show_tar_registers() 206 ret = ptrace(PTRACE_SETREGSET, child, NT_PPC_TAR, &iov); in write_tar_registers() 213 ret = ptrace(PTRACE_SETREGSET, child, NT_PPC_PPR, &iov); in write_tar_registers() [all …]
|
D | ptrace-hwbreak.c | 39 ret = ptrace(PPC_PTRACE_GETHWDBGINFO, child_pid, NULL, &dbginfo); in get_dbginfo() 60 ret = ptrace(PTRACE_SET_DEBUGREG, child_pid, 0, addr); in set_breakpoint_addr() 83 ret = ptrace(PPC_PTRACE_SETHWDEBUG, child_pid, 0, &info); in set_hwbreakpoint_addr() 95 ret = ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, watchpoint_handle); in del_hwbreakpoint_addr() 169 ret = ptrace(PTRACE_TRACEME, 0, NULL, 0); in trigger_tests() 237 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_watchpoints() 249 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_watchpoints() 260 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_watchpoints() 275 i = ptrace(PPC_PTRACE_GETHWDBGINFO, child_pid, NULL, &dbginfo); in launch_tests() 291 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_tests() [all …]
|
/Linux-v4.19/tools/perf/arch/x86/tests/ |
D | bp-modify.c | 39 int err = ptrace(PTRACE_TRACEME, 0, NULL, NULL); in spawn_child() 80 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 87 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 94 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 100 if (ptrace(PTRACE_CONT, child, NULL, NULL)) { in bp_modify1() 111 rip = ptrace(PTRACE_PEEKUSER, child, in bp_modify1() 122 if (ptrace(PTRACE_DETACH, child, NULL, NULL)) { in bp_modify1() 157 if (ptrace(PTRACE_POKEUSER, child, in bp_modify2() 164 if (ptrace(PTRACE_POKEUSER, child, in bp_modify2() 170 if (!ptrace(PTRACE_POKEUSER, child, in bp_modify2() [all …]
|
/Linux-v4.19/tools/testing/selftests/x86/ |
D | ptrace_syscall.c | 183 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) in test_ptrace_syscall_restart() 204 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 208 if (ptrace(PTRACE_GETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 232 if (ptrace(PTRACE_SETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 235 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 239 if (ptrace(PTRACE_GETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 264 if (ptrace(PTRACE_SETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 267 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 271 if (ptrace(PTRACE_GETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 283 if (ptrace(PTRACE_CONT, chld, 0, 0) != 0) in test_ptrace_syscall_restart() [all …]
|
D | mov_ss_trap.c | 74 if (ptrace(PTRACE_ATTACH, parent, NULL, NULL) != 0) in enable_watchpoint() 80 if (ptrace(PTRACE_POKEUSER, parent, (void *)offsetof(struct user, u_debugreg[0]), dr0) != 0) in enable_watchpoint() 83 if (ptrace(PTRACE_POKEUSER, parent, (void *)offsetof(struct user, u_debugreg[1]), dr1) != 0) in enable_watchpoint() 86 if (ptrace(PTRACE_POKEUSER, parent, (void *)offsetof(struct user, u_debugreg[7]), dr7) != 0) in enable_watchpoint() 91 if (ptrace(PTRACE_DETACH, parent, NULL, NULL) != 0) in enable_watchpoint()
|
/Linux-v4.19/arch/x86/um/os-Linux/ |
D | registers.c | 23 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) in save_i387_registers() 36 if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) < 0) in save_fp_registers() 46 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) in restore_i387_registers() 58 if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0) in restore_fp_registers() 70 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) in save_fpx_registers() 77 if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0) in restore_fpx_registers() 103 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs); in arch_init_registers() 137 if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) == 0) in arch_init_registers()
|
D | tls.c | 52 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, in os_set_thread_area() 63 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, in os_get_thread_area()
|
/Linux-v4.19/include/linux/ |
D | ptrace.h | 97 if (unlikely(child->ptrace)) in ptrace_unlink() 119 if (unlikely(task->ptrace)) in ptrace_parent() 135 return task->ptrace & PT_EVENT_FLAG(event); in ptrace_event_enabled() 155 if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) in ptrace_event() 201 static inline void ptrace_init_task(struct task_struct *child, bool ptrace) in ptrace_init_task() argument 206 child->ptrace = 0; in ptrace_init_task() 209 if (unlikely(ptrace) && current->ptrace) { in ptrace_init_task() 210 child->ptrace = current->ptrace; in ptrace_init_task() 213 if (child->ptrace & PT_SEIZED) in ptrace_init_task()
|
D | tracehook.h | 62 int ptrace = current->ptrace; in ptrace_report_syscall() local 64 if (!(ptrace & PT_PTRACED)) in ptrace_report_syscall() 67 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); in ptrace_report_syscall()
|
/Linux-v4.19/arch/um/os-Linux/ |
D | start_up.c | 36 ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) { in ptrace_child() 125 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) { in stop_ptraced_child() 173 if (ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) in check_sysemu() 183 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) in check_sysemu() 191 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); in check_sysemu() 208 if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0, in check_sysemu() 214 if (ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) in check_sysemu() 227 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, in check_sysemu() 266 if ((ptrace(PTRACE_OLDSETOPTIONS, pid, 0, in check_ptrace() 271 if (ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0) in check_ptrace() [all …]
|
D | registers.c | 18 err = ptrace(PTRACE_GETREGS, pid, 0, regs->gp); in save_registers() 28 err = ptrace(PTRACE_SETREGS, pid, 0, regs->gp); in restore_registers() 43 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); in init_registers()
|
/Linux-v4.19/tools/testing/selftests/breakpoints/ |
D | breakpoint_test.c | 45 ret = ptrace(PTRACE_POKEUSER, child_pid, in set_breakpoint_addr() 87 dr7 = ptrace(PTRACE_PEEKUSER, child_pid, in toggle_breakpoint() 107 ret = ptrace(PTRACE_POKEUSER, child_pid, in toggle_breakpoint() 208 ret = ptrace(PTRACE_TRACEME, 0, NULL, 0); in trigger_tests() 275 child_nr_tests = ptrace(PTRACE_PEEKDATA, child_pid, in check_success() 279 if (ptrace(PTRACE_POKEDATA, child_pid, &trapped, 1)) in check_success() 298 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_instruction_breakpoints() 320 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_watchpoints() 369 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_tests() 373 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_tests() [all …]
|
D | breakpoint_test_arm64.c | 46 if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) != 0) { in child() 107 if (ptrace(PTRACE_SETREGSET, pid, NT_ARM_HW_WATCH, &iov) == 0) in set_watchpoint() 155 if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) { in run_test() 182 if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo) != 0) { in run_test()
|
D | step_after_suspend_test.c | 45 if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) != 0) { in child() 87 if (ptrace(PTRACE_SINGLESTEP, pid, NULL, NULL) < 0) { in run_test() 118 if (ptrace(PTRACE_CONT, pid, NULL, NULL) < 0) { in run_test()
|
/Linux-v4.19/arch/um/os-Linux/skas/ |
D | process.c | 36 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) in ptrace_dump_regs() 67 err = ptrace(PTRACE_CONT, pid, 0, 0); in wait_stub_done() 101 err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV); in get_skas_faultinfo() 143 err = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, in handle_trap() 151 err = ptrace(PTRACE_SYSCALL, pid, 0, 0); in handle_trap() 198 ptrace(PTRACE_TRACEME, 0, 0, 0); in userspace_tramp() 312 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, in start_userspace() 354 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) { in userspace() 372 if (ptrace(op, pid, 0, 0)) { in userspace() 386 if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp)) { in userspace() [all …]
|
/Linux-v4.19/Documentation/admin-guide/LSM/ |
D | Yama.rst | 25 exist and remain possible if ptrace is allowed to operate as before. 26 Since ptrace is not commonly used by non-developers and non-admins, system 30 specifically disallow such ptrace attachment (e.g. ssh-agent), but many 31 do not. A more general solution is to only allow ptrace directly from a 43 to ptrace each other. If a process wishes to entirely disable these ptrace 50 0 - classic ptrace permissions: 57 1 - restricted ptrace: 67 only processes with ``CAP_SYS_PTRACE`` may use ptrace 71 no processes may use ptrace with ``PTRACE_ATTACH`` nor via
|
/Linux-v4.19/kernel/ |
D | exit.c | 643 if (!p->ptrace && in reparent_leader() 679 BUG_ON((!t->ptrace) != (t->parent == father)); in forget_original_parent() 680 if (likely(!t->ptrace)) in forget_original_parent() 713 if (unlikely(tsk->ptrace)) { in exit_notify() 1013 eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p) in eligible_child() argument 1022 if (ptrace || (wo->wo_flags & __WALL)) in eligible_child() 1174 static int *task_stopped_code(struct task_struct *p, bool ptrace) in task_stopped_code() argument 1176 if (ptrace) { in task_stopped_code() 1205 int ptrace, struct task_struct *p) in wait_task_stopped() argument 1215 if (!ptrace && !(wo->wo_flags & WUNTRACED)) in wait_task_stopped() [all …]
|
D | ptrace.c | 48 if (!tsk->ptrace || in ptrace_access_vm() 116 BUG_ON(!child->ptrace); in __ptrace_unlink() 127 child->ptrace = 0; in __ptrace_unlink() 191 WARN_ON(!task->ptrace || task->parent != current); in ptrace_unfreeze_traced() 236 if (child->ptrace && child->parent == current) { in ptrace_check_attach() 388 if (task->ptrace) in ptrace_attach() 393 task->ptrace = flags; in ptrace_attach() 459 if (!current->ptrace) { in ptrace_traceme() 467 current->ptrace = PT_PTRACED; in ptrace_traceme() 542 WARN_ON(!child->ptrace || child->exit_state); in ptrace_detach() [all …]
|
/Linux-v4.19/arch/um/kernel/ |
D | signal.c | 28 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) in handle_signal() 103 if (current->ptrace & PT_DTRACE) in do_signal()
|
D | ptrace.c | 15 child->ptrace |= PT_DTRACE; in user_enable_single_step() 25 child->ptrace &= ~PT_DTRACE; in user_disable_single_step() 144 int ptraced = current->ptrace; in syscall_trace_leave()
|
/Linux-v4.19/arch/x86/um/ |
D | ptrace_user.c | 11 if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0) in ptrace_getregs() 18 if (ptrace(PTRACE_SETREGS, pid, 0, regs) < 0) in ptrace_setregs()
|
/Linux-v4.19/drivers/connector/ |
D | cn_proc.c | 206 ev->event_data.ptrace.process_pid = task->pid; in proc_ptrace_connector() 207 ev->event_data.ptrace.process_tgid = task->tgid; in proc_ptrace_connector() 209 ev->event_data.ptrace.tracer_pid = current->pid; in proc_ptrace_connector() 210 ev->event_data.ptrace.tracer_tgid = current->tgid; in proc_ptrace_connector() 212 ev->event_data.ptrace.tracer_pid = 0; in proc_ptrace_connector() 213 ev->event_data.ptrace.tracer_tgid = 0; in proc_ptrace_connector()
|
/Linux-v4.19/tools/testing/selftests/seccomp/ |
D | seccomp_bpf.c | 1335 ret = ptrace(PTRACE_ATTACH, tracee, NULL, 0); in start_tracer() 1342 ret = ptrace(PTRACE_SETOPTIONS, tracee, NULL, ptrace_syscall ? in start_tracer() 1349 ret = ptrace(ptrace_syscall ? PTRACE_SYSCALL : PTRACE_CONT, in start_tracer() 1372 ret = ptrace(ptrace_syscall ? PTRACE_SYSCALL : PTRACE_CONT, in start_tracer() 1439 ret = ptrace(PTRACE_GETEVENTMSG, tracee, NULL, &msg); in tracer_poke() 1450 ret = ptrace(PTRACE_POKEDATA, tracee, info->poke_addr, 0x1001); in tracer_poke() 1581 EXPECT_EQ(0, ptrace(PTRACE_GETREGS, tracee, 0, ®s)) { in get_syscall() 1590 EXPECT_EQ(0, ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov)) { in get_syscall() 1610 ret = ptrace(PTRACE_GETREGS, tracee, 0, ®s); in change_syscall() 1615 ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov); in change_syscall() [all …]
|