Debian Codegraph @

testsuite/systemtap.examples/process/noptrace.txt

raw
1 noptrace.stp - Disable ptrace from Hierarchies of Processes
2
3 Blocks ptrace(2) attempts from processes identified by stap -c/-x,
4 as also specifiable from /proc/systemtap/stap_XXX/ control files.
5 Processes may be added or removed from the blocked list.
6
7 ------------------------------------------------------------------------
8 Example: block ptrace(2) from a given subprocess hierarchy.
9
10 % echo $$
11 9898
12
13 (in other shell)
14 # stap -g noptrace.stp -x 9898 &
15
16 (in original shell)
17 % strace ls
18 strace: ptrace(PTRACE_TRACEME, ...): No such process
19 +++ exited with 1 +++
20
21 % bash # create a child process
22 bash-4.3$ strace ls
23 strace: ptrace(PTRACE_TRACEME, ...): No such process
24 +++ exited with 1 +++
25 bash-4.3$
26
27 ------------------------------------------------------------------------
28 Example: block ptrace(2) with a manually managed process list
29
30 % echo $$
31 8282
32
33 (in other shell)
34 # stap -g noptrace.stp &
35 # cd /proc/systemtap/stap_*
36 # cat blocked
37 [empty]
38 # echo 8282 > block
39
40 (in original shell)
41 % do stuff
42 % strace ls
43 [doesn't work]
44 % do more stuff
45
46 (in other shell)
47 # cat blocked # child processes
48 8282
49 8294
50 8322
51 8348
52
53 # echo 8282 > unblock
54
55 (in original shell)
56 % strace ls
57 [now works]