summaryrefslogtreecommitdiff
path: root/lib/libc/sys/ptrace.2
AgeCommit message (Collapse)Author
2020-05-14Use more markup.wiz
2020-05-14Introduce new ptrace(2) operations: PT_SET_SIGPASS and PT_GET_SIGPASSkamil
They deliver the logic of bypassing selected signals directly to the debuggee, without informing the debugger. This can be used to implement the QPassSignals GDB/LLDB protocol. This call can be useful to avoid signal races in ATF ptrace tests.
2020-01-04Document PT_LWPSTATUS and PT_LWPNEXT in ptrace(2)kamil
Remove mentions of obsolete PT_LWPINFO.
2019-10-09Fix xref.wiz
2019-10-09Document PT_STOP, update PT_KILL in the ptrace(2) man-pagekamil
Formatting by <mgorny>
2019-07-30Include pe_lwp member in 'struct ptrace_state'mgorny
Reviewed by kamil.
2019-07-11Fix thinko: syscalls -> signalsmgorny
2019-07-10Improve/fix doc of PT_SETSTEP and PT_CLEARSTEP.mgorny
Reviewed by kamil.
2019-07-10Fix typo: SIGRAP -> SIGTRAPmgorny
2019-06-26Use Vt for variable types. New sentence, new line. Add a missing ')'.wiz
Add/remove some articles or other missing words.
2019-06-26Implement PT_GETXSTATE and PT_SETXSTATEmgorny
Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE, that provide access to the extended (and extensible) set of FPU registers on amd64 and i386. At the moment, this covers AVX (YMM) and AVX-512 (ZMM, opmask) registers. It can be easily extended to cover further register types without breaking backwards compatibility. PT_GETXSTATE issues the XSAVE instruction with all kernel-supported extended components enabled. The data is copied into 'struct xstate' (which -- unlike the XSAVE area itself -- has stable format and offsets). PT_SETXSTATE issues the XRSTOR instruction to restore the register values from user-provided 'struct xstate'. The function replaces only the specific XSAVE components that are listed in 'xs_rfbm' field, making it possible to issue partial updates. Both syscalls take a 'struct iovec' pointer rather than a direct argument. This requires the caller to explicitly specify the buffer size. As a result, existing code will continue to work correctly when the structure is extended (performing partial reads/updates).
2019-06-12Fix typo.wiz
2019-06-12Try to make posix_spawn(3) note in ptrace(2) less confusingkamil
2019-06-12Use Xr.wiz
2019-06-11Document PTRACE_POSIX_SPAWN in man-pagekamil
2019-05-25Update the ptrace(2) documentationkamil
Document that TRAP_EXEC can be returned for PT_SYSCALL. Document truncated byte transfers.
2018-05-01Implement PTRACE_VFORKkamil
Add support for tracing vfork(2) events in the context of ptrace(2). This API covers other frontends to fork1(9) like posix_spawn(2) or clone(2), if they cause parent to wait for exec(2) or exit(2) of the child. Changes: - Add new argument to sigswitch() determining whether we need to acquire the proc_lock or whether it's already held. - Refactor fork1(9) for fork(2) and vfork(2)-like events. Call sigswitch() from fork(1) for forking or vforking parent, instead of emitting kpsignal(9). We need to emit the signal and suspend the parent, returning to user and relock proc_lock. - Add missing prototype for proc_stop_done() in kern_sig.c. - Make sigswitch a public function accessible from other kernel code including <sys/signalvar.h>. - Remove an entry about unimplemented PTRACE_VFORK in the ptrace(2) man page. - Permin PTRACE_VFORK in the ptrace(2) frontend for userland. - Remove expected failure for unimplemented PTRACE_VFORK tests in the ATF ptrace(2) test-suite. - Relax signal routing constraints under a debugger for a vfork(2)ed child. This intended to protect from signaling a parent of a vfork(2)ed child that called PT_TRACE_ME, but wrongly misrouted other signals in vfork(2) use-cases. Add XXX comments about still existing problems and future enhancements: - correct vfork(2) + PT_TRACE_ME handling. - fork1(2) handling of scenarios when a process is collected in valid but rare cases. All ATF ptrace(2) fork[1-8] and vfork[1-8] tests pass. Fix PR kern/51630 by Kamil Rytarowski (myself). Sponsored by <The NetBSD Foundation>
2018-03-05Remove PT_GET_SIGMASK / PT_SET_SIGMASKkamil
These operations cloned Linux's specific PTRACE_GETSIGMASK / PTRACE_SETSIGMASK. This feature was useful in applications like rr/criu/reptyr-like, where the ptrace(2) interface is abused for the purpose of constructing an arbitrary process. It's not reliable and not portable. For the NetBSD case it will be better to invent something dedicated for serializing and deserializing a process with threads. Noted on tech-toolchain@ and blog entry "LLDB restoration and return to ptrace(2)" https://blog.netbsd.org/tnf/entry/lldb_restoration_and_return_to
2017-06-03Fix typo: s/interrput/interrupt/abhinav
2017-04-08Fix typo in previous (ptrace(2))kamil
2017-04-08Document new calls and be more clear about PT_SYSCALL* in ptrace(2)kamil
Document PT_SETSTEP and PT_CLEARSTEP in ptrace(2). Try to explain more details of PT_SYSCALL and PT_SYSCALLEMU. The description of PT_*STEP has been obtained from FreeBSD. Sponsored by <The NetBSD Foundation>
2017-04-07Fix typos and some grammarpgoyette
2017-04-07Correction in ptrace(2) about operations that emit signalskamil
PT_STEP and PT_DETACH cannot emit signals PT_CONTINUE and PT_SYSCALL can emit signals Pointed out by <chs>
2017-02-23Formatting fix.wiz
2017-02-23Document PT_GETDBREGS and PT_SETDBRGS in ptrace(2)kamil
Not this interface in MD part. Explain design choices. Sponsored by <The NetBSD Foundation>
2017-02-22Introduce new ptrace(2) API to allow/prevent exection of LWPkamil
Introduce new API for debuggers to allow/prevent execution of the specified thread. New ptrace(2) operations: PT_RESUME Allow execution of a specified thread, change its state from suspended to continued. The addr argument is unused. The data argument specifies the LWP ID. This call is equivalent to _lwp_continue(2) called by a traced process. This call does not change the general process state from stopped to continued. PT_SUSPEND Prevent execution of a specified thread, change its state from continued to suspended. The addr argument is unused. The data argument specifies the requested LWP ID. This call is equivalent to _lwp_suspend(2) called by a traced process. This call does not change the general process state from continued to stopped. This interface is modeled after FreeBSD, however with NetBSD specific arguments passed to ptrace(2) -- FreeBSD passes only thread id, NetBSD passes process and thread id. Extend PT_LWPINFO operation in ptrace(2) to report suspended threads. In the ptrace_lwpinfo structure in pl_event next to PL_EVENT_NONE and PL_EVENT_SIGNAL add new value PL_EVENT_SUSPENDED. Add new errno(2) value EDEADLK that might be returned by ptrace(2). It prevents dead-locking in a scenario of resuming a process or thread that is prevented from execution. This fixes bug that old API was vulnerable to this scenario. Kernel bump delayed till introduction of PT_GETDBREGS/PT_SETDBREGS soon. Add new ATF tests: - resume1 Verify that a thread can be suspended by a debugger and later resumed by the debugger - suspend1 Verify that a thread can be suspended by a debugger and later resumed by a tracee - suspend2 Verify that the while the only thread within a process is suspended, the whole process cannot be unstopped Sponsored by <The NetBSD Foundation>
2017-02-12Introduce new interface in ptrace(2) - PT_GET_SIGMASK and PT_SET_SIGMASKkamil
Add new interface to add ability to get/set signal mask of a tracee. It has been inspired by Linux PTRACE_GETSIGMASK and PTRACE_SETSIGMASK, but adapted for NetBSD API. This interface is used for checkpointing software to set/restore context of a process including signal mask like criu or just to track this property in reverse-execution software like Record and Replay Framework (rr). Add new ATF tests for this interface ==================================== getsigmask1: Verify that plain PT_SET_SIGMASK can be called getsigmask2: Verify that PT_SET_SIGMASK reports correct mask from tracee setsigmask1: Verify that plain PT_SET_SIGMASK can be called with empty mask setsigmask2: Verify that sigmask is preserved between PT_GET_SIGMASK and PT_SET_SIGMASK setsigmask3: Verify that sigmask is preserved between PT_GET_SIGMASK, process resumed and PT_SET_SIGMASK setsigmask4: Verify that new sigmask is visible in tracee Kernel ABI bump delayed as there are more interfaces to come in ptrace(2). Sponsored by <The NetBSD Foundation>
2017-01-27Spelling fixes.wiz
2017-01-25Make the PIOD_READ_AUXV operation more clearkamil
Describe how to set piod_offs. Sponsored by <The NetBSD Foundation>
2017-01-15Fix one markup issue and add initial HISTORY sectionkamil
Import HISTORY notes from FreeBSD. Sponsored by <The NetBSD Foundation>
2017-01-14Wording, macro use.wiz
2017-01-14Document PTRACE_LWP_CREATE and PTRACE_LWP_EXIT in ptrace(2)kamil
Sponsored by <The NetBSD Foundation>
2017-01-14Document PTRACE_VFORK and PTRACE_VFORK_DONE in ptrace(2)kamil
PTRACE_VFORK - report vfork(2)-like operations and trace child PTRACE_VFORK_DONE - report unblocking the parent after vfork(2)-like call Note that PTRACE_VFORK is currently unimplemented and returns ENOTSUP. Sponsored by <The NetBSD Foundation>
2017-01-11Correct man-page category of posix_spawn: is (3) not (2)kamil
2017-01-11Document SIGTRAP with si_code TRAP_CHLD in ptrace(2)kamil
Document the current behavior of TRAP_CHILD in NetBSD. Add more notes on PTRACE_FORK events. Sponsored by <The NetBSD Foundation>
2017-01-07Add more notes explaining how debuggers work on NetBSDkamil
Explain: - execve(2) handling and behavior, SIGTRAP & TRAP_EXEC - reference PaX MPROTECT restrictions for debuggers - software breakpoints handling and behavior, SIGTRAP & TRAP_BKPT - single step behavior, SIGTRAP & TRAP_TRACE - list predefined MI symbols for help debuggers in port specific headers - explain that PT_TRACE_ME does not send a SIGSTOP signal Sponsored by <The NetBSD Foundation>
2017-01-07Document PT_SET_SIGINFO and PT_GET_SIGINFO in ptrace(2)kamil
PT_SET_SIGINFO - fake signal information emitted to tracee PT_GET_SIGINFO - read signal information routed to tracee Sponsored by <The NetBSD Foundation>
2017-01-07Fix swapped text between PT_GET_PROCESS_STATE and PT_GET_EVENT_MASKkamil
Sponsored by <The NetBSD Foundation>
2017-01-07ptrace(2): Document addr and data argument usage for PT_GET_PROCESS_STATEkamil
The PT_GET_PROCESS_STATE call in ptrace(2) has the following usage of addr and data: A pointer to this structure is passed in addr. The data argument should be set to sizeof(struct ptrace_event). Sponsored by <The NetBSD Foundation>
2016-12-29Reference siginfo(2) for a SIGCHLD signalkamil
siginfo(2) describes appropriate signal specific information for SIGCHLD. Sponsored by <The NetBSD Foundation>
2016-12-19Be consistent in using process' (vs process's).abhinav
2016-12-15ptrace(2): Document PT_GETVECREGS and PT_SETVECREGS (ppc ports specific)kamil
Sponsored by <The NetBSD Foundation>
2016-12-15ptrace(2): Document PT_GETXMMREGS and PT_SETXMMREGS (i386 port specific)kamil
Sponsored by <The NetBSD Foundation>
2016-12-15ptrace(2): Remove dead text, some of it commented in this file for yearskamil
For example PT_READ_U/PT_WRITE_U has been removed by <mycroft> in 19950126. Sponsored by <The NetBSD Foundation>
2016-12-10Remove outdated note in the PT_DUMPCORE call of the ptrace(2) man-pagekamil
Currently the PT_DUMPCORE call requires process to be stopped, therefore it no longer need to warn about stoped tracee to generate consistent data. Sponsored by <The NetBSD Foundation>
2016-11-24Remove duplicated PT_DUMPCORE description in machine-specific calls sectionkamil
This function is part of the general ptrace(2) interface. Sponsored by <The NetBSD Foundation>
2016-11-01Bump date for previous.wiz
2016-11-01Document PT_SET_EVENT_MASK, PT_GET_EVENT_MASK and PT_GET_PROCESS_STATEkamil
These descriptions are imported from OpenBSD. Approved by <christos> Sponsored by <The NetBSD Foundation>
2015-07-02document PIOD_READ_AUXV.christos
2014-07-28PR/49045: Tetsuya Isaki: remove remaining caddr_t in ptrace(2)christos