OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man2 / ptrace.2
1 .\" Copyright (c) 1993 Michael Haardt <michael@moria.de>
2 .\" Fri Apr  2 11:32:09 MET DST 1993
3 .\"
4 .\" and changes Copyright (C) 1999 Mike Coleman (mkc@acm.org)
5 .\" -- major revision to fully document ptrace semantics per recent Linux
6 .\"    kernel (2.2.10) and glibc (2.1.2)
7 .\" Sun Nov  7 03:18:35 CST 1999
8 .\"
9 .\" and Copyright (c) 2011, Denys Vlasenko <vda.linux@googlemail.com>
10 .\"
11 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
12 .\" This is free documentation; you can redistribute it and/or
13 .\" modify it under the terms of the GNU General Public License as
14 .\" published by the Free Software Foundation; either version 2 of
15 .\" the License, or (at your option) any later version.
16 .\"
17 .\" The GNU General Public License's references to "object code"
18 .\" and "executables" are to be interpreted as the output of any
19 .\" document formatting or typesetting system, including
20 .\" intermediate and printed output.
21 .\"
22 .\" This manual is distributed in the hope that it will be useful,
23 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
24 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 .\" GNU General Public License for more details.
26 .\"
27 .\" You should have received a copy of the GNU General Public
28 .\" License along with this manual; if not, see
29 .\" <http://www.gnu.org/licenses/>.
30 .\" %%%LICENSE_END
31 .\"
32 .\" Modified Fri Jul 23 23:47:18 1993 by Rik Faith <faith@cs.unc.edu>
33 .\" Modified Fri Jan 31 16:46:30 1997 by Eric S. Raymond <esr@thyrsus.com>
34 .\" Modified Thu Oct  7 17:28:49 1999 by Andries Brouwer <aeb@cwi.nl>
35 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
36 .\"     Added notes on capability requirements
37 .\"
38 .\" 2006-03-24, Chuck Ebbert <76306.1226@compuserve.com>
39 .\"    Added    PTRACE_SETOPTIONS, PTRACE_GETEVENTMSG, PTRACE_GETSIGINFO,
40 .\"        PTRACE_SETSIGINFO, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP
41 .\"    (Thanks to Blaisorblade, Daniel Jacobowitz and others who helped.)
42 .\" 2011-09, major update by Denys Vlasenko <vda.linux@googlemail.com>
43 .\"
44 .TH PTRACE 2 2014-02-20 "Linux" "Linux Programmer's Manual"
45 .SH NAME
46 ptrace \- process trace
47 .SH SYNOPSIS
48 .nf
49 .B #include <sys/ptrace.h>
50 .sp
51 .BI "long ptrace(enum __ptrace_request " request ", pid_t " pid ", "
52 .BI "            void *" addr ", void *" data );
53 .fi
54 .SH DESCRIPTION
55 The
56 .BR ptrace ()
57 system call provides a means by which one process (the "tracer")
58 may observe and control the execution of another process (the "tracee"),
59 and examine and change the tracee's memory and registers.
60 It is primarily used to implement breakpoint debugging and system
61 call tracing.
62 .LP
63 A tracee first needs to be attached to the tracer.
64 Attachment and subsequent commands are per thread:
65 in a multithreaded process,
66 every thread can be individually attached to a
67 (potentially different) tracer,
68 or left not attached and thus not debugged.
69 Therefore, "tracee" always means "(one) thread",
70 never "a (possibly multithreaded) process".
71 Ptrace commands are always sent to
72 a specific tracee using a call of the form
73
74     ptrace(PTRACE_foo, pid, ...)
75
76 where
77 .I pid
78 is the thread ID of the corresponding Linux thread.
79 .LP
80 (Note that in this page, a "multithreaded process"
81 means a thread group consisting of threads created using the
82 .BR clone (2)
83 .B CLONE_THREAD
84 flag.)
85 .LP
86 A process can initiate a trace by calling
87 .BR fork (2)
88 and having the resulting child do a
89 .BR PTRACE_TRACEME ,
90 followed (typically) by an
91 .BR execve (2).
92 Alternatively, one process may commence tracing another process using
93 .B PTRACE_ATTACH
94 or
95 .BR PTRACE_SEIZE .
96 .LP
97 While being traced, the tracee will stop each time a signal is delivered,
98 even if the signal is being ignored.
99 (An exception is
100 .BR SIGKILL ,
101 which has its usual effect.)
102 The tracer will be notified at its next call to
103 .BR waitpid (2)
104 (or one of the related "wait" system calls); that call will return a
105 .I status
106 value containing information that indicates
107 the cause of the stop in the tracee.
108 While the tracee is stopped,
109 the tracer can use various ptrace requests to inspect and modify the tracee.
110 The tracer then causes the tracee to continue,
111 optionally ignoring the delivered signal
112 (or even delivering a different signal instead).
113 .LP
114 If the
115 .B PTRACE_O_TRACEEXEC
116 option is not in effect, all successful calls to
117 .BR execve (2)
118 by the traced process will cause it to be sent a
119 .B SIGTRAP
120 signal,
121 giving the parent a chance to gain control before the new program
122 begins execution.
123 .LP
124 When the tracer is finished tracing, it can cause the tracee to continue
125 executing in a normal, untraced mode via
126 .BR PTRACE_DETACH .
127 .LP
128 The value of
129 .I request
130 determines the action to be performed:
131 .TP
132 .B PTRACE_TRACEME
133 Indicate that this process is to be traced by its parent.
134 A process probably shouldn't make this request if its parent
135 isn't expecting to trace it.
136 .RI ( pid ,
137 .IR addr ,
138 and
139 .IR data
140 are ignored.)
141 .IP
142 The
143 .B PTRACE_TRACEME
144 request is used only by the tracee;
145 the remaining requests are used only by the tracer.
146 In the following requests,
147 .I pid
148 specifies the thread ID of the tracee to be acted on.
149 For requests other than
150 .BR PTRACE_ATTACH ,
151 .BR PTRACE_SEIZE ,
152 .BR PTRACE_INTERRUPT ,
153 and
154 .BR PTRACE_KILL ,
155 the tracee must be stopped.
156 .TP
157 .BR PTRACE_PEEKTEXT ", " PTRACE_PEEKDATA
158 Read a word at the address
159 .I addr
160 in the tracee's memory, returning the word as the result of the
161 .BR ptrace ()
162 call.
163 Linux does not have separate text and data address spaces,
164 so these two requests are currently equivalent.
165 .RI ( data
166 is ignored; but see NOTES.)
167 .TP
168 .B PTRACE_PEEKUSER
169 .\" PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
170 .\" and that is the name that seems common on other systems.
171 Read a word at offset
172 .I addr
173 in the tracee's USER area,
174 which holds the registers and other information about the process
175 (see
176 .IR <sys/user.h> ).
177 The word is returned as the result of the
178 .BR ptrace ()
179 call.
180 Typically, the offset must be word-aligned, though this might vary by
181 architecture.
182 See NOTES.
183 .RI ( data
184 is ignored; but see NOTES.)
185 .TP
186 .BR PTRACE_POKETEXT ", " PTRACE_POKEDATA
187 Copy the word
188 .I data
189 to the address
190 .I addr
191 in the tracee's memory.
192 As for
193 .BR PTRACE_PEEKTEXT
194 and
195 .BR PTRACE_PEEKDATA ,
196 these two requests are currently equivalent.
197 .TP
198 .B PTRACE_POKEUSER
199 .\" PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
200 .\" and that is the name that seems common on other systems.
201 Copy the word
202 .I data
203 to offset
204 .I addr
205 in the tracee's USER area.
206 As for
207 .BR PTRACE_PEEKUSER ,
208 the offset must typically be word-aligned.
209 In order to maintain the integrity of the kernel,
210 some modifications to the USER area are disallowed.
211 .\" FIXME In the preceding sentence, which modifications are disallowed,
212 .\" and when they are disallowed, how does user space discover that fact?
213 .TP
214 .BR PTRACE_GETREGS ", " PTRACE_GETFPREGS
215 Copy the tracee's general-purpose or floating-point registers,
216 respectively, to the address
217 .I data
218 in the tracer.
219 See
220 .I <sys/user.h>
221 for information on the format of this data.
222 .RI ( addr
223 is ignored.)
224 Note that SPARC systems have the meaning of
225 .I data
226 and
227 .I addr
228 reversed; that is,
229 .I data
230 is ignored and the registers are copied to the address
231 .IR addr .
232 .B PTRACE_GETREGS
233 and
234 .B PTRACE_GETFPREGS
235 are not present on all architectures.
236 .TP
237 .BR PTRACE_GETREGSET " (since Linux 2.6.34)"
238 Read the tracee's registers.
239 .I addr
240 specifies, in an architecture-dependent way, the type of registers to be read.
241 .B NT_PRSTATUS
242 (with numerical value 1)
243 usually results in reading of general-purpose registers.
244 If the CPU has, for example,
245 floating-point and/or vector registers, they can be retrieved by setting
246 .I addr
247 to the corresponding
248 .B NT_foo
249 constant.
250 .I data
251 points to a
252 .BR "struct iovec" ,
253 which describes the destination buffer's location and length.
254 On return, the kernel modifies
255 .B iov.len
256 to indicate the actual number of bytes returned.
257 .TP
258 .BR PTRACE_SETREGS ", " PTRACE_SETFPREGS
259 Modify the tracee's general-purpose or floating-point registers,
260 respectively, from the address
261 .I data
262 in the tracer.
263 As for
264 .BR PTRACE_POKEUSER ,
265 some general-purpose register modifications may be disallowed.
266 .\" FIXME In the preceding sentence, which modifications are disallowed,
267 .\" and when they are disallowed, how does user space discover that fact?
268 .RI ( addr
269 is ignored.)
270 Note that SPARC systems have the meaning of
271 .I data
272 and
273 .I addr
274 reversed; that is,
275 .I data
276 is ignored and the registers are copied from the address
277 .IR addr .
278 .B PTRACE_SETREGS
279 and
280 .B PTRACE_SETFPREGS
281 are not present on all architectures.
282 .TP
283 .BR PTRACE_SETREGSET " (since Linux 2.6.34)"
284 Modify the tracee's registers.
285 The meaning of
286 .I addr
287 and
288 .I data
289 is analogous to
290 .BR PTRACE_GETREGSET .
291 .TP
292 .BR PTRACE_GETSIGINFO " (since Linux 2.3.99-pre6)"
293 Retrieve information about the signal that caused the stop.
294 Copy a
295 .I siginfo_t
296 structure (see
297 .BR sigaction (2))
298 from the tracee to the address
299 .I data
300 in the tracer.
301 .RI ( addr
302 is ignored.)
303 .TP
304 .BR PTRACE_SETSIGINFO " (since Linux 2.3.99-pre6)"
305 Set signal information:
306 copy a
307 .I siginfo_t
308 structure from the address
309 .I data
310 in the tracer to the tracee.
311 This will affect only signals that would normally be delivered to
312 the tracee and were caught by the tracer.
313 It may be difficult to tell
314 these normal signals from synthetic signals generated by
315 .BR ptrace ()
316 itself.
317 .RI ( addr
318 is ignored.)
319 .TP
320 .BR PTRACE_PEEKSIGINFO " (since Linux 3.10)"
321 .\" commit 84c751bd4aebbaae995fe32279d3dba48327bad4
322 Retrieve
323 .I siginfo_t
324 structures without removing signals from a queue.
325 .I addr
326 points to a
327 .I ptrace_peeksiginfo_args
328 structure that specifies the ordinal position from which
329 copying of signals should start,
330 and the number of signals to copy.
331 .I siginfo_t
332 structures are copied into the buffer pointed to by
333 .IR data .
334 The return value contains the number of copied signals (zero indicates
335 that there is no signal corresponding to the specified ordinal position).
336 Within the returned
337 .I siginfo
338 structures,
339 the
340 .IR si_code
341 field includes information
342 .RB ( __SI_CHLD ,
343 .BR __SI_FAULT ,
344 etc.) that are not otherwise exposed to user space.
345 .PP
346 .in +10n
347 .nf
348 struct ptrace_peeksiginfo_args {
349     u64 off;    /* Ordinal position in queue at which
350                    to start copying signals */
351     u32 flags;  /* PTRACE_PEEKSIGINFO_SHARED or 0 */
352     s32 nr;     /* Number of signals to copy */
353 };
354 .fi
355
356 Currently, there is only one flag,
357 .BR PTRACE_PEEKSIGINFO_SHARED ,
358 for dumping signals from the process-wide signal queue.
359 If this flag is not set,
360 signals are read from the per-thread queue of the specified thread.
361 .in
362 .PP
363 .TP
364 .BR PTRACE_GETSIGMASK " (since Linux 3.11)"
365 .\" commit 29000caecbe87b6b66f144f72111f0d02fbbf0c1
366 Place a copy of the mask of blocked signals (see
367 .BR sigprocmask (2))
368 in the buffer pointed to by
369 .IR data ,
370 which should be a pointer to a buffer of type
371 .IR sigset_t .
372 The
373 .I addr
374 argument contains the size of the buffer pointed to by
375 .IR data
376 (i.e.,
377 .IR sizeof(sigset_t) ).
378 .TP
379 .BR PTRACE_SETSIGMASK " (since Linux 3.11)"
380 Change the mask of blocked signals (see
381 .BR sigprocmask (2))
382 to the value specified in the buffer pointed to by
383 .IR data ,
384 which should be a pointer to a buffer of type
385 .IR sigset_t .
386 The
387 .I addr
388 argument contains the size of the buffer pointed to by
389 .IR data
390 (i.e.,
391 .IR sizeof(sigset_t) ).
392 .TP
393 .BR PTRACE_SETOPTIONS " (since Linux 2.4.6; see BUGS for caveats)"
394 Set ptrace options from
395 .IR data .
396 .RI ( addr
397 is ignored.)
398 .IR data
399 is interpreted as a bit mask of options,
400 which are specified by the following flags:
401 .RS
402 .TP
403 .BR PTRACE_O_EXITKILL " (since Linux 3.8)"
404 .\" commit 992fb6e170639b0849bace8e49bf31bd37c4123
405 If a tracer sets this flag, a
406 .B SIGKILL
407 signal will be sent to every tracee if the tracer exits.
408 This option is useful for ptrace jailers that
409 want to ensure that tracees can never escape the tracer's control.
410 .TP
411 .BR PTRACE_O_TRACECLONE " (since Linux 2.5.46)"
412 Stop the tracee at the next
413 .BR clone (2)
414 and automatically start tracing the newly cloned process,
415 which will start with a
416 .BR SIGSTOP ,
417 or
418 .B PTRACE_EVENT_STOP
419 if
420 .B PTRACE_SEIZE
421 was used.
422 A
423 .BR waitpid (2)
424 by the tracer will return a
425 .I status
426 value such that
427
428 .nf
429   status>>8 == (SIGTRAP | (PTRACE_EVENT_CLONE<<8))
430 .fi
431
432 The PID of the new process can be retrieved with
433 .BR PTRACE_GETEVENTMSG .
434 .IP
435 This option may not catch
436 .BR clone (2)
437 calls in all cases.
438 If the tracee calls
439 .BR clone (2)
440 with the
441 .B CLONE_VFORK
442 flag,
443 .B PTRACE_EVENT_VFORK
444 will be delivered instead
445 if
446 .B PTRACE_O_TRACEVFORK
447 is set; otherwise if the tracee calls
448 .BR clone (2)
449 with the exit signal set to
450 .BR SIGCHLD ,
451 .B PTRACE_EVENT_FORK
452 will be delivered if
453 .B PTRACE_O_TRACEFORK
454 is set.
455 .TP
456 .BR PTRACE_O_TRACEEXEC " (since Linux 2.5.46)"
457 Stop the tracee at the next
458 .BR execve (2).
459 A
460 .BR waitpid (2)
461 by the tracer will return a
462 .I status
463 value such that
464
465 .nf
466   status>>8 == (SIGTRAP | (PTRACE_EVENT_EXEC<<8))
467 .fi
468
469 If the execing thread is not a thread group leader,
470 the thread ID is reset to thread group leader's ID before this stop.
471 Since Linux 3.0, the former thread ID can be retrieved with
472 .BR PTRACE_GETEVENTMSG .
473 .TP
474 .BR PTRACE_O_TRACEEXIT " (since Linux 2.5.60)"
475 Stop the tracee at exit.
476 A
477 .BR waitpid (2)
478 by the tracer will return a
479 .I status
480 value such that
481
482 .nf
483   status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))
484 .fi
485
486 The tracee's exit status can be retrieved with
487 .BR PTRACE_GETEVENTMSG .
488 .IP
489 The tracee is stopped early during process exit,
490 when registers are still available,
491 allowing the tracer to see where the exit occurred,
492 whereas the normal exit notification is done after the process
493 is finished exiting.
494 Even though context is available,
495 the tracer cannot prevent the exit from happening at this point.
496 .TP
497 .BR PTRACE_O_TRACEFORK " (since Linux 2.5.46)"
498 Stop the tracee at the next
499 .BR fork (2)
500 and automatically start tracing the newly forked process,
501 which will start with a
502 .BR SIGSTOP ,
503 or
504 .B PTRACE_EVENT_STOP
505 if
506 .B PTRACE_SEIZE
507 was used.
508 A
509 .BR waitpid (2)
510 by the tracer will return a
511 .I status
512 value such that
513
514 .nf
515   status>>8 == (SIGTRAP | (PTRACE_EVENT_FORK<<8))
516 .fi
517
518 The PID of the new process can be retrieved with
519 .BR PTRACE_GETEVENTMSG .
520 .TP
521 .BR PTRACE_O_TRACESYSGOOD " (since Linux 2.4.6)"
522 When delivering system call traps, set bit 7 in the signal number
523 (i.e., deliver
524 .IR "SIGTRAP|0x80" ).
525 This makes it easy for the tracer to distinguish
526 normal traps from those caused by a system call.
527 .RB ( PTRACE_O_TRACESYSGOOD
528 may not work on all architectures.)
529 .TP
530 .BR PTRACE_O_TRACEVFORK " (since Linux 2.5.46)"
531 Stop the tracee at the next
532 .BR vfork (2)
533 and automatically start tracing the newly vforked process,
534 which will start with a
535 .BR SIGSTOP ,
536 or
537 .B PTRACE_EVENT_STOP
538 if
539 .B PTRACE_SEIZE
540 was used.
541 A
542 .BR waitpid (2)
543 by the tracer will return a
544 .I status
545 value such that
546
547 .nf
548   status>>8 == (SIGTRAP | (PTRACE_EVENT_VFORK<<8))
549 .fi
550
551 The PID of the new process can be retrieved with
552 .BR PTRACE_GETEVENTMSG .
553 .TP
554 .BR PTRACE_O_TRACEVFORKDONE " (since Linux 2.5.60)"
555 Stop the tracee at the completion of the next
556 .BR vfork (2).
557 A
558 .BR waitpid (2)
559 by the tracer will return a
560 .I status
561 value such that
562
563 .nf
564   status>>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONE<<8))
565 .fi
566
567 The PID of the new process can (since Linux 2.6.18) be retrieved with
568 .BR PTRACE_GETEVENTMSG .
569 .RE
570 .TP
571 .BR PTRACE_GETEVENTMSG " (since Linux 2.5.46)"
572 Retrieve a message (as an
573 .IR "unsigned long" )
574 about the ptrace event
575 that just happened, placing it at the address
576 .I data
577 in the tracer.
578 For
579 .BR PTRACE_EVENT_EXIT ,
580 this is the tracee's exit status.
581 For
582 .BR PTRACE_EVENT_FORK ,
583 .BR PTRACE_EVENT_VFORK ,
584 .BR PTRACE_EVENT_VFORK_DONE ,
585 and
586 .BR PTRACE_EVENT_CLONE ,
587 this is the PID of the new process.
588 .RI ( addr
589 is ignored.)
590 .TP
591 .B PTRACE_CONT
592 Restart the stopped tracee process.
593 If
594 .I data
595 is nonzero,
596 it is interpreted as the number of a signal to be delivered to the tracee;
597 otherwise, no signal is delivered.
598 Thus, for example, the tracer can control
599 whether a signal sent to the tracee is delivered or not.
600 .RI ( addr
601 is ignored.)
602 .TP
603 .BR PTRACE_SYSCALL ", " PTRACE_SINGLESTEP
604 Restart the stopped tracee as for
605 .BR PTRACE_CONT ,
606 but arrange for the tracee to be stopped at
607 the next entry to or exit from a system call,
608 or after execution of a single instruction, respectively.
609 (The tracee will also, as usual, be stopped upon receipt of a signal.)
610 From the tracer's perspective, the tracee will appear to have been
611 stopped by receipt of a
612 .BR SIGTRAP .
613 So, for
614 .BR PTRACE_SYSCALL ,
615 for example, the idea is to inspect
616 the arguments to the system call at the first stop,
617 then do another
618 .B PTRACE_SYSCALL
619 and inspect the return value of the system call at the second stop.
620 The
621 .I data
622 argument is treated as for
623 .BR PTRACE_CONT .
624 .RI ( addr
625 is ignored.)
626 .TP
627 .BR PTRACE_SYSEMU ", " PTRACE_SYSEMU_SINGLESTEP " (since Linux 2.6.14)"
628 For
629 .BR PTRACE_SYSEMU ,
630 continue and stop on entry to the next system call,
631 which will not be executed.
632 For
633 .BR PTRACE_SYSEMU_SINGLESTEP ,
634 do the same but also singlestep if not a system call.
635 This call is used by programs like
636 User Mode Linux that want to emulate all the tracee's system calls.
637 The
638 .I data
639 argument is treated as for
640 .BR PTRACE_CONT .
641 The
642 .I addr
643 argument is ignored.
644 These requests are currently
645 .\" As at 3.7
646 supported only on x86.
647 .TP
648 .BR PTRACE_LISTEN " (since Linux 3.4)"
649 Restart the stopped tracee, but prevent it from executing.
650 The resulting state of the tracee is similar to a process which
651 has been stopped by a
652 .B SIGSTOP
653 (or other stopping signal).
654 See the "group-stop" subsection for additional information.
655 .B PTRACE_LISTEN
656 works only on tracees attached by
657 .BR PTRACE_SEIZE .
658 .TP
659 .B PTRACE_KILL
660 Send the tracee a
661 .B SIGKILL
662 to terminate it.
663 .RI ( addr
664 and
665 .I data
666 are ignored.)
667 .IP
668 .I This operation is deprecated; do not use it!
669 Instead, send a
670 .BR SIGKILL
671 directly using
672 .BR kill (2)
673 or
674 .BR tgkill (2).
675 The problem with
676 .B PTRACE_KILL
677 is that it requires the tracee to be in signal-delivery-stop,
678 otherwise it may not work
679 (i.e., may complete successfully but won't kill the tracee).
680 By contrast, sending a
681 .B SIGKILL
682 directly has no such limitation.
683 .\" [Note from Denys Vlasenko:
684 .\"     deprecation suggested by Oleg Nesterov. He prefers to deprecate it
685 .\"     instead of describing (and needing to support) PTRACE_KILL's quirks.]
686 .TP
687 .BR PTRACE_INTERRUPT " (since Linux 3.4)"
688 Stop a tracee.
689 If the tracee is running or sleeping in kernel space and
690 .B PTRACE_SYSCALL
691 is in effect,
692 the system call is interrupted and syscall-exit-stop is reported.
693 (The interrupted system call is restarted when the tracee is restarted.)
694 If the tracee was already stopped by a signal and
695 .B PTRACE_LISTEN
696 was sent to it,
697 the tracee stops with
698 .B PTRACE_EVENT_STOP
699 and
700 .I WSTOPSIG(status)
701 returns the stop signal.
702 If any other ptrace-stop is generated at the same time (for example,
703 if a signal is sent to the tracee), this ptrace-stop happens.
704 If none of the above applies (for example, if the tracee is running in user
705 space), it stops with
706 .B PTRACE_EVENT_STOP
707 with
708 .I WSTOPSIG(status)
709 ==
710 .BR SIGTRAP .
711 .B PTRACE_INTERRUPT
712 only works on tracees attached by
713 .BR PTRACE_SEIZE .
714 .TP
715 .B PTRACE_ATTACH
716 Attach to the process specified in
717 .IR pid ,
718 making it a tracee of the calling process.
719 .\" No longer true (removed by Denys Vlasenko, 2011, who remarks:
720 .\"        "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
721 .\"         Basically, it's not true for any Linux in practical use.
722 .\" ; the behavior of the tracee is as if it had done a
723 .\" .BR PTRACE_TRACEME .
724 .\" The calling process actually becomes the parent of the tracee
725 .\" process for most purposes (e.g., it will receive
726 .\" notification of tracee events and appears in
727 .\" .BR ps (1)
728 .\" output as the tracee's parent), but a
729 .\" .BR getppid (2)
730 .\" by the tracee will still return the PID of the original parent.
731 The tracee is sent a
732 .BR SIGSTOP ,
733 but will not necessarily have stopped
734 by the completion of this call; use
735 .BR waitpid (2)
736 to wait for the tracee to stop.
737 See the "Attaching and detaching" subsection for additional information.
738 .RI ( addr
739 and
740 .I data
741 are ignored.)
742 .TP
743 .BR PTRACE_SEIZE " (since Linux 3.4)"
744 Attach to the process specified in
745 .IR pid ,
746 making it a tracee of the calling process.
747 Unlike
748 .BR PTRACE_ATTACH ,
749 .B PTRACE_SEIZE
750 does not stop the process.
751 Only a
752 .BR PTRACE_SEIZE d
753 process can accept
754 .B PTRACE_INTERRUPT
755 and
756 .B PTRACE_LISTEN
757 commands.
758 .I addr
759 must be zero.
760 .I data
761 contains a bit mask of ptrace options to activate immediately.
762 .TP
763 .B PTRACE_DETACH
764 Restart the stopped tracee as for
765 .BR PTRACE_CONT ,
766 but first detach from it.
767 Under Linux, a tracee can be detached in this way regardless
768 of which method was used to initiate tracing.
769 .RI ( addr
770 is ignored.)
771 .SS Death under ptrace
772 When a (possibly multithreaded) process receives a killing signal
773 (one whose disposition is set to
774 .B SIG_DFL
775 and whose default action is to kill the process),
776 all threads exit.
777 Tracees report their death to their tracer(s).
778 Notification of this event is delivered via
779 .BR waitpid (2).
780 .LP
781 Note that the killing signal will first cause signal-delivery-stop
782 (on one tracee only),
783 and only after it is injected by the tracer
784 (or after it was dispatched to a thread which isn't traced),
785 will death from the signal happen on
786 .I all
787 tracees within a multithreaded process.
788 (The term "signal-delivery-stop" is explained below.)
789 .LP
790 .B SIGKILL
791 does not generate signal-delivery-stop and
792 therefore the tracer can't suppress it.
793 .B SIGKILL
794 kills even within system calls
795 (syscall-exit-stop is not generated prior to death by
796 .BR SIGKILL ).
797 The net effect is that
798 .B SIGKILL
799 always kills the process (all its threads),
800 even if some threads of the process are ptraced.
801 .LP
802 When the tracee calls
803 .BR _exit (2),
804 it reports its death to its tracer.
805 Other threads are not affected.
806 .LP
807 When any thread executes
808 .BR exit_group (2),
809 every tracee in its thread group reports its death to its tracer.
810 .LP
811 If the
812 .B PTRACE_O_TRACEEXIT
813 option is on,
814 .B PTRACE_EVENT_EXIT
815 will happen before actual death.
816 This applies to exits via
817 .BR exit (2),
818 .BR exit_group (2),
819 and signal deaths (except
820 .BR SIGKILL ),
821 and when threads are torn down on
822 .BR execve (2)
823 in a multithreaded process.
824 .LP
825 The tracer cannot assume that the ptrace-stopped tracee exists.
826 There are many scenarios when the tracee may die while stopped (such as
827 .BR SIGKILL ).
828 Therefore, the tracer must be prepared to handle an
829 .B ESRCH
830 error on any ptrace operation.
831 Unfortunately, the same error is returned if the tracee
832 exists but is not ptrace-stopped
833 (for commands which require a stopped tracee),
834 or if it is not traced by the process which issued the ptrace call.
835 The tracer needs to keep track of the stopped/running state of the tracee,
836 and interpret
837 .B ESRCH
838 as "tracee died unexpectedly" only if it knows that the tracee has
839 been observed to enter ptrace-stop.
840 Note that there is no guarantee that
841 .I waitpid(WNOHANG)
842 will reliably report the tracee's death status if a
843 ptrace operation returned
844 .BR ESRCH .
845 .I waitpid(WNOHANG)
846 may return 0 instead.
847 In other words, the tracee may be "not yet fully dead",
848 but already refusing ptrace requests.
849 .LP
850 The tracer can't assume that the tracee
851 .I always
852 ends its life by reporting
853 .I WIFEXITED(status)
854 or
855 .IR WIFSIGNALED(status) ;
856 there are cases where this does not occur.
857 For example, if a thread other than thread group leader does an
858 .BR execve (2),
859 it disappears;
860 its PID will never be seen again,
861 and any subsequent ptrace stops will be reported under
862 the thread group leader's PID.
863 .SS Stopped states
864 A tracee can be in two states: running or stopped.
865 For the purposes of ptrace, a tracee which is blocked in a system call
866 (such as
867 .BR read (2),
868 .BR pause (2),
869 etc.)
870 is nevertheless considered to be running, even if the tracee is blocked
871 for a long time.
872 The state of the tracee after
873 .BR PTRACE_LISTEN
874 is somewhat of a gray area: it is not in any ptrace-stop (ptrace commands
875 won't work on it, and it will deliver
876 .BR waitpid (2)
877 notifications),
878 but it also may be considered "stopped" because
879 it is not executing instructions (is not scheduled), and if it was
880 in group-stop before
881 .BR PTRACE_LISTEN ,
882 it will not respond to signals until
883 .B SIGCONT
884 is received.
885 .LP
886 There are many kinds of states when the tracee is stopped, and in ptrace
887 discussions they are often conflated.
888 Therefore, it is important to use precise terms.
889 .LP
890 In this manual page, any stopped state in which the tracee is ready
891 to accept ptrace commands from the tracer is called
892 .IR ptrace-stop .
893 Ptrace-stops can
894 be further subdivided into
895 .IR signal-delivery-stop ,
896 .IR group-stop ,
897 .IR syscall-stop ,
898 and so on.
899 These stopped states are described in detail below.
900 .LP
901 When the running tracee enters ptrace-stop, it notifies its tracer using
902 .BR waitpid (2)
903 (or one of the other "wait" system calls).
904 Most of this manual page assumes that the tracer waits with:
905 .LP
906     pid = waitpid(pid_or_minus_1, &status, __WALL);
907 .LP
908 Ptrace-stopped tracees are reported as returns with
909 .I pid
910 greater than 0 and
911 .I WIFSTOPPED(status)
912 true.
913 .\" Denys Vlasenko:
914 .\"     Do we require __WALL usage, or will just using 0 be ok? (With 0,
915 .\"     I am not 100% sure there aren't ugly corner cases.) Are the
916 .\"     rules different if user wants to use waitid? Will waitid require
917 .\"     WEXITED?
918 .\"
919 .LP
920 The
921 .B __WALL
922 flag does not include the
923 .B WSTOPPED
924 and
925 .B WEXITED
926 flags, but implies their functionality.
927 .LP
928 Setting the
929 .B WCONTINUED
930 flag when calling
931 .BR waitpid (2)
932 is not recommended: the "continued" state is per-process and
933 consuming it can confuse the real parent of the tracee.
934 .LP
935 Use of the
936 .B WNOHANG
937 flag may cause
938 .BR waitpid (2)
939 to return 0 ("no wait results available yet")
940 even if the tracer knows there should be a notification.
941 Example:
942 .nf
943
944     errno = 0;
945     ptrace(PTRACE_CONT, pid, 0L, 0L);
946     if (errno == ESRCH) {
947         /* tracee is dead */
948         r = waitpid(tracee, &status, __WALL | WNOHANG);
949         /* r can still be 0 here! */
950     }
951 .fi
952 .\" FIXME:
953 .\"     waitid usage? WNOWAIT?
954 .\"     describe how wait notifications queue (or not queue)
955 .LP
956 The following kinds of ptrace-stops exist: signal-delivery-stops,
957 group-stops,
958 .B PTRACE_EVENT
959 stops, syscall-stops.
960 They all are reported by
961 .BR waitpid (2)
962 with
963 .I WIFSTOPPED(status)
964 true.
965 They may be differentiated by examining the value
966 .IR status>>8 ,
967 and if there is ambiguity in that value, by querying
968 .BR PTRACE_GETSIGINFO .
969 (Note: the
970 .I WSTOPSIG(status)
971 macro can't be used to perform this examination,
972 because it returns the value
973 .IR "(status>>8)\ &\ 0xff" .)
974 .SS Signal-delivery-stop
975 When a (possibly multithreaded) process receives any signal except
976 .BR SIGKILL ,
977 the kernel selects an arbitrary thread which handles the signal.
978 (If the signal is generated with
979 .BR tgkill (2),
980 the target thread can be explicitly selected by the caller.)
981 If the selected thread is traced, it enters signal-delivery-stop.
982 At this point, the signal is not yet delivered to the process,
983 and can be suppressed by the tracer.
984 If the tracer doesn't suppress the signal,
985 it passes the signal to the tracee in the next ptrace restart request.
986 This second step of signal delivery is called
987 .I "signal injection"
988 in this manual page.
989 Note that if the signal is blocked,
990 signal-delivery-stop doesn't happen until the signal is unblocked,
991 with the usual exception that
992 .B SIGSTOP
993 can't be blocked.
994 .LP
995 Signal-delivery-stop is observed by the tracer as
996 .BR waitpid (2)
997 returning with
998 .I WIFSTOPPED(status)
999 true, with the signal returned by
1000 .IR WSTOPSIG(status) .
1001 If the signal is
1002 .BR SIGTRAP ,
1003 this may be a different kind of ptrace-stop;
1004 see the "Syscall-stops" and "execve" sections below for details.
1005 If
1006 .I WSTOPSIG(status)
1007 returns a stopping signal, this may be a group-stop; see below.
1008 .SS Signal injection and suppression
1009 After signal-delivery-stop is observed by the tracer,
1010 the tracer should restart the tracee with the call
1011 .LP
1012     ptrace(PTRACE_restart, pid, 0, sig)
1013 .LP
1014 where
1015 .B PTRACE_restart
1016 is one of the restarting ptrace requests.
1017 If
1018 .I sig
1019 is 0, then a signal is not delivered.
1020 Otherwise, the signal
1021 .I sig
1022 is delivered.
1023 This operation is called
1024 .I "signal injection"
1025 in this manual page, to distinguish it from signal-delivery-stop.
1026 .LP
1027 The
1028 .I sig
1029 value may be different from the
1030 .I WSTOPSIG(status)
1031 value: the tracer can cause a different signal to be injected.
1032 .LP
1033 Note that a suppressed signal still causes system calls to return
1034 prematurely.
1035 In this case, system calls will be restarted: the tracer will
1036 observe the tracee to reexecute the interrupted system call (or
1037 .BR restart_syscall (2)
1038 system call for a few system calls which use a different mechanism
1039 for restarting) if the tracer uses
1040 .BR PTRACE_SYSCALL .
1041 Even system calls (such as
1042 .BR poll (2))
1043 which are not restartable after signal are restarted after
1044 signal is suppressed;
1045 however, kernel bugs exist which cause some system calls to fail with
1046 .B EINTR
1047 even though no observable signal is injected to the tracee.
1048 .LP
1049 Restarting ptrace commands issued in ptrace-stops other than
1050 signal-delivery-stop are not guaranteed to inject a signal, even if
1051 .I sig
1052 is nonzero.
1053 No error is reported; a nonzero
1054 .I sig
1055 may simply be ignored.
1056 Ptrace users should not try to "create a new signal" this way: use
1057 .BR tgkill (2)
1058 instead.
1059 .LP
1060 The fact that signal injection requests may be ignored
1061 when restarting the tracee after
1062 ptrace stops that are not signal-delivery-stops
1063 is a cause of confusion among ptrace users.
1064 One typical scenario is that the tracer observes group-stop,
1065 mistakes it for signal-delivery-stop, restarts the tracee with
1066
1067     ptrace(PTRACE_restart, pid, 0, stopsig)
1068
1069 with the intention of injecting
1070 .IR stopsig ,
1071 but
1072 .I stopsig
1073 gets ignored and the tracee continues to run.
1074 .LP
1075 The
1076 .B SIGCONT
1077 signal has a side effect of waking up (all threads of)
1078 a group-stopped process.
1079 This side effect happens before signal-delivery-stop.
1080 The tracer can't suppress this side effect (it can
1081 only suppress signal injection, which only causes the
1082 .BR SIGCONT
1083 handler to not be executed in the tracee, if such a handler is installed).
1084 In fact, waking up from group-stop may be followed by
1085 signal-delivery-stop for signal(s)
1086 .I other than
1087 .BR SIGCONT ,
1088 if they were pending when
1089 .B SIGCONT
1090 was delivered.
1091 In other words,
1092 .B SIGCONT
1093 may be not the first signal observed by the tracee after it was sent.
1094 .LP
1095 Stopping signals cause (all threads of) a process to enter group-stop.
1096 This side effect happens after signal injection, and therefore can be
1097 suppressed by the tracer.
1098 .LP
1099 In Linux 2.4 and earlier, the
1100 .B SIGSTOP
1101 signal can't be injected.
1102 .\" In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
1103 .\" there is:
1104 .\"
1105 .\"             /* The debugger continued.  Ignore SIGSTOP.  */
1106 .\"             if (signr == SIGSTOP)
1107 .\"                     continue;
1108 .LP
1109 .B PTRACE_GETSIGINFO
1110 can be used to retrieve a
1111 .I siginfo_t
1112 structure which corresponds to the delivered signal.
1113 .B PTRACE_SETSIGINFO
1114 may be used to modify it.
1115 If
1116 .B PTRACE_SETSIGINFO
1117 has been used to alter
1118 .IR siginfo_t ,
1119 the
1120 .I si_signo
1121 field and the
1122 .I sig
1123 parameter in the restarting command must match,
1124 otherwise the result is undefined.
1125 .SS Group-stop
1126 When a (possibly multithreaded) process receives a stopping signal,
1127 all threads stop.
1128 If some threads are traced, they enter a group-stop.
1129 Note that the stopping signal will first cause signal-delivery-stop
1130 (on one tracee only), and only after it is injected by the tracer
1131 (or after it was dispatched to a thread which isn't traced),
1132 will group-stop be initiated on
1133 .I all
1134 tracees within the multithreaded process.
1135 As usual, every tracee reports its group-stop separately
1136 to the corresponding tracer.
1137 .LP
1138 Group-stop is observed by the tracer as
1139 .BR waitpid (2)
1140 returning with
1141 .I WIFSTOPPED(status)
1142 true, with the stopping signal available via
1143 .IR WSTOPSIG(status) .
1144 The same result is returned by some other classes of ptrace-stops,
1145 therefore the recommended practice is to perform the call
1146 .LP
1147     ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)
1148 .LP
1149 The call can be avoided if the signal is not
1150 .BR SIGSTOP ,
1151 .BR SIGTSTP ,
1152 .BR SIGTTIN ,
1153 or
1154 .BR SIGTTOU ;
1155 only these four signals are stopping signals.
1156 If the tracer sees something else, it can't be a group-stop.
1157 Otherwise, the tracer needs to call
1158 .BR PTRACE_GETSIGINFO .
1159 If
1160 .B PTRACE_GETSIGINFO
1161 fails with
1162 .BR EINVAL ,
1163 then it is definitely a group-stop.
1164 (Other failure codes are possible, such as
1165 .B ESRCH
1166 ("no such process") if a
1167 .B SIGKILL
1168 killed the tracee.)
1169 .LP
1170 If tracee was attached using
1171 .BR PTRACE_SEIZE ,
1172 group-stop is indicated by
1173 .BR PTRACE_EVENT_STOP :
1174 .IR "status>>16 == PTRACE_EVENT_STOP" .
1175 This allows detection of group-stops
1176 without requiring an extra
1177 .B PTRACE_GETSIGINFO
1178 call.
1179 .LP
1180 As of Linux 2.6.38,
1181 after the tracer sees the tracee ptrace-stop and until it
1182 restarts or kills it, the tracee will not run,
1183 and will not send notifications (except
1184 .B SIGKILL
1185 death) to the tracer, even if the tracer enters into another
1186 .BR waitpid (2)
1187 call.
1188 .LP
1189 The kernel behavior described in the previous paragraph
1190 causes a problem with transparent handling of stopping signals.
1191 If the tracer restarts the tracee after group-stop,
1192 the stopping signal
1193 is effectively ignored\(emthe tracee doesn't remain stopped, it runs.
1194 If the tracer doesn't restart the tracee before entering into the next
1195 .BR waitpid (2),
1196 future
1197 .B SIGCONT
1198 signals will not be reported to the tracer;
1199 this would cause the
1200 .B SIGCONT
1201 signals to have no effect on the tracee.
1202 .LP
1203 Since Linux 3.4, there is a method to overcome this problem: instead of
1204 .BR PTRACE_CONT ,
1205 a
1206 .B PTRACE_LISTEN
1207 command can be used to restart a tracee in a way where it does not execute,
1208 but waits for a new event which it can report via
1209 .BR waitpid (2)
1210 (such as when
1211 it is restarted by a
1212 .BR SIGCONT ).
1213 .SS PTRACE_EVENT stops
1214 If the tracer sets
1215 .B PTRACE_O_TRACE_*
1216 options, the tracee will enter ptrace-stops called
1217 .B PTRACE_EVENT
1218 stops.
1219 .LP
1220 .B PTRACE_EVENT
1221 stops are observed by the tracer as
1222 .BR waitpid (2)
1223 returning with
1224 .IR WIFSTOPPED(status) ,
1225 and
1226 .I WSTOPSIG(status)
1227 returns
1228 .BR SIGTRAP .
1229 An additional bit is set in the higher byte of the status word:
1230 the value
1231 .I status>>8
1232 will be
1233
1234     (SIGTRAP | PTRACE_EVENT_foo << 8).
1235
1236 The following events exist:
1237 .TP
1238 .B PTRACE_EVENT_VFORK
1239 Stop before return from
1240 .BR vfork (2)
1241 or
1242 .BR clone (2)
1243 with the
1244 .B CLONE_VFORK
1245 flag.
1246 When the tracee is continued after this stop, it will wait for child to
1247 exit/exec before continuing its execution
1248 (in other words, the usual behavior on
1249 .BR vfork (2)).
1250 .TP
1251 .B PTRACE_EVENT_FORK
1252 Stop before return from
1253 .BR fork (2)
1254 or
1255 .BR clone (2)
1256 with the exit signal set to
1257 .BR SIGCHLD .
1258 .TP
1259 .B PTRACE_EVENT_CLONE
1260 Stop before return from
1261 .BR clone (2).
1262 .TP
1263 .B PTRACE_EVENT_VFORK_DONE
1264 Stop before return from
1265 .BR vfork (2)
1266 or
1267 .BR clone (2)
1268 with the
1269 .B CLONE_VFORK
1270 flag,
1271 but after the child unblocked this tracee by exiting or execing.
1272 .LP
1273 For all four stops described above,
1274 the stop occurs in the parent (i.e., the tracee),
1275 not in the newly created thread.
1276 .BR PTRACE_GETEVENTMSG
1277 can be used to retrieve the new thread's ID.
1278 .TP
1279 .B PTRACE_EVENT_EXEC
1280 Stop before return from
1281 .BR execve (2).
1282 Since Linux 3.0,
1283 .BR PTRACE_GETEVENTMSG
1284 returns the former thread ID.
1285 .TP
1286 .B PTRACE_EVENT_EXIT
1287 Stop before exit (including death from
1288 .BR exit_group (2)),
1289 signal death, or exit caused by
1290 .BR execve (2)
1291 in a multithreaded process.
1292 .B PTRACE_GETEVENTMSG
1293 returns the exit status.
1294 Registers can be examined
1295 (unlike when "real" exit happens).
1296 The tracee is still alive; it needs to be
1297 .BR PTRACE_CONT ed
1298 or
1299 .BR PTRACE_DETACH ed
1300 to finish exiting.
1301 .TP
1302 .B PTRACE_EVENT_STOP
1303 Stop induced by
1304 .B PTRACE_INTERRUPT
1305 command, or group-stop, or initial ptrace-stop when a new child is attached
1306 (only if attached using
1307 .BR PTRACE_SEIZE ),
1308 or
1309 .B PTRACE_EVENT_STOP
1310 if
1311 .B PTRACE_SEIZE
1312 was used.
1313 .LP
1314 .B PTRACE_GETSIGINFO
1315 on
1316 .B PTRACE_EVENT
1317 stops returns
1318 .B SIGTRAP
1319 in
1320 .IR si_signo ,
1321 with
1322 .I si_code
1323 set to
1324 .IR "(event<<8)\ |\ SIGTRAP" .
1325 .SS Syscall-stops
1326 If the tracee was restarted by
1327 .BR PTRACE_SYSCALL ,
1328 the tracee enters
1329 syscall-enter-stop just prior to entering any system call.
1330 If the tracer restarts the tracee with
1331 .BR PTRACE_SYSCALL ,
1332 the tracee enters syscall-exit-stop when the system call is finished,
1333 or if it is interrupted by a signal.
1334 (That is, signal-delivery-stop never happens between syscall-enter-stop
1335 and syscall-exit-stop; it happens
1336 .I after
1337 syscall-exit-stop.)
1338 .LP
1339 Other possibilities are that the tracee may stop in a
1340 .B PTRACE_EVENT
1341 stop, exit (if it entered
1342 .BR _exit (2)
1343 or
1344 .BR exit_group (2)),
1345 be killed by
1346 .BR SIGKILL ,
1347 or die silently (if it is a thread group leader, the
1348 .BR execve (2)
1349 happened in another thread,
1350 and that thread is not traced by the same tracer;
1351 this situation is discussed later).
1352 .LP
1353 Syscall-enter-stop and syscall-exit-stop are observed by the tracer as
1354 .BR waitpid (2)
1355 returning with
1356 .I WIFSTOPPED(status)
1357 true, and
1358 .I WSTOPSIG(status)
1359 giving
1360 .BR SIGTRAP .
1361 If the
1362 .B PTRACE_O_TRACESYSGOOD
1363 option was set by the tracer, then
1364 .I WSTOPSIG(status)
1365 will give the value
1366 .IR "(SIGTRAP\ |\ 0x80)" .
1367 .LP
1368 Syscall-stops can be distinguished from signal-delivery-stop with
1369 .B SIGTRAP
1370 by querying
1371 .BR PTRACE_GETSIGINFO
1372 for the following cases:
1373 .TP
1374 .IR si_code " <= 0"
1375 .B SIGTRAP
1376 was delivered as a result of a user-space action,
1377 for example, a system call
1378 .RB ( tgkill (2),
1379 .BR kill (2),
1380 .BR sigqueue (3),
1381 etc.),
1382 expiration of a POSIX timer,
1383 change of state on a POSIX message queue,
1384 or completion of an asynchronous I/O request.
1385 .TP
1386 .IR si_code " == SI_KERNEL (0x80)"
1387 .B SIGTRAP
1388 was sent by the kernel.
1389 .TP
1390 .IR si_code " == SIGTRAP or " si_code " == (SIGTRAP|0x80)"
1391 This is a syscall-stop.
1392 .LP
1393 However, syscall-stops happen very often (twice per system call),
1394 and performing
1395 .B PTRACE_GETSIGINFO
1396 for every syscall-stop may be somewhat expensive.
1397 .LP
1398 Some architectures allow the cases to be distinguished
1399 by examining registers.
1400 For example, on x86,
1401 .I rax
1402 ==
1403 .RB - ENOSYS
1404 in syscall-enter-stop.
1405 Since
1406 .B SIGTRAP
1407 (like any other signal) always happens
1408 .I after
1409 syscall-exit-stop,
1410 and at this point
1411 .I rax
1412 almost never contains
1413 .RB - ENOSYS ,
1414 the
1415 .B SIGTRAP
1416 looks like "syscall-stop which is not syscall-enter-stop";
1417 in other words, it looks like a
1418 "stray syscall-exit-stop" and can be detected this way.
1419 But such detection is fragile and is best avoided.
1420 .LP
1421 Using the
1422 .B PTRACE_O_TRACESYSGOOD
1423 option is the recommended method to distinguish syscall-stops
1424 from other kinds of ptrace-stops,
1425 since it is reliable and does not incur a performance penalty.
1426 .LP
1427 Syscall-enter-stop and syscall-exit-stop are
1428 indistinguishable from each other by the tracer.
1429 The tracer needs to keep track of the sequence of
1430 ptrace-stops in order to not misinterpret syscall-enter-stop as
1431 syscall-exit-stop or vice versa.
1432 The rule is that syscall-enter-stop is
1433 always followed by syscall-exit-stop,
1434 .B PTRACE_EVENT
1435 stop or the tracee's death;
1436 no other kinds of ptrace-stop can occur in between.
1437 .LP
1438 If after syscall-enter-stop,
1439 the tracer uses a restarting command other than
1440 .BR PTRACE_SYSCALL ,
1441 syscall-exit-stop is not generated.
1442 .LP
1443 .B PTRACE_GETSIGINFO
1444 on syscall-stops returns
1445 .B SIGTRAP
1446 in
1447 .IR si_signo ,
1448 with
1449 .I si_code
1450 set to
1451 .B SIGTRAP
1452 or
1453 .IR (SIGTRAP|0x80) .
1454 .SS PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops
1455 [Details of these kinds of stops are yet to be documented.]
1456 .\"
1457 .\" FIXME
1458 .\" document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
1459 .\" PTRACE_SYSEMU_SINGLESTEP
1460 .SS Informational and restarting ptrace commands
1461 Most ptrace commands (all except
1462 .BR PTRACE_ATTACH ,
1463 .BR PTRACE_SEIZE ,
1464 .BR PTRACE_TRACEME ,
1465 .BR PTRACE_INTERRUPT ,
1466 and
1467 .BR PTRACE_KILL )
1468 require the tracee to be in a ptrace-stop, otherwise they fail with
1469 .BR ESRCH .
1470 .LP
1471 When the tracee is in ptrace-stop,
1472 the tracer can read and write data to
1473 the tracee using informational commands.
1474 These commands leave the tracee in ptrace-stopped state:
1475 .LP
1476 .nf
1477     ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);
1478     ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);
1479     ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);
1480     ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);
1481     ptrace(PTRACE_GETREGSET, pid, NT_foo, &iov);
1482     ptrace(PTRACE_SETREGSET, pid, NT_foo, &iov);
1483     ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);
1484     ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);
1485     ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);
1486     ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);
1487 .fi
1488 .LP
1489 Note that some errors are not reported.
1490 For example, setting signal information
1491 .RI ( siginfo )
1492 may have no effect in some ptrace-stops, yet the call may succeed
1493 (return 0 and not set
1494 .IR errno );
1495 querying
1496 .B PTRACE_GETEVENTMSG
1497 may succeed and return some random value if current ptrace-stop
1498 is not documented as returning a meaningful event message.
1499 .LP
1500 The call
1501
1502     ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);
1503
1504 affects one tracee.
1505 The tracee's current flags are replaced.
1506 Flags are inherited by new tracees created and "auto-attached" via active
1507 .BR PTRACE_O_TRACEFORK ,
1508 .BR PTRACE_O_TRACEVFORK ,
1509 or
1510 .BR PTRACE_O_TRACECLONE
1511 options.
1512 .LP
1513 Another group of commands makes the ptrace-stopped tracee run.
1514 They have the form:
1515 .LP
1516     ptrace(cmd, pid, 0, sig);
1517 .LP
1518 where
1519 .I cmd
1520 is
1521 .BR PTRACE_CONT ,
1522 .BR PTRACE_LISTEN ,
1523 .BR PTRACE_DETACH ,
1524 .BR PTRACE_SYSCALL ,
1525 .BR PTRACE_SINGLESTEP ,
1526 .BR PTRACE_SYSEMU ,
1527 or
1528 .BR PTRACE_SYSEMU_SINGLESTEP .
1529 If the tracee is in signal-delivery-stop,
1530 .I sig
1531 is the signal to be injected (if it is nonzero).
1532 Otherwise,
1533 .I sig
1534 may be ignored.
1535 (When restarting a tracee from a ptrace-stop other than signal-delivery-stop,
1536 recommended practice is to always pass 0 in
1537 .IR sig .)
1538 .SS Attaching and detaching
1539 A thread can be attached to the tracer using the call
1540
1541     ptrace(PTRACE_ATTACH, pid, 0, 0);
1542
1543 or
1544
1545     ptrace(PTRACE_SEIZE, pid, 0, PTRACE_O_flags);
1546
1547 .B PTRACE_ATTACH
1548 sends
1549 .B SIGSTOP
1550 to this thread.
1551 If the tracer wants this
1552 .B SIGSTOP
1553 to have no effect, it needs to suppress it.
1554 Note that if other signals are concurrently sent to
1555 this thread during attach,
1556 the tracer may see the tracee enter signal-delivery-stop
1557 with other signal(s) first!
1558 The usual practice is to reinject these signals until
1559 .B SIGSTOP
1560 is seen, then suppress
1561 .B SIGSTOP
1562 injection.
1563 The design bug here is that a ptrace attach and a concurrently delivered
1564 .B SIGSTOP
1565 may race and the concurrent
1566 .B SIGSTOP
1567 may be lost.
1568 .\"
1569 .\" FIXME: Describe how to attach to a thread which is already
1570 .\"        group-stopped.
1571 .LP
1572 Since attaching sends
1573 .B SIGSTOP
1574 and the tracer usually suppresses it, this may cause a stray
1575 .B EINTR
1576 return from the currently executing system call in the tracee,
1577 as described in the "Signal injection and suppression" section.
1578 .LP
1579 Since Linux 3.4,
1580 .B PTRACE_SEIZE
1581 can be used instead of
1582 .BR PTRACE_ATTACH .
1583 .B PTRACE_SEIZE
1584 does not stop the attached process.
1585 If you need to stop
1586 it after attach (or at any other time) without sending it any signals,
1587 use
1588 .B PTRACE_INTERRUPT
1589 command.
1590 .LP
1591 The request
1592
1593     ptrace(PTRACE_TRACEME, 0, 0, 0);
1594
1595 turns the calling thread into a tracee.
1596 The thread continues to run (doesn't enter ptrace-stop).
1597 A common practice is to follow the
1598 .B PTRACE_TRACEME
1599 with
1600
1601     raise(SIGSTOP);
1602
1603 and allow the parent (which is our tracer now) to observe our
1604 signal-delivery-stop.
1605 .LP
1606 If the
1607 .BR PTRACE_O_TRACEFORK ,
1608 .BR PTRACE_O_TRACEVFORK ,
1609 or
1610 .BR PTRACE_O_TRACECLONE
1611 options are in effect, then children created by, respectively,
1612 .BR vfork (2)
1613 or
1614 .BR clone (2)
1615 with the
1616 .B CLONE_VFORK
1617 flag,
1618 .BR fork (2)
1619 or
1620 .BR clone (2)
1621 with the exit signal set to
1622 .BR SIGCHLD ,
1623 and other kinds of
1624 .BR clone (2),
1625 are automatically attached to the same tracer which traced their parent.
1626 .B SIGSTOP
1627 is delivered to the children, causing them to enter
1628 signal-delivery-stop after they exit the system call which created them.
1629 .LP
1630 Detaching of the tracee is performed by:
1631
1632     ptrace(PTRACE_DETACH, pid, 0, sig);
1633
1634 .B PTRACE_DETACH
1635 is a restarting operation;
1636 therefore it requires the tracee to be in ptrace-stop.
1637 If the tracee is in signal-delivery-stop, a signal can be injected.
1638 Otherwise, the
1639 .I sig
1640 parameter may be silently ignored.
1641 .LP
1642 If the tracee is running when the tracer wants to detach it,
1643 the usual solution is to send
1644 .B SIGSTOP
1645 (using
1646 .BR tgkill (2),
1647 to make sure it goes to the correct thread),
1648 wait for the tracee to stop in signal-delivery-stop for
1649 .B SIGSTOP
1650 and then detach it (suppressing
1651 .B SIGSTOP
1652 injection).
1653 A design bug is that this can race with concurrent
1654 .BR SIGSTOP s.
1655 Another complication is that the tracee may enter other ptrace-stops
1656 and needs to be restarted and waited for again, until
1657 .B SIGSTOP
1658 is seen.
1659 Yet another complication is to be sure that
1660 the tracee is not already ptrace-stopped,
1661 because no signal delivery happens while it is\(emnot even
1662 .BR SIGSTOP .
1663 .\" FIXME: Describe how to detach from a group-stopped tracee so that it
1664 .\"        doesn't run, but continues to wait for SIGCONT.
1665 .LP
1666 If the tracer dies, all tracees are automatically detached and restarted,
1667 unless they were in group-stop.
1668 Handling of restart from group-stop is currently buggy,
1669 but the "as planned" behavior is to leave tracee stopped and waiting for
1670 .BR SIGCONT .
1671 If the tracee is restarted from signal-delivery-stop,
1672 the pending signal is injected.
1673 .SS execve(2) under ptrace
1674 .\" clone(2) CLONE_THREAD says:
1675 .\"     If  any  of the threads in a thread group performs an execve(2),
1676 .\"     then all threads other than the thread group leader are terminated,
1677 .\"     and the new program is executed in the thread group leader.
1678 .\"
1679 When one thread in a multithreaded process calls
1680 .BR execve (2),
1681 the kernel destroys all other threads in the process,
1682 .\" In kernel 3.1 sources, see fs/exec.c::de_thread()
1683 and resets the thread ID of the execing thread to the
1684 thread group ID (process ID).
1685 (Or, to put things another way, when a multithreaded process does an
1686 .BR execve (2),
1687 at completion of the call, it appears as though the
1688 .BR execve (2)
1689 occurred in the thread group leader, regardless of which thread did the
1690 .BR execve (2).)
1691 This resetting of the thread ID looks very confusing to tracers:
1692 .IP * 3
1693 All other threads stop in
1694 .B PTRACE_EVENT_EXIT
1695 stop, if the
1696 .BR PTRACE_O_TRACEEXIT
1697 option was turned on.
1698 Then all other threads except the thread group leader report
1699 death as if they exited via
1700 .BR _exit (2)
1701 with exit code 0.
1702 .IP *
1703 The execing tracee changes its thread ID while it is in the
1704 .BR execve (2).
1705 (Remember, under ptrace, the "pid" returned from
1706 .BR waitpid (2),
1707 or fed into ptrace calls, is the tracee's thread ID.)
1708 That is, the tracee's thread ID is reset to be the same as its process ID,
1709 which is the same as the thread group leader's thread ID.
1710 .IP *
1711 Then a
1712 .B PTRACE_EVENT_EXEC
1713 stop happens, if the
1714 .BR PTRACE_O_TRACEEXEC
1715 option was turned on.
1716 .IP *
1717 If the thread group leader has reported its
1718 .B PTRACE_EVENT_EXIT
1719 stop by this time,
1720 it appears to the tracer that
1721 the dead thread leader "reappears from nowhere".
1722 (Note: the thread group leader does not report death via
1723 .I WIFEXITED(status)
1724 until there is at least one other live thread.
1725 This eliminates the possibility that the tracer will see
1726 it dying and then reappearing.)
1727 If the thread group leader was still alive,
1728 for the tracer this may look as if thread group leader
1729 returns from a different system call than it entered,
1730 or even "returned from a system call even though
1731 it was not in any system call".
1732 If the thread group leader was not traced
1733 (or was traced by a different tracer), then during
1734 .BR execve (2)
1735 it will appear as if it has become a tracee of
1736 the tracer of the execing tracee.
1737 .LP
1738 All of the above effects are the artifacts of
1739 the thread ID change in the tracee.
1740 .LP
1741 The
1742 .B PTRACE_O_TRACEEXEC
1743 option is the recommended tool for dealing with this situation.
1744 First, it enables
1745 .BR PTRACE_EVENT_EXEC
1746 stop,
1747 which occurs before
1748 .BR execve (2)
1749 returns.
1750 In this stop, the tracer can use
1751 .B PTRACE_GETEVENTMSG
1752 to retrieve the tracee's former thread ID.
1753 (This feature was introduced in Linux 3.0).
1754 Second, the
1755 .B PTRACE_O_TRACEEXEC
1756 option disables legacy
1757 .B SIGTRAP
1758 generation on
1759 .BR execve (2).
1760 .LP
1761 When the tracer receives
1762 .B PTRACE_EVENT_EXEC
1763 stop notification,
1764 it is guaranteed that except this tracee and the thread group leader,
1765 no other threads from the process are alive.
1766 .LP
1767 On receiving the
1768 .B PTRACE_EVENT_EXEC
1769 stop notification,
1770 the tracer should clean up all its internal
1771 data structures describing the threads of this process,
1772 and retain only one data structure\(emone which
1773 describes the single still running tracee, with
1774
1775     thread ID == thread group ID == process ID.
1776 .LP
1777 Example: two threads call
1778 .BR execve (2)
1779 at the same time:
1780 .LP
1781 .nf
1782 *** we get syscall-enter-stop in thread 1: **
1783 PID1 execve("/bin/foo", "foo" <unfinished ...>
1784 *** we issue PTRACE_SYSCALL for thread 1 **
1785 *** we get syscall-enter-stop in thread 2: **
1786 PID2 execve("/bin/bar", "bar" <unfinished ...>
1787 *** we issue PTRACE_SYSCALL for thread 2 **
1788 *** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **
1789 *** we get syscall-exit-stop for PID0: **
1790 PID0 <... execve resumed> )             = 0
1791 .fi
1792 .LP
1793 If the
1794 .B PTRACE_O_TRACEEXEC
1795 option is
1796 .I not
1797 in effect for the execing tracee, the kernel delivers an extra
1798 .B SIGTRAP
1799 to the tracee after
1800 .BR execve (2)
1801 returns.
1802 This is an ordinary signal (similar to one which can be
1803 generated by
1804 .IR "kill -TRAP" ),
1805 not a special kind of ptrace-stop.
1806 Employing
1807 .B PTRACE_GETSIGINFO
1808 for this signal returns
1809 .I si_code
1810 set to 0
1811 .RI ( SI_USER ).
1812 This signal may be blocked by signal mask,
1813 and thus may be delivered (much) later.
1814 .LP
1815 Usually, the tracer (for example,
1816 .BR strace (1))
1817 would not want to show this extra post-execve
1818 .B SIGTRAP
1819 signal to the user, and would suppress its delivery to the tracee (if
1820 .B SIGTRAP
1821 is set to
1822 .BR SIG_DFL ,
1823 it is a killing signal).
1824 However, determining
1825 .I which
1826 .B SIGTRAP
1827 to suppress is not easy.
1828 Setting the
1829 .B PTRACE_O_TRACEEXEC
1830 option and thus suppressing this extra
1831 .B SIGTRAP
1832 is the recommended approach.
1833 .SS Real parent
1834 The ptrace API (ab)uses the standard UNIX parent/child signaling over
1835 .BR waitpid (2).
1836 This used to cause the real parent of the process to stop receiving
1837 several kinds of
1838 .BR waitpid (2)
1839 notifications when the child process is traced by some other process.
1840 .LP
1841 Many of these bugs have been fixed, but as of Linux 2.6.38 several still
1842 exist; see BUGS below.
1843 .LP
1844 As of Linux 2.6.38, the following is believed to work correctly:
1845 .IP * 3
1846 exit/death by signal is reported first to the tracer, then,
1847 when the tracer consumes the
1848 .BR waitpid (2)
1849 result, to the real parent (to the real parent only when the
1850 whole multithreaded process exits).
1851 If the tracer and the real parent are the same process,
1852 the report is sent only once.
1853 .SH RETURN VALUE
1854 On success, the
1855 .B PTRACE_PEEK*
1856 requests return the requested data (but see NOTES),
1857 while other requests return zero.
1858 .LP
1859 On error, all requests return \-1, and
1860 .I errno
1861 is set appropriately.
1862 Since the value returned by a successful
1863 .B PTRACE_PEEK*
1864 request may be \-1, the caller must clear
1865 .I errno
1866 before the call, and then check it afterward
1867 to determine whether or not an error occurred.
1868 .SH ERRORS
1869 .TP
1870 .B EBUSY
1871 (i386 only) There was an error with allocating or freeing a debug register.
1872 .TP
1873 .B EFAULT
1874 There was an attempt to read from or write to an invalid area in
1875 the tracer's or the tracee's memory,
1876 probably because the area wasn't mapped or accessible.
1877 Unfortunately, under Linux, different variations of this fault
1878 will return
1879 .B EIO
1880 or
1881 .B EFAULT
1882 more or less arbitrarily.
1883 .TP
1884 .B EINVAL
1885 An attempt was made to set an invalid option.
1886 .TP
1887 .B EIO
1888 .I request
1889 is invalid, or an attempt was made to read from or
1890 write to an invalid area in the tracer's or the tracee's memory,
1891 or there was a word-alignment violation,
1892 or an invalid signal was specified during a restart request.
1893 .TP
1894 .B EPERM
1895 The specified process cannot be traced.
1896 This could be because the
1897 tracer has insufficient privileges (the required capability is
1898 .BR CAP_SYS_PTRACE );
1899 unprivileged processes cannot trace processes that they
1900 cannot send signals to or those running
1901 set-user-ID/set-group-ID programs, for obvious reasons.
1902 Alternatively, the process may already be being traced,
1903 or (on kernels before 2.6.26) be
1904 .BR init (8)
1905 (PID 1).
1906 .TP
1907 .B ESRCH
1908 The specified process does not exist, or is not currently being traced
1909 by the caller, or is not stopped
1910 (for requests that require a stopped tracee).
1911 .SH CONFORMING TO
1912 SVr4, 4.3BSD.
1913 .SH NOTES
1914 Although arguments to
1915 .BR ptrace ()
1916 are interpreted according to the prototype given,
1917 glibc currently declares
1918 .BR ptrace ()
1919 as a variadic function with only the
1920 .I request
1921 argument fixed.
1922 It is recommended to always supply four arguments,
1923 even if the requested operation does not use them,
1924 setting unused/ignored arguments to
1925 .I 0L
1926 or
1927 .IR "(void\ *)\ 0".
1928 .LP
1929 At the system call level, the
1930 .BR PTRACE_PEEKTEXT ,
1931 .BR PTRACE_PEEKDATA ,
1932 and
1933 .BR PTRACE_PEEKUSER
1934 requests have a different API: they store the result
1935 at the address specified by the
1936 .I data
1937 parameter, and the return value is the error flag.
1938 The glibc wrapper function provides the API given in DESCRIPTION above,
1939 with the result being returned via the function return value.
1940 .LP
1941 In Linux kernels before 2.6.26,
1942 .\" See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
1943 .BR init (8),
1944 the process with PID 1, may not be traced.
1945 .LP
1946 The layout of the contents of memory and the USER area are
1947 quite operating-system- and architecture-specific.
1948 The offset supplied, and the data returned,
1949 might not entirely match with the definition of
1950 .IR "struct user" .
1951 .\" See http://lkml.org/lkml/2008/5/8/375
1952 .LP
1953 The size of a "word" is determined by the operating-system variant
1954 (e.g., for 32-bit Linux it is 32 bits).
1955 .LP
1956 This page documents the way the
1957 .BR ptrace ()
1958 call works currently in Linux.
1959 Its behavior differs significantly on other flavors of UNIX.
1960 In any case, use of
1961 .BR ptrace ()
1962 is highly specific to the operating system and architecture.
1963 .SH BUGS
1964 On hosts with 2.6 kernel headers,
1965 .B PTRACE_SETOPTIONS
1966 is declared with a different value than the one for 2.4.
1967 This leads to applications compiled with 2.6 kernel
1968 headers failing when run on 2.4 kernels.
1969 This can be worked around by redefining
1970 .B PTRACE_SETOPTIONS
1971 to
1972 .BR PTRACE_OLDSETOPTIONS ,
1973 if that is defined.
1974 .LP
1975 Group-stop notifications are sent to the tracer, but not to real parent.
1976 Last confirmed on 2.6.38.6.
1977 .LP
1978 If a thread group leader is traced and exits by calling
1979 .BR _exit (2),
1980 .\" Note from Denys Vlasenko:
1981 .\"     Here "exits" means any kind of death - _exit, exit_group,
1982 .\"     signal death. Signal death and exit_group cases are trivial,
1983 .\"     though: since signal death and exit_group kill all other threads
1984 .\"     too, "until all other threads exit" thing happens rather soon
1985 .\"     in these cases. Therefore, only _exit presents observably
1986 .\"     puzzling behavior to ptrace users: thread leader _exit's,
1987 .\"     but WIFEXITED isn't reported! We are trying to explain here
1988 .\"     why it is so.
1989 a
1990 .B PTRACE_EVENT_EXIT
1991 stop will happen for it (if requested), but the subsequent
1992 .B WIFEXITED
1993 notification will not be delivered until all other threads exit.
1994 As explained above, if one of other threads calls
1995 .BR execve (2),
1996 the death of the thread group leader will
1997 .I never
1998 be reported.
1999 If the execed thread is not traced by this tracer,
2000 the tracer will never know that
2001 .BR execve (2)
2002 happened.
2003 One possible workaround is to
2004 .B PTRACE_DETACH
2005 the thread group leader instead of restarting it in this case.
2006 Last confirmed on 2.6.38.6.
2007 .\"  FIXME: ^^^ need to test/verify this scenario
2008 .LP
2009 A
2010 .B SIGKILL
2011 signal may still cause a
2012 .B PTRACE_EVENT_EXIT
2013 stop before actual signal death.
2014 This may be changed in the future;
2015 .B SIGKILL
2016 is meant to always immediately kill tasks even under ptrace.
2017 Last confirmed on 2.6.38.6.
2018 .LP
2019 Some system calls return with
2020 .B EINTR
2021 if a signal was sent to a tracee, but delivery was suppressed by the tracer.
2022 (This is very typical operation: it is usually
2023 done by debuggers on every attach, in order to not introduce
2024 a bogus
2025 .BR SIGSTOP ).
2026 As of Linux 3.2.9, the following system calls are affected
2027 (this list is likely incomplete):
2028 .BR epoll_wait (2),
2029 and
2030 .BR read (2)
2031 from an
2032 .BR inotify (7)
2033 file descriptor.
2034 The usual symptom of this bug is that when you attach to
2035 a quiescent process with the command
2036
2037     strace \-p <process-ID>
2038
2039 then, instead of the usual
2040 and expected one-line output such as
2041 .nf
2042
2043     restart_syscall(<... resuming interrupted call ...>_
2044
2045 .fi
2046 or
2047 .nf
2048
2049     select(6, [5], NULL, [5], NULL_
2050
2051 .fi
2052 ('_' denotes the cursor position), you observe more than one line.
2053 For example:
2054 .nf
2055
2056     clock_gettime(CLOCK_MONOTONIC, {15370, 690928118}) = 0
2057     epoll_wait(4,_
2058
2059 .fi
2060 What is not visible here is that the process was blocked in
2061 .BR epoll_wait (2)
2062 before
2063 .BR strace (1)
2064 has attached to it.
2065 Attaching caused
2066 .BR epoll_wait (2)
2067 to return to user space with the error
2068 .BR EINTR .
2069 In this particular case, the program reacted to
2070 .B EINTR
2071 by checking the current time, and then executing
2072 .BR epoll_wait (2)
2073 again.
2074 (Programs which do not expect such "stray"
2075 .BR EINTR
2076 errors may behave in an unintended way upon an
2077 .BR strace (1)
2078 attach.)
2079 .SH SEE ALSO
2080 .BR gdb (1),
2081 .BR strace (1),
2082 .BR clone (2),
2083 .BR execve (2),
2084 .BR fork (2),
2085 .BR gettid (2),
2086 .BR sigaction (2),
2087 .BR tgkill (2),
2088 .BR vfork (2),
2089 .BR waitpid (2),
2090 .BR exec (3),
2091 .BR capabilities (7),
2092 .BR signal (7)
2093 .SH COLOPHON
2094 This page is part of release 3.68 of the Linux
2095 .I man-pages
2096 project.
2097 A description of the project,
2098 information about reporting bugs,
2099 and the latest version of this page,
2100 can be found at
2101 \%http://www.kernel.org/doc/man\-pages/.