| /linux/tools/testing/selftests/powerpc/ptrace/ |
| H A D | Makefile | 3 TM_TESTS := ptrace-tm-gpr 4 TM_TESTS += ptrace-tm-spd-gpr 5 TM_TESTS += ptrace-tm-spd-tar 6 TM_TESTS += ptrace-tm-spd-vsx 7 TM_TESTS += ptrace-tm-spr 8 TM_TESTS += ptrace-tm-tar 9 TM_TESTS += ptrace-tm-vsx 14 TESTS_64 += ptrace-hwbreak 15 TESTS_64 += ptrace-perf-hwbreak 16 TESTS_64 += ptrace-pkey [all …]
|
| H A D | .gitignore | 2 ptrace-gpr 3 ptrace-tm-gpr 4 ptrace-tm-spd-gpr 5 ptrace-tar 6 ptrace-tm-tar 7 ptrace-tm-spd-tar 8 ptrace-vsx 9 ptrace-tm-vsx 10 ptrace-tm-spd-vsx 11 ptrace-tm-spr [all …]
|
| H A 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 …]
|
| H A D | ptrace-hwbreak.c | 54 if (ptrace(PPC_PTRACE_GETHWDBGINFO, child_pid, NULL, dbginfo)) { in get_dbginfo() 121 if (ptrace(PTRACE_TRACEME, 0, NULL, 0)) { in test_workload() 224 ptrace(PTRACE_GETSIGINFO, child_pid, NULL, &siginfo); in check_success() 241 ptrace(PTRACE_SINGLESTEP, child_pid, NULL, 0); in check_success() 248 if (ptrace(PTRACE_SET_DEBUGREG, child_pid, 0, wp_addr)) { in ptrace_set_debugreg() 256 int wh = ptrace(PPC_PTRACE_SETHWDEBUG, child_pid, 0, info); in ptrace_sethwdebug() 267 if (ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, wh) < 0) { in ptrace_delhwdebug() 289 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_set_debugreg() 299 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_set_debugreg() 310 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_set_debugreg() [all …]
|
| H A D | ptrace-syscall.c | 74 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) in test_ptrace_syscall_restart() 92 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 96 if (ptrace(PTRACE_GETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 127 if (ptrace(PTRACE_SETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 130 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 134 if (ptrace(PTRACE_GETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 170 if (ptrace(PTRACE_SETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 173 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 177 if (ptrace(PTRACE_GETREGS, chld, 0, ®s) != 0) in test_ptrace_syscall_restart() 203 if (ptrace(PTRACE_CONT, chld, 0, 0) != 0) in test_ptrace_syscall_restart()
|
| /linux/arch/powerpc/kernel/ptrace/ |
| H A D | Makefile | 8 obj-y += ptrace.o ptrace-view.o 9 obj-y += ptrace-fpu.o 11 obj-$(CONFIG_VSX) += ptrace-vsx.o 13 obj-y += ptrace-novsx.o 15 obj-$(CONFIG_ALTIVEC) += ptrace-altivec.o 16 obj-$(CONFIG_SPE) += ptrace-spe.o 17 obj-$(CONFIG_PPC_TRANSACTIONAL_MEM) += ptrace-tm.o 18 obj-$(CONFIG_PPC_ADV_DEBUG_REGS) += ptrace-adv.o 20 obj-y += ptrace-noadv.o
|
| /linux/tools/perf/arch/x86/tests/ |
| H A D | bp-modify.c | 40 int err = ptrace(PTRACE_TRACEME, 0, NULL, NULL); in spawn_child() 81 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 87 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 93 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 99 if (ptrace(PTRACE_CONT, child, NULL, NULL)) { in bp_modify1() 110 rip = ptrace(PTRACE_PEEKUSER, child, in bp_modify1() 119 if (ptrace(PTRACE_DETACH, child, NULL, NULL)) { in bp_modify1() 154 if (ptrace(PTRACE_POKEUSER, child, in bp_modify2() 160 if (ptrace(PTRACE_POKEUSER, child, in bp_modify2() 166 if (!ptrace(PTRACE_POKEUSER, child, in bp_modify2() [all …]
|
| /linux/tools/testing/selftests/arm64/fp/ |
| H A D | Makefile | 9 fp-ptrace \ 11 sve-ptrace sve-probe-vls \ 13 za-fork za-ptrace 20 zt-ptrace \ 30 $(OUTPUT)/fp-ptrace: fp-ptrace.c fp-ptrace-asm.S 35 $(OUTPUT)/sve-ptrace: sve-ptrace.c 47 $(OUTPUT)/za-ptrace: za-ptrace.c 50 $(OUTPUT)/zt-ptrace: zt-ptrace.c
|
| H A D | .gitignore | 2 fp-ptrace 9 sve-ptrace 15 za-ptrace 17 zt-ptrace
|
| H A D | zt-ptrace.c | 45 if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) in do_child() 77 if (ptrace(PTRACE_GETREGSET, pid, NT_ARM_ZA, &iov)) in get_za() 99 return ptrace(PTRACE_SETREGSET, pid, NT_ARM_ZA, &iov); in set_za() 108 return ptrace(PTRACE_GETREGSET, pid, NT_ARM_ZT, &iov); in get_zt() 117 return ptrace(PTRACE_SETREGSET, pid, NT_ARM_ZT, &iov); in set_zt() 288 if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &si)) { in do_parent() 307 if (ptrace(PTRACE_CONT, pid, NULL, sig)) { in do_parent()
|
| /linux/tools/testing/selftests/riscv/vector/ |
| H A D | validate_v_ptrace.c | 47 ASSERT_EQ(0, ptrace(PTRACE_ATTACH, pid, NULL, NULL)); in TEST() 53 ASSERT_EQ(0, ptrace(PTRACE_POKEDATA, pid, &chld_lock, 0)); in TEST() 57 ASSERT_EQ(0, ptrace(PTRACE_CONT, pid, NULL, NULL)); in TEST() 72 ret = ptrace(PTRACE_GETREGSET, pid, NT_RISCV_VECTOR, &iov); in TEST() 154 ASSERT_EQ(0, ptrace(PTRACE_ATTACH, pid, NULL, NULL)); in TEST() 160 ASSERT_EQ(0, ptrace(PTRACE_POKEDATA, pid, &chld_lock, 0)); in TEST() 164 ASSERT_EQ(0, ptrace(PTRACE_CONT, pid, NULL, NULL)); in TEST() 171 vstart_csr = ptrace(PTRACE_PEEKDATA, pid, &vstart, NULL); in TEST() 175 vl_csr = ptrace(PTRACE_PEEKDATA, pid, &vl, NULL); in TEST() 179 vtype_csr = ptrace(PTRACE_PEEKDATA, pid, &vtype, NULL); in TEST() [all …]
|
| /linux/include/linux/ |
| H A 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() 154 if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) in ptrace_event() 200 static inline void ptrace_init_task(struct task_struct *child, bool ptrace) in ptrace_init_task() argument 205 child->ptrace = 0; in ptrace_init_task() 208 if (unlikely(ptrace) && current->ptrace) { in ptrace_init_task() 209 child->ptrace = current->ptrace; in ptrace_init_task() 212 if (child->ptrace & PT_SEIZED) in ptrace_init_task() 409 int ptrace = current->ptrace; in ptrace_report_syscall() local [all …]
|
| /linux/tools/testing/selftests/arm64/abi/ |
| H A D | ptrace.c | 45 ret = ptrace(PTRACE_GETREGSET, child, NT_ARM_TLS, &read_iov); in test_tpidr() 51 ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov); in test_tpidr() 55 ret = ptrace(PTRACE_GETREGSET, child, NT_ARM_TLS, &read_iov); in test_tpidr() 61 ret = ptrace(PTRACE_GETREGSET, child, NT_ARM_TLS, &read_iov); in test_tpidr() 82 ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov); in test_tpidr() 90 ret = ptrace(PTRACE_GETREGSET, child, NT_ARM_TLS, &read_iov); in test_tpidr() 112 ret = ptrace(PTRACE_SETREGSET, child, NT_ARM_TLS, &write_iov); in test_tpidr() 117 ret = ptrace(PTRACE_GETREGSET, child, NT_ARM_TLS, in test_tpidr() 145 ret = ptrace(PTRACE_GETREGSET, child, type, &iov); in test_hw_debug() 165 if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) in do_child() [all …]
|
| /linux/tools/testing/selftests/breakpoints/ |
| H A D | breakpoint_test.c | 46 ret = ptrace(PTRACE_POKEUSER, child_pid, in set_breakpoint_addr() 88 dr7 = ptrace(PTRACE_PEEKUSER, child_pid, in toggle_breakpoint() 108 ret = ptrace(PTRACE_POKEUSER, child_pid, in toggle_breakpoint() 209 ret = ptrace(PTRACE_TRACEME, 0, NULL, 0); in trigger_tests() 276 child_nr_tests = ptrace(PTRACE_PEEKDATA, child_pid, in check_success() 280 if (ptrace(PTRACE_POKEDATA, child_pid, &trapped, 1)) in check_success() 299 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_instruction_breakpoints() 321 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_watchpoints() 377 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_tests() 381 ptrace(PTRACE_CONT, child_pid, NULL, 0); in launch_tests() [all …]
|
| /linux/arch/riscv/kernel/ |
| H A D | ptrace.c | 132 struct __riscv_v_regset_state *ptrace) in invalid_ptrace_v_csr() argument 140 if (vstate->vlenb != ptrace->vlenb) in invalid_ptrace_v_csr() 145 if (ptrace->vcsr & reserved) in invalid_ptrace_v_csr() 151 if (ptrace->vtype & reserved) in invalid_ptrace_v_csr() 155 vsew = (ptrace->vtype & VTYPE_VSEW) >> VTYPE_VSEW_SHIFT; in invalid_ptrace_v_csr() 161 vfrac = (ptrace->vtype & VTYPE_VLMUL_FRAC); in invalid_ptrace_v_csr() 162 vlmul = (ptrace->vtype & VTYPE_VLMUL); in invalid_ptrace_v_csr() 173 vl = ptrace->vl ? ptrace->vl : 1; in invalid_ptrace_v_csr() 191 if (ptrace->vtype & reserved) in invalid_ptrace_v_csr() 198 if (ptrace->vtype & VTYPE_VEDIV_THEAD) in invalid_ptrace_v_csr() [all …]
|
| /linux/tools/testing/selftests/landlock/ |
| H A D | ptrace_test.c | 16 #include <sys/ptrace.h> 96 * Yama's scoped ptrace is presumed disabled. If enabled, this optional 200 ret = ptrace(PTRACE_ATTACH, parent, NULL, 0); in TEST_F() 210 ASSERT_EQ(0, ptrace(PTRACE_DETACH, parent, NULL, 0)); in TEST_F() 214 ret = ptrace(PTRACE_TRACEME); in TEST_F() 256 ASSERT_EQ(0, ptrace(PTRACE_DETACH, child, NULL, 0)); in TEST_F() 259 EXPECT_EQ(-1, ptrace(PTRACE_DETACH, child, NULL, 0)); in TEST_F() 272 ret = ptrace(PTRACE_ATTACH, child, NULL, 0); in TEST_F() 283 ASSERT_EQ(0, ptrace(PTRACE_DETACH, child, NULL, 0)); in TEST_F() 299 " blockers=ptrace opi in matches_log_ptrace() [all...] |
| /linux/Documentation/admin-guide/LSM/ |
| H A D | Yama.rst | 26 exist and remain possible if ptrace is allowed to operate as before. 27 Since ptrace is not commonly used by non-developers and non-admins, system 31 specifically disallow such ptrace attachment (e.g. ssh-agent), but many 32 do not. A more general solution is to only allow ptrace directly from a 44 to ptrace each other. If a process wishes to entirely disable these ptrace 51 0 - classic ptrace permissions: 58 1 - restricted ptrace: 68 only processes with ``CAP_SYS_PTRACE`` may use ptrace, either with 72 no processes may use ptrace with ``PTRACE_ATTACH`` nor via
|
| /linux/tools/testing/selftests/x86/ |
| H A D | fsgsbase_restore.c | 161 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) in main() 189 if (ptrace(PTRACE_GETREGS, chld, NULL, ®s) != 0) in main() 207 if (ptrace(PTRACE_SETREGS, chld, NULL, ®s2) != 0) in main() 209 if (ptrace(PTRACE_CONT, chld, NULL, NULL) != 0) in main() 217 if (ptrace(PTRACE_SETREGS, chld, NULL, ®s) != 0) in main() 219 if (ptrace(PTRACE_DETACH, chld, NULL, NULL) != 0) in main()
|
| /linux/arch/um/os-Linux/ |
| H A D | start_up.c | 48 ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) { in ptrace_child() 131 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) in stop_ptraced_child() 150 if ((ptrace(PTRACE_SETOPTIONS, pid, 0, in check_sysemu() 156 if (ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) in check_sysemu() 169 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_RET_OFFSET, in check_sysemu() 203 if ((ptrace(PTRACE_SETOPTIONS, pid, 0, in check_ptrace() 208 if (ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0) in check_ptrace() 220 syscall = ptrace(PTRACE_PEEKUSER, pid, PT_SYSCALL_NR_OFFSET, in check_ptrace() 223 n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET, in check_ptrace()
|
| /linux/kernel/ |
| H A D | exit.c | 684 if (!p->ptrace && in reparent_leader() 715 BUG_ON((!t->ptrace) != (rcu_access_pointer(t->parent) == father)); in forget_original_parent() 716 if (likely(!t->ptrace)) in forget_original_parent() 751 if (unlikely(tsk->ptrace)) { in exit_notify() 1140 eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p) in eligible_child() argument 1149 if (ptrace || (wo->wo_flags & __WALL)) in eligible_child() 1298 static int *task_stopped_code(struct task_struct *p, bool ptrace) in task_stopped_code() argument 1300 if (ptrace) { in task_stopped_code() 1329 int ptrace, struct task_struct *p) in wait_task_stopped() argument 1339 if (!ptrace && !(wo->wo_flags & WUNTRACED)) in wait_task_stopped() [all …]
|
| /linux/tools/testing/selftests/riscv/cfi/ |
| H A D | cfitests.c | 48 long ptrace(int request, pid_t pid, void *addr, void *data); 68 ptrace(PTRACE_TRACEME, 0, NULL, NULL); in cfi_ptrace_test() 89 ret = ptrace(PTRACE_GETREGSET, pid, (void *)NT_RISCV_USER_CFI, &iov); in cfi_ptrace_test() 115 ret = ptrace(PTRACE_SETREGSET, pid, (void *)NT_RISCV_USER_CFI, &iov); in cfi_ptrace_test() 123 ptrace(PTRACE_CONT, pid, NULL, NULL); in cfi_ptrace_test()
|
| /linux/arch/x86/um/os-Linux/ |
| H A D | registers.c | 31 if (ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov) < 0) in get_fp_registers() 43 if (ptrace(PTRACE_SETREGSET, pid, ptrace_regset, &iov) < 0) in put_fp_registers() 63 ret = ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov); in arch_init_registers() 74 ret = ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov); in arch_init_registers()
|
| /linux/tools/testing/selftests/ptrace/ |
| H A D | vmaccess.c | 20 ptrace(PTRACE_TRACEME, 0, 0L, 0L); in thread() 59 k = ptrace(PTRACE_ATTACH, pid, 0L, 0L); in TEST() 69 k = ptrace(PTRACE_ATTACH, pid, 0L, 0L); in TEST() 75 k = ptrace(PTRACE_DETACH, pid, 0L, 0L); in TEST()
|
| /linux/Documentation/translations/zh_CN/userspace-api/ |
| H A D | seccomp_filter.rst | 110 当返回的时候,这个值会使得内核在执行系统调用前尝试去通知一个基于 ``ptrace()`` 113 如果追踪器通过 ``ptrace(PTRACE_SETOPTIONS)`` 请求了 ``PTRACE_O_TRACESECCOMP``, 122 ptrace的使用,甚至其他沙箱进程也不行,除非非常小心;ptrace可以通过这个机制来逃 230 内存的指针。进程的内存可以通过 ``ptrace()`` 或 ``/proc/pid/mem`` 由合适的特权跟踪
|
| /linux/tools/testing/selftests/arm64/gcs/ |
| H A D | libc-gcs.c | 159 if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) in TEST() 198 if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &si)) { in TEST() 219 if (ptrace(PTRACE_CONT, pid, NULL, sig)) { in TEST() 233 ret = ptrace(PTRACE_GETREGSET, child, NT_ARM_GCS, &iov); in TEST() 255 val = ptrace(PTRACE_PEEKDATA, child, (void *)gcspr, NULL); in TEST() 278 ret = ptrace(PTRACE_POKEDATA, child, (void *)gcspr, NULL); in TEST() 283 EXPECT_EQ(0, ptrace(PTRACE_PEEKDATA, child, (void *)gcspr, NULL)); in TEST() 286 ret = ptrace(PTRACE_POKEDATA, child, (void *)gcspr, val); in TEST() 291 EXPECT_EQ(val, ptrace(PTRACE_PEEKDATA, child, (void *)gcspr, NULL)); in TEST()
|