| 1 |
Examples of execsnoop-nd.stp, the Linux SystemTap version. |
| 2 |
|
| 3 |
|
| 4 |
This traces syscalls system-wide, and produces a summary report showing their |
| 5 |
counts by process ID, process name, and syscall type. For example: |
| 6 |
|
| 7 |
# ./syscallbypid-nd.stp |
| 8 |
Tracing syscall completions... Hit Ctrl-C to end. |
| 9 |
^C |
| 10 |
PID CMD SYSCALL COUNT |
| 11 |
4282 bash read 1 |
| 12 |
4283 bash ioctl 1 |
| 13 |
902 crond select 1 |
| 14 |
4283 bash setpgid 1 |
| 15 |
902 crond stat 1 |
| 16 |
4283 bash read 1 |
| 17 |
902 crond rt_sigaction 1 |
| 18 |
14409 bash stat 1 |
| 19 |
4279 stapio rt_sigreturn 1 |
| 20 |
4279 stapio pselect6 1 |
| 21 |
14564 sshd ioctl 1 |
| 22 |
4282 bash ioctl 1 |
| 23 |
4282 bash setpgid 1 |
| 24 |
4279 stapio write 1 |
| 25 |
4283 curl execve 1 |
| 26 |
4283 curl connect 1 |
| 27 |
4282 curl pipe 1 |
| 28 |
4282 curl set_tid_address 1 |
| 29 |
4283 curl setsockopt 1 |
| 30 |
4282 curl gettid 1 |
| 31 |
785 auditd gettimeofday 1 |
| 32 |
4282 curl ioctl 1 |
| 33 |
4282 curl getsockname 1 |
| 34 |
4282 curl rt_sigprocmask 1 |
| 35 |
4283 curl write 1 |
| 36 |
4046 syscallbypid-nd rt_sigprocmask 1 |
| 37 |
4279 stapio madvise 1 |
| 38 |
4283 curl statfs 1 |
| 39 |
4282 curl getsockopt 1 |
| 40 |
4283 curl bind 1 |
| 41 |
4283 curl getrlimit 1 |
| 42 |
4282 curl arch_prctl 1 |
| 43 |
4283 curl recvfrom 1 |
| 44 |
4282 curl connect 1 |
| 45 |
4282 curl execve 1 |
| 46 |
4279 stapio tgkill 1 |
| 47 |
4283 curl pipe 1 |
| 48 |
4283 curl set_tid_address 1 |
| 49 |
4282 curl setsockopt 1 |
| 50 |
4283 curl gettid 1 |
| 51 |
4283 curl ioctl 1 |
| 52 |
4282 curl write 1 |
| 53 |
4283 curl getsockname 1 |
| 54 |
4283 curl rt_sigprocmask 1 |
| 55 |
4283 curl getsockopt 1 |
| 56 |
4282 curl statfs 1 |
| 57 |
4282 curl getrlimit 1 |
| 58 |
4282 curl bind 1 |
| 59 |
4283 curl arch_prctl 1 |
| 60 |
4282 curl recvfrom 1 |
| 61 |
4279 stapio futex 1 |
| 62 |
4283 bash close 2 |
| 63 |
15216 node close 2 |
| 64 |
4282 bash close 2 |
| 65 |
15216 node write 2 |
| 66 |
14409 bash rt_sigreturn 2 |
| 67 |
902 crond rt_sigprocmask 2 |
| 68 |
14409 bash sendmsg 2 |
| 69 |
4282 curl sendto 2 |
| 70 |
4283 curl munmap 2 |
| 71 |
4282 curl access 2 |
| 72 |
4283 curl fcntl 2 |
| 73 |
14409 bash pipe 2 |
| 74 |
14409 bash clone 2 |
| 75 |
14409 bash setpgid 2 |
| 76 |
14409 bash socket 2 |
| 77 |
4283 curl sendto 2 |
| 78 |
4282 curl fcntl 2 |
| 79 |
4283 curl access 2 |
| 80 |
4282 curl munmap 2 |
| 81 |
785 auditd clock_gettime 2 |
| 82 |
14409 bash time 3 |
| 83 |
14564 sshd read 3 |
| 84 |
14564 sshd write 3 |
| 85 |
4283 bash rt_sigprocmask 3 |
| 86 |
902 crond read 3 |
| 87 |
902 crond fstat 3 |
| 88 |
902 crond munmap 3 |
| 89 |
902 crond open 3 |
| 90 |
4282 bash rt_sigprocmask 3 |
| 91 |
902 crond close 3 |
| 92 |
902 crond mmap2 3 |
| 93 |
902 crond time 3 |
| 94 |
4282 curl brk 3 |
| 95 |
4282 curl rt_sigaction 3 |
| 96 |
4282 curl recvmsg 3 |
| 97 |
4283 curl futex 3 |
| 98 |
4283 curl socket 3 |
| 99 |
4283 curl brk 3 |
| 100 |
15216 SignalSender futex 3 |
| 101 |
4283 curl rt_sigaction 3 |
| 102 |
4283 curl recvmsg 3 |
| 103 |
4282 curl futex 3 |
| 104 |
4282 curl socket 3 |
| 105 |
14409 bash wait4 4 |
| 106 |
15216 node accept4 4 |
| 107 |
15216 node futex 4 |
| 108 |
15216 node read 4 |
| 109 |
4279 stapio fcntl 4 |
| 110 |
4282 curl time 4 |
| 111 |
4283 curl time 4 |
| 112 |
14564 sshd select 5 |
| 113 |
15216 SignalSender nanosleep 5 |
| 114 |
4283 curl poll 5 |
| 115 |
4282 curl poll 5 |
| 116 |
15216 node epoll_wait 6 |
| 117 |
15216 node epoll_ctl 6 |
| 118 |
14409 bash close 6 |
| 119 |
4283 bash rt_sigaction 7 |
| 120 |
4282 bash rt_sigaction 7 |
| 121 |
14564 sshd rt_sigprocmask 12 |
| 122 |
14409 bash ioctl 20 |
| 123 |
14405 sshd ioctl 20 |
| 124 |
4282 curl clock_gettime 24 |
| 125 |
4283 curl clock_gettime 24 |
| 126 |
15216 node clock_gettime 26 |
| 127 |
14409 bash read 28 |
| 128 |
14409 bash write 29 |
| 129 |
4283 curl read 32 |
| 130 |
4282 curl read 32 |
| 131 |
4282 curl open 34 |
| 132 |
4283 curl fstat 34 |
| 133 |
4283 curl open 34 |
| 134 |
4282 curl fstat 34 |
| 135 |
4279 stapio ppoll 38 |
| 136 |
4282 curl close 38 |
| 137 |
4283 curl close 38 |
| 138 |
4279 stapio read 42 |
| 139 |
14409 bash rt_sigaction 48 |
| 140 |
14405 sshd write 49 |
| 141 |
14405 sshd read 49 |
| 142 |
4282 curl mprotect 58 |
| 143 |
4283 curl mprotect 58 |
| 144 |
4282 curl mmap2 91 |
| 145 |
4283 curl mmap2 91 |
| 146 |
14405 sshd select 97 |
| 147 |
14409 bash rt_sigprocmask 111 |
| 148 |
14405 sshd rt_sigprocmask 196 |
| 149 |
|
| 150 |
This can be used to get a handle on syscall usage and rates before using more |
| 151 |
expensive tools to measure their behavior. |
| 152 |
|
| 153 |
|
| 154 |
The output is limited to 2048 rows. If it exceeds that, for example, because |
| 155 |
of many short-lived processes each with their own PID, then you will see the |
| 156 |
following error: |
| 157 |
|
| 158 |
# ./syscallbypid-nd.stp |
| 159 |
Tracing syscall completions... Hit Ctrl-C to end. |
| 160 |
ERROR: Array overflow, check MAXMAPENTRIES near identifier 'num' at ./syscallbypid-nd.stp:32:2 |
| 161 |
WARNING: Number of errors: 1, skipped probes: 0 |
| 162 |
WARNING: /usr/local/bin/staprun exited with status: 1 |
| 163 |
Pass 5: run failed. [man error::pass5] |
| 164 |
|
| 165 |
See the oneliners.txt for probing syscalls without breaking down by PID to |
| 166 |
start with. |
| 167 |
|