PTRACE_GETREGS, PTRACE_SETGREFS, PTRACE_GETFPREGS,
and PTRACE_GETSPREGS are not present on all architectures.
PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP are present only
on x86.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=122383
Simon Paillard <spaillard@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Existing pages variously use "userspace or "user space".
But, "userspace" is not quite an English word.
So change "userspace" to "user space" or, when used
attributively, "user-space".
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
I didn't like ithe "SIGKILL operates similarly, with exceptions"
phrase (if it's different, then it's not "similar", right?),
and now I got around to changing it. Now it says simply:
"SIGKILL does not generate signal-delivery-stop and therefore
the tracer can't suppress it."
Replaced "why WNOHANG is not reliable" example with a more
realistic one (the one which actually inspired to add this
information to man page in the first place): we got
ESRCH - process is gone! - but waitpid(WNOHANG) can still
confusingly return 0 "no processes to wait for".
Replaced "This means that unneeded trailing arguments may
be omitted" part with a much better recommendation
to never do that and to supply zero arguments instead.
(The part about "undocumentedness" of gcc behavior was bogus,
btw - deleted).
Expanded BUGS section with the explanation and an example
of visible strace behavior on the buggy syscalls which
exit with EINTR on ptrace attach. I hope this will lead
to people submitting better bug reports to lkml about
such syscalls.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
SPARC reverses the use of 'addr' and 'data' for
PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_SETREGS,
and PTRACE_SETFPREGS.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
For some reason, the PTRACE_TRACEME paragraph talks about some
general aspects of ptraced process behavior. It repeats the
"tracee stops on every signal" information even though that was
already explained just a few paragraphs before. Then it describes
legacy SIGTRAP on execve().
This patch deletes the first part, and moves the second part up,
into the general ptrace description. It also adds
"If PTRACE_O_TRACEEXEC option is not in effect" to the description
of the legacy SIGTRAP on execve().
The patch also amends the part which says "For requests other
than PTRACE_KILL, the tracee must be stopped." - PTRACE_ATTACH
also doesn't require that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
* Wording and formatting fixes to existing text and
Denys Vlasenko's new text.
* Various technical amendments and improvements to
Denys Vlasenko's new text.
* Added FIXME for various problems with the current text.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Changes include:
s/parent/tracer/g, s/child/tracee/g - ptrace interface now
is sufficiently cleaned up to not treat tracing process
as parent.
Deleted several outright false statements:
- pid 1 can be traced
- tracer is not shown as parent in ps output
- PTRACE_ATTACH is not "the same behavior as if tracee had done
a PTRACE_TRACEME": PTRACE_ATTACH delivers a SIGSTOP.
- SIGSTOP _can_ be injected.
- Removed mentions of SunOS and Solaris as irrelevant.
- Added a few more known bugs.
Added a large block of text in DESCRIPTION which doesn't focus
on mechanical description of each flag and operation, but rather
tries to describe a bigger picture. The targeted audience is
a person which is reasonably knowledgeable in Unix but did not
spend years working with ptrace, and thus may be unaware of its
quirks. This text went through several iterations of review by
Oleg Nesterov and Tejun Heo.
This block of text intentionally uses as little markup as possible,
otherwise future modifications to it will be very hard to make.
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
These operations use the 'data' argument as a signal number,
like PTRACE_CONT.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Reported-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
is not in the normal signal delivery path. This means the parent
cannot do ptrace(PTRACE_CONT) with a signal or ptrace(PTRACE_KILL).
kill() with a SIGKILL signal can be used instead to kill the child
process after receiving one of these messages.
Paolo (Blaisorblade) Giarrusso, and Charles P. Wright;
after a suggestion from Heiko Carstens.
Document the following ptrace requests:
PTRACE_SETOPTIONS (2.4.6)
plus associated flags:
PTRACE_O_TRACESYSGOOD (2.4.6)
PTRACE_O_TRACEFORK (2.5.46)
PTRACE_O_TRACEVFORK (2.5.46)
PTRACE_O_TRACECLONE (2.5.46)
PTRACE_O_TRACEEXEC (2.5.46)
PTRACE_O_TRACEVFORKDONE (2.5.60)
PTRACE_O_TRACEEXIT (2.5.60)
PTRACE_SETSIGINFO (2.3.99-pre6)
PTRACE_GETSIGINFO (2.3.99-pre6)
PTRACE_GETEVENTMSG (2.5.46)
PTRACE_SYSEMU (since Linux 2.6.14)
PTRACE_SYSEMU_SINGLESTEP (since Linux 2.6.14)