]> granicus.if.org Git - strace/blob - strace.1
Implement syscall fault injection
[strace] / strace.1
1 .\" Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
2 .\" Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
3 .\" Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. The name of the author may not be used to endorse or promote products
15 .\"    derived from this software without specific prior written permission.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .de CW
28 .sp
29 .nf
30 .ft CW
31 ..
32 .de CE
33 .ft R
34 .fi
35 .sp
36 ..
37 .\" Macro IX is not defined in the groff macros
38 .if \n(.g \{\
39 .  de IX
40 ..
41 .\}
42 .TH STRACE 1 "2010-03-30"
43 .SH NAME
44 strace \- trace system calls and signals
45 .SH SYNOPSIS
46 .B strace
47 [\fB-CdffhikqrtttTvVxxy\fR]
48 [\fB-I\fIn\fR]
49 [\fB-b\fIexecve\fR]
50 [\fB-e\fIexpr\fR]...
51 [\fB-a\fIcolumn\fR]
52 [\fB-o\fIfile\fR]
53 [\fB-s\fIstrsize\fR]
54 [\fB-P\fIpath\fR]... \fB-p\fIpid\fR... /
55 [\fB-D\fR]
56 [\fB-E\fIvar\fR[=\fIval\fR]]... [\fB-u\fIusername\fR]
57 \fIcommand\fR [\fIargs\fR]
58 .sp
59 .B strace
60 \fB-c\fR[\fBdf\fR]
61 [\fB-I\fIn\fR]
62 [\fB-b\fIexecve\fR]
63 [\fB-e\fIexpr\fR]...
64 [\fB-O\fIoverhead\fR]
65 [\fB-S\fIsortby\fR] \fB-p\fIpid\fR... /
66 [\fB-D\fR]
67 [\fB-E\fIvar\fR[=\fIval\fR]]... [\fB-u\fIusername\fR]
68 \fIcommand\fR [\fIargs\fR]
69 .SH DESCRIPTION
70 .IX "strace command" "" "\fLstrace\fR command"
71 .LP
72 In the simplest case
73 .B strace
74 runs the specified
75 .I command
76 until it exits.
77 It intercepts and records the system calls which are called
78 by a process and the signals which are received by a process.
79 The name of each system call, its arguments and its return value
80 are printed on standard error or to the file specified with the
81 .B \-o
82 option.
83 .LP
84 .B strace
85 is a useful diagnostic, instructional, and debugging tool.
86 System administrators, diagnosticians and trouble-shooters will find
87 it invaluable for solving problems with
88 programs for which the source is not readily available since
89 they do not need to be recompiled in order to trace them.
90 Students, hackers and the overly-curious will find that
91 a great deal can be learned about a system and its system calls by
92 tracing even ordinary programs.  And programmers will find that
93 since system calls and signals are events that happen at the user/kernel
94 interface, a close examination of this boundary is very
95 useful for bug isolation, sanity checking and
96 attempting to capture race conditions.
97 .LP
98 Each line in the trace contains the system call name, followed
99 by its arguments in parentheses and its return value.
100 An example from stracing the command "cat /dev/null" is:
101 .CW
102 open("/dev/null", O_RDONLY) = 3
103 .CE
104 Errors (typically a return value of \-1) have the errno symbol
105 and error string appended.
106 .CW
107 open("/foo/bar", O_RDONLY) = \-1 ENOENT (No such file or directory)
108 .CE
109 Signals are printed as signal symbol and decoded siginfo structure.
110 An excerpt from stracing and interrupting the command "sleep 666" is:
111 .CW
112 sigsuspend([] <unfinished ...>
113 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=...} ---
114 +++ killed by SIGINT +++
115 .CE
116 If a system call is being executed and meanwhile another one is being called
117 from a different thread/process then
118 .B strace
119 will try to preserve the order of those events and mark the ongoing call as
120 being
121 .IR unfinished .
122 When the call returns it will be marked as
123 .IR resumed .
124 .CW
125 [pid 28772] select(4, [3], NULL, NULL, NULL <unfinished ...>
126 [pid 28779] clock_gettime(CLOCK_REALTIME, {1130322148, 939977000}) = 0
127 [pid 28772] <... select resumed> )      = 1 (in [3])
128 .CE
129 Interruption of a (restartable) system call by a signal delivery is processed
130 differently as kernel terminates the system call and also arranges its
131 immediate reexecution after the signal handler completes.
132 .CW
133 read(0, 0x7ffff72cf5cf, 1)              = ? ERESTARTSYS (To be restarted)
134 --- SIGALRM ... ---
135 rt_sigreturn(0xe)                       = 0
136 read(0, "", 1)                          = 0
137 .CE
138 Arguments are printed in symbolic form with a passion.
139 This example shows the shell performing ">>xyzzy" output redirection:
140 .CW
141 open("xyzzy", O_WRONLY|O_APPEND|O_CREAT, 0666) = 3
142 .CE
143 Here the third argument of open is decoded by breaking down the
144 flag argument into its three bitwise-OR constituents and printing the
145 mode value in octal by tradition.  Where traditional or native
146 usage differs from ANSI or POSIX, the latter forms are preferred.
147 In some cases,
148 .B strace
149 output has proven to be more readable than the source.
150 .LP
151 Structure pointers are dereferenced and the members are displayed
152 as appropriate.  In all cases arguments are formatted in the most C-like
153 fashion possible.
154 For example, the essence of the command "ls \-l /dev/null" is captured as:
155 .CW
156 lstat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
157 .CE
158 Notice how the 'struct stat' argument is dereferenced and how each member is
159 displayed symbolically.  In particular, observe how the st_mode member
160 is carefully decoded into a bitwise-OR of symbolic and numeric values.
161 Also notice in this example that the first argument to lstat is an input
162 to the system call and the second argument is an output.  Since output
163 arguments are not modified if the system call fails, arguments may not
164 always be dereferenced.  For example, retrying the "ls \-l" example
165 with a non-existent file produces the following line:
166 .CW
167 lstat("/foo/bar", 0xb004) = \-1 ENOENT (No such file or directory)
168 .CE
169 In this case the porch light is on but nobody is home.
170 .LP
171 Character pointers are dereferenced and printed as C strings.
172 Non-printing characters in strings are normally represented by
173 ordinary C escape codes.
174 Only the first
175 .I strsize
176 (32 by default) bytes of strings are printed;
177 longer strings have an ellipsis appended following the closing quote.
178 Here is a line from "ls \-l" where the
179 .B getpwuid
180 library routine is reading the password file:
181 .CW
182 read(3, "root::0:0:System Administrator:/"..., 1024) = 422
183 .CE
184 While structures are annotated using curly braces, simple pointers
185 and arrays are printed using square brackets with commas separating
186 elements.  Here is an example from the command "id" on a system with
187 supplementary group ids:
188 .CW
189 getgroups(32, [100, 0]) = 2
190 .CE
191 On the other hand, bit-sets are also shown using square brackets
192 but set elements are separated only by a space.  Here is the shell
193 preparing to execute an external command:
194 .CW
195 sigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0
196 .CE
197 Here the second argument is a bit-set of two signals, SIGCHLD and SIGTTOU.
198 In some cases the bit-set is so full that printing out the unset
199 elements is more valuable.  In that case, the bit-set is prefixed by
200 a tilde like this:
201 .CW
202 sigprocmask(SIG_UNBLOCK, ~[], NULL) = 0
203 .CE
204 Here the second argument represents the full set of all signals.
205 .SH OPTIONS
206 .TP 12
207 .TP
208 .B \-c
209 Count time, calls, and errors for each system call and report a summary on
210 program exit.  On Linux, this attempts to show system time (CPU time spent
211 running in the kernel) independent of wall clock time.  If
212 .B \-c
213 is used with
214 .B \-f
215 or
216 .B \-F
217 (below), only aggregate totals for all traced processes are kept.
218 .TP
219 .B \-C
220 Like
221 .B \-c
222 but also print regular output while processes are running.
223 .TP
224 .B \-D
225 Run tracer process as a detached grandchild, not as parent of the
226 tracee.  This reduces the visible effect of
227 .B strace
228 by keeping the tracee a direct child of the calling process.
229 .TP
230 .B \-d
231 Show some debugging output of
232 .B strace
233 itself on the standard error.
234 .TP
235 .B \-f
236 Trace child processes as they are created by currently traced
237 processes as a result of the
238 .BR fork (2),
239 .BR vfork (2)
240 and
241 .BR clone (2)
242 system calls.  Note that
243 .B \-p
244 .I PID
245 .B \-f
246 will attach all threads of process PID if it is multi-threaded,
247 not only thread with thread_id = PID.
248 .TP
249 .B \-ff
250 If the
251 .B \-o
252 .I filename
253 option is in effect, each processes trace is written to
254 .I filename.pid
255 where pid is the numeric process id of each process.
256 This is incompatible with
257 .BR \-c ,
258 since no per-process counts are kept.
259 .TP
260 .B \-F
261 This option is now obsolete and it has the same functionality as
262 .BR \-f .
263 .TP
264 .B \-h
265 Print the help summary.
266 .TP
267 .B \-i
268 Print the instruction pointer at the time of the system call.
269 .TP
270 .B \-k
271 Print the execution stack trace of the traced processes after each system call (experimental).
272 This option is available only if
273 .B strace
274 is built with libunwind.
275 .TP
276 .B \-q
277 Suppress messages about attaching, detaching etc.  This happens
278 automatically when output is redirected to a file and the command
279 is run directly instead of attaching.
280 .TP
281 .B \-qq
282 If given twice, suppress messages about process exit status.
283 .TP
284 .B \-r
285 Print a relative timestamp upon entry to each system call.  This
286 records the time difference between the beginning of successive
287 system calls.
288 .TP
289 .B \-t
290 Prefix each line of the trace with the time of day.
291 .TP
292 .B \-tt
293 If given twice, the time printed will include the microseconds.
294 .TP
295 .B \-ttt
296 If given thrice, the time printed will include the microseconds
297 and the leading portion will be printed as the number
298 of seconds since the epoch.
299 .TP
300 .B \-T
301 Show the time spent in system calls.  This records the time
302 difference between the beginning and the end of each system call.
303 .TP
304 .B \-w
305 Summarise the time difference between the beginning and end of
306 each system call.  The default is to summarise the system time.
307 .TP
308 .B \-v
309 Print unabbreviated versions of environment, stat, termios, etc.
310 calls.  These structures are very common in calls and so the default
311 behavior displays a reasonable subset of structure members.  Use
312 this option to get all of the gory details.
313 .TP
314 .B \-V
315 Print the version number of
316 .BR strace .
317 .TP
318 .B \-x
319 Print all non-ASCII strings in hexadecimal string format.
320 .TP
321 .B \-xx
322 Print all strings in hexadecimal string format.
323 .TP
324 .B \-y
325 Print paths associated with file descriptor arguments.
326 .TP
327 .B \-yy
328 Print protocol specific information associated with socket file descriptors.
329 .TP
330 .BI "\-a " column
331 Align return values in a specific column (default column 40).
332 .TP
333 .BI "\-b " syscall
334 If specified syscall is reached, detach from traced process.
335 Currently, only
336 .I execve
337 syscall is supported.  This option is useful if you want to trace
338 multi-threaded process and therefore require -f, but don't want
339 to trace its (potentially very complex) children.
340 .TP
341 .BI "\-e " expr
342 A qualifying expression which modifies which events to trace
343 or how to trace them.  The format of the expression is:
344 .RS 15
345 .IP
346 [\,\fIqualifier\/\fB=\fR][\fB!\fR]\,\fIvalue1\/\fR[\fB,\,\fIvalue2\/\fR]...
347 .RE
348 .IP
349 where
350 .I qualifier
351 is one of
352 .BR trace ,
353 .BR abbrev ,
354 .BR verbose ,
355 .BR raw ,
356 .BR signal ,
357 .BR read ,
358 .BR write ,
359 or
360 .B fault
361 and
362 .I value
363 is a qualifier-dependent symbol or number.  The default
364 qualifier is
365 .BR trace .
366 Using an exclamation mark negates the set of values.  For example,
367 .BR \-e "\ " open
368 means literally
369 .BR \-e "\ " trace = open
370 which in turn means trace only the
371 .B open
372 system call.  By contrast,
373 .BR \-e "\ " trace "=!" open
374 means to trace every system call except
375 .BR open .
376 In addition, the special values
377 .B all
378 and
379 .B none
380 have the obvious meanings.
381 .IP
382 Note that some shells use the exclamation point for history
383 expansion even inside quoted arguments.  If so, you must escape
384 the exclamation point with a backslash.
385 .TP
386 \fB\-e\ trace\fR=\,\fIset\fR
387 Trace only the specified set of system calls.  The
388 .B \-c
389 option is useful for determining which system calls might be useful
390 to trace.  For example,
391 .BR trace = open,close,read,write
392 means to only
393 trace those four system calls.  Be careful when making inferences
394 about the user/kernel boundary if only a subset of system calls
395 are being monitored.  The default is
396 .BR trace = all .
397 .TP
398 .BR "\-e\ trace" = file
399 Trace all system calls which take a file name as an argument.  You
400 can think of this as an abbreviation for
401 .BR "\-e\ trace" = open , stat , chmod , unlink ,...
402 which is useful to seeing what files the process is referencing.
403 Furthermore, using the abbreviation will ensure that you don't
404 accidentally forget to include a call like
405 .B lstat
406 in the list.  Betchya woulda forgot that one.
407 .TP
408 .BR "\-e\ trace" = process
409 Trace all system calls which involve process management.  This
410 is useful for watching the fork, wait, and exec steps of a process.
411 .TP
412 .BR "\-e\ trace" = network
413 Trace all the network related system calls.
414 .TP
415 .BR "\-e\ trace" = signal
416 Trace all signal related system calls.
417 .TP
418 .BR "\-e\ trace" = ipc
419 Trace all IPC related system calls.
420 .TP
421 .BR "\-e\ trace" = desc
422 Trace all file descriptor related system calls.
423 .TP
424 .BR "\-e\ trace" = memory
425 Trace all memory mapping related system calls.
426 .TP
427 \fB\-e\ abbrev\fR=\,\fIset\fR
428 Abbreviate the output from printing each member of large structures.
429 The default is
430 .BR abbrev = all .
431 The
432 .B \-v
433 option has the effect of
434 .BR abbrev = none .
435 .TP
436 \fB\-e\ verbose\fR=\,\fIset\fR
437 Dereference structures for the specified set of system calls.  The
438 default is
439 .BR verbose = all .
440 .TP
441 \fB\-e\ raw\fR=\,\fIset\fR
442 Print raw, undecoded arguments for the specified set of system calls.
443 This option has the effect of causing all arguments to be printed
444 in hexadecimal.  This is mostly useful if you don't trust the
445 decoding or you need to know the actual numeric value of an
446 argument.
447 .TP
448 \fB\-e\ signal\fR=\,\fIset\fR
449 Trace only the specified subset of signals.  The default is
450 .BR signal = all .
451 For example,
452 .B signal "=!" SIGIO
453 (or
454 .BR signal "=!" io )
455 causes SIGIO signals not to be traced.
456 .TP
457 \fB\-e\ read\fR=\,\fIset\fR
458 Perform a full hexadecimal and ASCII dump of all the data read from
459 file descriptors listed in the specified set.  For example, to see
460 all input activity on file descriptors
461 .I 3
462 and
463 .I 5
464 use
465 \fB\-e\ read\fR=\,\fI3\fR,\fI5\fR.
466 Note that this is independent from the normal tracing of the
467 .BR read (2)
468 system call which is controlled by the option
469 .BR -e "\ " trace = read .
470 .TP
471 \fB\-e\ write\fR=\,\fIset\fR
472 Perform a full hexadecimal and ASCII dump of all the data written to
473 file descriptors listed in the specified set.  For example, to see
474 all output activity on file descriptors
475 .I 3
476 and
477 .I 5
478 use
479 \fB\-e\ write\fR=\,\fI3\fR,\,\fI5\fR.
480 Note that this is independent from the normal tracing of the
481 .BR write (2)
482 system call which is controlled by the option
483 .BR -e "\ " trace = write .
484 .TP
485 \fB\-e\ fault\fR=\,\fIset\/\fR[:\fBerror\fR=\,\fIerrno\/\fR][:\fBwhen\fR=\,\fIexpr\/\fR]
486 Perform a syscall fault injection for the specified set of syscalls.
487 When a fault is injected into a syscall invocation, the syscall number
488 is replaced by -1 which corresponds to an invalid syscall.
489
490 If an error code is specified using a symbolic
491 .I errno
492 value like
493 .B ENOSYS
494 or a numeric value within 1..4095 range, this error code overrides
495 the default error code returned by the kernel, which is traditionally
496 .B ENOSYS
497 for invalid syscall numbers on most architectures.
498
499 Unless a :\fBwhen\fR=\,\fIexpr\fR subexpression is specified,
500 a fault is injected into every invocation of each syscall from the
501 .IR set .
502
503 The format of the subexpression is one of the following:
504 .RS
505 .IP "" 2
506 .I first
507 .RS 4
508 For every syscall from the
509 .IR set ,
510 perform a syscall fault injection for the syscall invocation number
511 .I first
512 only.
513 .RE
514 .IP "" 2
515 \fIfirst\/\fB+\fR
516 .RS 4
517 For every syscall from the
518 .IR set ,
519 perform syscall fault injections for the syscall invocation number
520 .I first
521 and all subsequent invocations.
522 .RE
523 .IP "" 2
524 \fIfirst\/\fB+\fIstep\fR
525 .RS 4
526 For every syscall from the
527 .IR set ,
528 perform syscall fault injections for syscall invocations number
529 .IR first ,
530 .IR first + step ,
531 .IR first + step + step ,
532 and so on.
533 .RE
534 .RE
535 .IP
536 For example, to fail each third and subsequent chdir syscalls with
537 .BR ENOENT ,
538 use
539 \fB\-e\ fault\fR=\,\fIchdir\/\fR:\fBerror\fR=\,\fIENOENT\/\fR:\fBwhen\fR=\,\fI3\/\fB+\fR.
540
541 The valid range for numbers
542 .I first
543 and
544 .I step
545 is 1..65535.
546
547 If a fault expression contains multiple
548 .BR error =
549 specifications, the last one takes precedence.
550 Likewise, if a fault expression contains multiple
551 .BR when =
552 specifications, the last one takes precedence.
553
554 Accounting of syscalls that are subject to fault injection
555 is done per syscall and per tracee.
556
557 Specification of syscall fault injection can be combined
558 with other syscall filtering options, for example,
559 \fB\-P \fI/dev/urandom \fB\-e fault\fR=\,\fIall\/\fR:\fBerror\fR=\,\fIENOENT\fR.
560
561 .TP
562 .BI "\-I " interruptible
563 When strace can be interrupted by signals (such as pressing ^C).
564 1: no signals are blocked; 2: fatal signals are blocked while decoding syscall
565 (default); 3: fatal signals are always blocked (default if '-o FILE PROG');
566 4: fatal signals and SIGTSTP (^Z) are always blocked (useful to make
567 strace -o FILE PROG not stop on ^Z).
568 .TP
569 .BI "\-o " filename
570 Write the trace output to the file
571 .I filename
572 rather than to stderr.
573 Use
574 .I filename.pid
575 if
576 .B \-ff
577 is used.
578 If the argument begins with '|' or with '!' then the rest of the
579 argument is treated as a command and all output is piped to it.
580 This is convenient for piping the debugging output to a program
581 without affecting the redirections of executed programs.
582 .TP
583 .BI "\-O " overhead
584 Set the overhead for tracing system calls to
585 .I overhead
586 microseconds.
587 This is useful for overriding the default heuristic for guessing
588 how much time is spent in mere measuring when timing system calls using
589 the
590 .B \-c
591 option.  The accuracy of the heuristic can be gauged by timing a given
592 program run without tracing (using
593 .BR time (1))
594 and comparing the accumulated
595 system call time to the total produced using
596 .BR \-c .
597 .TP
598 .BI "\-p " pid
599 Attach to the process with the process
600 .SM ID
601 .I pid
602 and begin tracing.
603 The trace may be terminated
604 at any time by a keyboard interrupt signal (\c
605 .SM CTRL\s0-C).
606 .B strace
607 will respond by detaching itself from the traced process(es)
608 leaving it (them) to continue running.
609 Multiple
610 .B \-p
611 options can be used to attach to many processes in addition to
612 .I command
613 (which is optional if at least one
614 .B \-p
615 option is given).
616 .B \-p
617 "`pidof PROG`" syntax is supported.
618 .TP
619 .BI "\-P " path
620 Trace only system calls accessing
621 .IR path .
622 Multiple
623 .B \-P
624 options can be used to specify several paths.
625 .TP
626 .BI "\-s " strsize
627 Specify the maximum string size to print (the default is 32).  Note
628 that filenames are not considered strings and are always printed in
629 full.
630 .TP
631 .BI "\-S " sortby
632 Sort the output of the histogram printed by the
633 .B \-c
634 option by the specified criterion.  Legal values are
635 .BR time ,
636 .BR calls ,
637 .BR name ,
638 and
639 .B nothing
640 (default is
641 .BR time ).
642 .TP
643 .BI "\-u " username
644 Run command with the user \s-1ID\s0, group \s-2ID\s0, and
645 supplementary groups of
646 .IR username .
647 This option is only useful when running as root and enables the
648 correct execution of setuid and/or setgid binaries.
649 Unless this option is used setuid and setgid programs are executed
650 without effective privileges.
651 .TP
652 \fB\-E\ \fIvar\fR=\,\fIval\fR
653 Run command with
654 .IR var = val
655 in its list of environment variables.
656 .TP
657 .BI "\-E " var
658 Remove
659 .IR var
660 from the inherited list of environment variables before passing it on to
661 the command.
662 .SH DIAGNOSTICS
663 When
664 .I command
665 exits,
666 .B strace
667 exits with the same exit status.
668 If
669 .I command
670 is terminated by a signal,
671 .B strace
672 terminates itself with the same signal, so that
673 .B strace
674 can be used as a wrapper process transparent to the invoking parent process.
675 Note that parent-child relationship (signal stop notifications,
676 getppid() value, etc) between traced process and its parent are not preserved
677 unless
678 .B \-D
679 is used.
680 .LP
681 When using
682 .B \-p
683 without a
684 .IR command ,
685 the exit status of
686 .B strace
687 is zero unless no processes has been attached or there was an unexpected error
688 in doing the tracing.
689 .SH "SETUID INSTALLATION"
690 If
691 .B strace
692 is installed setuid to root then the invoking user will be able to
693 attach to and trace processes owned by any user.
694 In addition setuid and setgid programs will be executed and traced
695 with the correct effective privileges.
696 Since only users trusted with full root privileges should be allowed
697 to do these things,
698 it only makes sense to install
699 .B strace
700 as setuid to root when the users who can execute it are restricted
701 to those users who have this trust.
702 For example, it makes sense to install a special version of
703 .B strace
704 with mode 'rwsr-xr--', user
705 .B root
706 and group
707 .BR trace ,
708 where members of the
709 .B trace
710 group are trusted users.
711 If you do use this feature, please remember to install
712 a non-setuid version of
713 .B strace
714 for ordinary lusers to use.
715 .SH "SEE ALSO"
716 .BR ltrace (1),
717 .BR time (1),
718 .BR ptrace (2),
719 .BR proc (5)
720 .SH NOTES
721 It is a pity that so much tracing clutter is produced by systems
722 employing shared libraries.
723 .LP
724 It is instructive to think about system call inputs and outputs
725 as data-flow across the user/kernel boundary.  Because user-space
726 and kernel-space are separate and address-protected, it is
727 sometimes possible to make deductive inferences about process
728 behavior using inputs and outputs as propositions.
729 .LP
730 In some cases, a system call will differ from the documented behavior
731 or have a different name.  For example, on System V-derived systems
732 the true
733 .BR time (2)
734 system call does not take an argument and the
735 .B stat
736 function is called
737 .B xstat
738 and takes an extra leading argument.  These
739 discrepancies are normal but idiosyncratic characteristics of the
740 system call interface and are accounted for by C library wrapper
741 functions.
742 .LP
743 Some system calls have different names in different architectures and
744 personalities.  In these cases, system call filtering and printing
745 uses the names that match corresponding
746 .BR __NR_ *
747 kernel macros of the tracee's architecture and personality.
748 There are two exceptions from this general rule:
749 .BR arm_fadvise64_64 (2)
750 ARM syscall and
751 .BR xtensa_fadvise64_64 (2)
752 Xtensa syscall are filtered and printed as
753 .BR fadvise64_64 (2).
754 .LP
755 On some platforms a process that is attached to with the
756 .B \-p
757 option may observe a spurious EINTR return from the current
758 system call that is not restartable.  (Ideally, all system calls
759 should be restarted on strace attach, making the attach invisible
760 to the traced process, but a few system calls aren't.
761 Arguably, every instance of such behavior is a kernel bug.)
762 This may have an unpredictable effect on the process
763 if the process takes no action to restart the system call.
764 .SH BUGS
765 Programs that use the
766 .I setuid
767 bit do not have
768 effective user
769 .SM ID
770 privileges while being traced.
771 .LP
772 A traced process runs slowly.
773 .LP
774 Traced processes which are descended from
775 .I command
776 may be left running after an interrupt signal (\c
777 .SM CTRL\s0-C).
778 .LP
779 The
780 .B \-i
781 option is weakly supported.
782 .SH HISTORY
783 The original
784 .B strace
785 was written by Paul Kranenburg
786 for SunOS and was inspired by its trace utility.
787 The SunOS version of
788 .B strace
789 was ported to Linux and enhanced
790 by Branko Lankester, who also wrote the Linux kernel support.
791 Even though Paul released
792 .B strace
793 2.5 in 1992,
794 Branko's work was based on Paul's
795 .B strace
796 1.5 release from 1991.
797 In 1993, Rick Sladkey merged
798 .B strace
799 2.5 for SunOS and the second release of
800 .B strace
801 for Linux, added many of the features of
802 .BR truss (1)
803 from SVR4, and produced an
804 .B strace
805 that worked on both platforms.  In 1994 Rick ported
806 .B strace
807 to SVR4 and Solaris and wrote the
808 automatic configuration support.  In 1995 he ported
809 .B strace
810 to Irix
811 and tired of writing about himself in the third person.
812 .SH PROBLEMS
813 Problems with
814 .B strace
815 should be reported to the
816 .B strace
817 mailing list at <strace\-devel@lists.sourceforge.net>.