/linux-6.3-rc2/tools/testing/selftests/powerpc/ptrace/ |
A D | Makefile | 3 TM_TESTS := ptrace-tm-gpr 4 TM_TESTS += ptrace-tm-spd-gpr 5 TM_TESTS += ptrace-tm-spd-tar 7 TM_TESTS += ptrace-tm-spr 8 TM_TESTS += ptrace-tm-tar 9 TM_TESTS += ptrace-tm-vsx 16 TESTS_64 += ptrace-pkey 18 TESTS_64 += ptrace-tar 19 TESTS_64 += ptrace-vsx 21 TESTS += ptrace-gpr [all …]
|
A D | .gitignore | 2 ptrace-gpr 3 ptrace-tm-gpr 4 ptrace-tm-spd-gpr 5 ptrace-tar 6 ptrace-tm-tar 8 ptrace-vsx 9 ptrace-tm-vsx 11 ptrace-tm-spr 12 ptrace-hwbreak 15 ptrace-pkey [all …]
|
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() 430 ret = ptrace(PTRACE_GETREGS, child, NULL, regs); in show_gpr() 519 ret = ptrace(PTRACE_GETREGS, child, NULL, regs); in write_gpr() 601 ret = ptrace(PTRACE_GETVRREGS, child, 0, vmx); in show_vmx() 631 ret = ptrace(PTRACE_SETVRREGS, child, 0, vmx); in write_vmx() 661 ret = ptrace(PTRACE_GETVSRREGS, child, 0, vsx); in show_vsx() [all …]
|
A D | ptrace-hwbreak.c | 121 if (ptrace(PTRACE_TRACEME, 0, NULL, 0)) { in test_workload() 289 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_set_debugreg() 299 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_set_debugreg() 329 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_set_debugreg_kernel_userspace() 362 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_sethwdebug_exact() 369 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_sethwdebug_exact() 376 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_sethwdebug_exact() 392 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_sethwdebug_exact_kernel_userspace() 410 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_sethwdebug_range_aligned() 419 ptrace(PTRACE_CONT, child_pid, NULL, 0); in test_sethwdebug_range_aligned() [all …]
|
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()
|
A D | ptrace-perf-hwbreak.c | 122 ret = ptrace(PTRACE_TRACEME, 0, NULL, 0); in child() 202 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test2() 256 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test4() 294 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test5() 336 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test6() 361 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test7() 390 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test8() 426 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test9() 450 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test10() 478 ptrace(PPC_PTRACE_DELHWDEBUG, child_pid, 0, ptrace_fd); in test11() [all …]
|
/linux-6.3-rc2/arch/powerpc/kernel/ptrace/ |
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-6.3-rc2/tools/perf/arch/x86/tests/ |
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() 88 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 95 if (ptrace(PTRACE_POKEUSER, child, in bp_modify1() 101 if (ptrace(PTRACE_CONT, child, NULL, NULL)) { in bp_modify1() 112 rip = ptrace(PTRACE_PEEKUSER, child, in bp_modify1() 158 if (ptrace(PTRACE_POKEUSER, child, in bp_modify2() 165 if (ptrace(PTRACE_POKEUSER, child, in bp_modify2() 171 if (!ptrace(PTRACE_POKEUSER, child, in bp_modify2() 177 if (ptrace(PTRACE_CONT, child, NULL, NULL)) { in bp_modify2() [all …]
|
/linux-6.3-rc2/include/linux/ |
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() 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() 405 int ptrace = current->ptrace; in ptrace_report_syscall() local 408 if (!(ptrace & PT_PTRACED)) in ptrace_report_syscall() [all …]
|
/linux-6.3-rc2/tools/testing/selftests/arm64/abi/ |
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() 137 if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) in do_child() 178 if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &si)) { in do_parent() [all …]
|
/linux-6.3-rc2/tools/testing/selftests/x86/ |
A 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() 235 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 267 if (ptrace(PTRACE_SYSEMU, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 283 if (ptrace(PTRACE_CONT, chld, 0, 0) != 0) in test_ptrace_syscall_restart() 303 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) in test_restart_under_ptrace() 325 if (ptrace(PTRACE_SYSCALL, chld, 0, 0) != 0) in test_restart_under_ptrace() 349 if (ptrace(PTRACE_SYSCALL, chld, 0, 0) != 0) in test_restart_under_ptrace() 372 if (ptrace(PTRACE_CONT, chld, 0, 0) != 0) in test_restart_under_ptrace() [all …]
|
A D | fsgsbase_restore.c | 162 if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) in main() 190 if (ptrace(PTRACE_GETREGS, chld, NULL, ®s) != 0) in main() 208 if (ptrace(PTRACE_SETREGS, chld, NULL, ®s2) != 0) in main() 210 if (ptrace(PTRACE_CONT, chld, NULL, NULL) != 0) in main() 218 if (ptrace(PTRACE_SETREGS, chld, NULL, ®s) != 0) in main() 220 if (ptrace(PTRACE_DETACH, chld, NULL, NULL) != 0) in main()
|
A D | fsgsbase.c | 469 if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) != 0) in test_ptrace_write_gs_read_base() 484 base = ptrace(PTRACE_PEEKUSER, child, base_offset, NULL); in test_ptrace_write_gs_read_base() 495 if (ptrace(PTRACE_POKEUSER, child, gs_offset, 0x7) != 0) in test_ptrace_write_gs_read_base() 499 base = ptrace(PTRACE_PEEKUSER, child, base_offset, NULL); in test_ptrace_write_gs_read_base() 509 ptrace(PTRACE_CONT, child, NULL, NULL); in test_ptrace_write_gs_read_base() 529 if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) != 0) in test_ptrace_write_gsbase() 543 gs = ptrace(PTRACE_PEEKUSER, child, gs_offset, NULL); in test_ptrace_write_gsbase() 551 if (ptrace(PTRACE_POKEUSER, child, base_offset, 0xFF) != 0) in test_ptrace_write_gsbase() 554 gs = ptrace(PTRACE_PEEKUSER, child, gs_offset, NULL); in test_ptrace_write_gsbase() 555 base = ptrace(PTRACE_PEEKUSER, child, base_offset, NULL); in test_ptrace_write_gsbase() [all …]
|
/linux-6.3-rc2/tools/testing/selftests/arm64/fp/ |
A D | Makefile | 9 sve-ptrace sve-probe-vls \ 11 za-fork za-ptrace 17 zt-ptrace \ 31 $(OUTPUT)/sve-ptrace: sve-ptrace.c 43 $(OUTPUT)/za-ptrace: za-ptrace.c 46 $(OUTPUT)/zt-ptrace: zt-ptrace.c
|
A D | .gitignore | 7 sve-ptrace 13 za-ptrace 15 zt-ptrace
|
A D | zt-ptrace.c | 45 if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) in do_child() 75 if (ptrace(PTRACE_GETREGSET, pid, NT_ARM_ZA, &iov)) in get_za() 97 return ptrace(PTRACE_SETREGSET, pid, NT_ARM_ZA, &iov); in set_za() 106 return ptrace(PTRACE_GETREGSET, pid, NT_ARM_ZT, &iov); in get_zt() 116 return ptrace(PTRACE_SETREGSET, pid, NT_ARM_ZT, &iov); in set_zt() 287 if (ptrace(PTRACE_GETSIGINFO, pid, NULL, &si)) { in do_parent() 306 if (ptrace(PTRACE_CONT, pid, NULL, sig)) { in do_parent()
|
/linux-6.3-rc2/arch/x86/um/os-Linux/ |
A D | registers.c | 24 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) in save_i387_registers() 37 if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) < 0) in save_fp_registers() 47 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) in restore_i387_registers() 59 if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0) in restore_fp_registers() 71 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) in save_fpx_registers() 78 if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0) in restore_fpx_registers() 104 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs); in arch_init_registers() 138 if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) == 0) in arch_init_registers()
|
/linux-6.3-rc2/arch/um/os-Linux/ |
A 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() 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() 283 syscall = ptrace(PTRACE_PEEKUSER, pid, PT_SYSCALL_NR_OFFSET, in check_ptrace() [all …]
|
A 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_pid_registers() 43 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); in init_pid_registers()
|
/linux-6.3-rc2/tools/testing/selftests/breakpoints/ |
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-6.3-rc2/Documentation/admin-guide/LSM/ |
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-6.3-rc2/kernel/ |
A D | exit.c | 665 if (!p->ptrace && in reparent_leader() 702 if (likely(!t->ptrace)) in forget_original_parent() 736 if (unlikely(tsk->ptrace)) { in exit_notify() 1226 if (ptrace) { in task_stopped_code() 1401 if (likely(!ptrace)) in wait_consider_task() 1406 if (likely(!ptrace) && unlikely(p->ptrace)) { in wait_consider_task() 1419 ptrace = 1; in wait_consider_task() 1431 if (unlikely(ptrace) || likely(!p->ptrace)) in wait_consider_task() 1556 bool ptrace; in do_wait_pid() local 1560 ptrace = false; in do_wait_pid() [all …]
|
/linux-6.3-rc2/tools/testing/selftests/landlock/ |
A D | ptrace_test.c | 344 ret = ptrace(PTRACE_ATTACH, parent, NULL, 0); in TEST_F() 354 ASSERT_EQ(0, ptrace(PTRACE_DETACH, parent, NULL, 0)); in TEST_F() 358 ret = ptrace(PTRACE_TRACEME); in TEST_F() 400 ASSERT_EQ(0, ptrace(PTRACE_DETACH, child, NULL, 0)); in TEST_F() 403 EXPECT_EQ(-1, ptrace(PTRACE_DETACH, child, NULL, 0)); in TEST_F() 416 ret = ptrace(PTRACE_ATTACH, child, NULL, 0); in TEST_F() 427 ASSERT_EQ(0, ptrace(PTRACE_DETACH, child, NULL, 0)); in TEST_F()
|
/linux-6.3-rc2/arch/um/os-Linux/skas/ |
A D | process.c | 85 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) in ptrace_dump_regs() 119 err = ptrace(PTRACE_CONT, pid, 0, 0); in wait_stub_done() 152 err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV); in get_skas_faultinfo() 202 err = ptrace(PTRACE_SYSCALL, pid, 0, 0); in handle_trap() 248 ptrace(PTRACE_TRACEME, 0, 0, 0); in userspace_tramp() 358 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, in start_userspace() 402 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) { in userspace() 420 if (ptrace(op, pid, 0, 0)) { in userspace() 434 if (ptrace(PTRACE_GETREGS, pid, 0, regs->gp)) { in userspace() 571 err = ptrace(PTRACE_CONT, pid, 0, 0); in copy_context_skas0() [all …]
|
/linux-6.3-rc2/tools/testing/selftests/ptrace/ |
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()
|