ptrace.2: Minor fixes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2012-03-20 07:29:29 +13:00
parent f098951d39
commit a17e05c5e0
1 changed files with 18 additions and 20 deletions

View File

@ -46,7 +46,7 @@
.\" FIXME Linux 3.1 adds PTRACE_SEIZE, PTRACE_INTERRUPT, .\" FIXME Linux 3.1 adds PTRACE_SEIZE, PTRACE_INTERRUPT,
.\" and PTRACE_LISTEN. .\" and PTRACE_LISTEN.
.\" .\"
.TH PTRACE 2 2012-03-06 "Linux" "Linux Programmer's Manual" .TH PTRACE 2 2012-03-20 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
ptrace \- process trace ptrace \- process trace
.SH SYNOPSIS .SH SYNOPSIS
@ -553,13 +553,6 @@ Under Linux, a tracee can be detached in this way regardless
of which method was used to initiate tracing. of which method was used to initiate tracing.
.RI ( addr .RI ( addr
is ignored.) is ignored.)
.\"
.\" In the text below, we decided to avoid prettifying the text with markup:
.\" it would make the source nearly impossible to edit, and we _do_ intend
.\" to edit it often, in order to keep it updated:
.\" ptrace API is full of quirks, no need to compound this situation by
.\" making it excruciatingly painful to document them!
.\"
.SS Death under ptrace .SS Death under ptrace
When a (possibly multithreaded) process receives a killing signal When a (possibly multithreaded) process receives a killing signal
(one whose disposition is set to (one whose disposition is set to
@ -800,7 +793,7 @@ value: the tracer can cause a different signal to be injected.
Note that a suppressed signal still causes system calls to return Note that a suppressed signal still causes system calls to return
prematurely. prematurely.
In this case system calls will be restarted: the tracer will In this case system calls will be restarted: the tracer will
observe the tracee to re-execute interrupted system call (or observe the tracee to reexecute the interrupted system call (or
.BR restart_syscall(2) .BR restart_syscall(2)
system call for a few syscalls which use a different mechanism system call for a few syscalls which use a different mechanism
for restarting) if the tracer uses for restarting) if the tracer uses
@ -808,8 +801,8 @@ for restarting) if the tracer uses
Even system calls (such as Even system calls (such as
.BR poll(2) ) .BR poll(2) )
which are not restartable after signal are restarted after which are not restartable after signal are restarted after
signal is suppressed; however, kernel bugs exist which cause signal is suppressed;
some syscalls to fail with however, kernel bugs exist which cause some syscalls to fail with
.B EINTR .B EINTR
even though no observable signal is injected to the tracee. even though no observable signal is injected to the tracee.
.LP .LP
@ -1150,7 +1143,7 @@ But such detection is fragile and is best avoided.
.LP .LP
Using the Using the
.B PTRACE_O_TRACESYSGOOD .B PTRACE_O_TRACESYSGOOD
option is the recommended method to distinquish syscall-stops option is the recommended method to distinguish syscall-stops
from other kinds of ptrace-stops, from other kinds of ptrace-stops,
since it is reliable and does not incur a performance penalty. since it is reliable and does not incur a performance penalty.
.LP .LP
@ -1427,10 +1420,10 @@ If the thread group leader has reported its
stop by this time, stop by this time,
it appears to the tracer that it appears to the tracer that
the dead thread leader "reappears from nowhere". the dead thread leader "reappears from nowhere".
(Note: thread group leader does not report death via (Note: the thread group leader does not report death via
.I WIFEXITED(status) .I WIFEXITED(status)
until there is at least one other live thread. until there is at least one other live thread.
This eliminates possibility that tracer will see This eliminates the possibility that the tracer will see
it dying and then reappearing.) it dying and then reappearing.)
If the thread group leader was still alive, If the thread group leader was still alive,
for the tracer this may look as if thread group leader for the tracer this may look as if thread group leader
@ -1708,16 +1701,21 @@ This may be changed in the future;
is meant to always immediately kill tasks even under ptrace. is meant to always immediately kill tasks even under ptrace.
Last confirmed on 2.6.38.6. Last confirmed on 2.6.38.6.
.LP .LP
Some syscalls return with Some system calls return with
.B EINTR .B EINTR
if a signal was sent to a tracee, but delivery was suppressed if a signal was sent to a tracee, but delivery was suppressed by the tracer.
by the tracer. (This is very typical operation: it is usually (This is very typical operation: it is usually
done by debuggers on every attach, in order to not introduce done by debuggers on every attach, in order to not introduce
a bogus SIGSTOP). a bogus
As of linux 3.2.9, the following syscalls are affected: .BR SIGSTOP ).
As of Linux 3.2.9, the following system calls are affected
(this list is likely incomplete):
.BR epoll_wait (2), .BR epoll_wait (2),
and
.BR read (2) .BR read (2)
from inotify file descriptor. The list is likely incomplete. from an
.BR inotify (7)
file descriptor.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR gdb (1), .BR gdb (1),
.BR strace (1), .BR strace (1),