Debian Codegraph @

tapset/linux/sysc_getppid.stp

raw
1 # getppid ____________________________________________________
2 # long sys_getppid(void)
3
4 @define _SYSCALL_GETPPID_NAME
5 %(
6 name = "getppid"
7 %)
8
9 @define _SYSCALL_GETPPID_ARGSTR
10 %(
11 argstr = ""
12 %)
13
14 probe syscall.getppid = dw_syscall.getppid !, nd_syscall.getppid ? {}
15 probe syscall.getppid.return = dw_syscall.getppid.return !,
16 nd_syscall.getppid.return ? {}
17
18 # dw_getppid _____________________________________________________
19
20 probe dw_syscall.getppid = kernel.function("sys_getppid").call
21 {
22 @_SYSCALL_GETPPID_NAME
23 @_SYSCALL_GETPPID_ARGSTR
24 }
25 probe dw_syscall.getppid.return = kernel.function("sys_getppid").return
26 {
27 @_SYSCALL_GETPPID_NAME
28 @SYSC_RETVALSTR($return)
29 }
30
31 # nd_getppid _____________________________________________________
32
33 probe nd_syscall.getppid = nd1_syscall.getppid!, nd2_syscall.getppid!, tp_syscall.getppid
34 { }
35
36 probe nd1_syscall.getppid = kprobe.function("sys_getppid")
37 {
38 @_SYSCALL_GETPPID_NAME
39 @_SYSCALL_GETPPID_ARGSTR
40 }
41
42 /* kernel 4.17+ */
43 probe nd2_syscall.getppid = kprobe.function(@arch_syscall0_prefix "sys_getppid") ?
44 {
45 @_SYSCALL_GETPPID_NAME
46 @_SYSCALL_GETPPID_ARGSTR
47 }
48
49 /* kernel 3.5+, but undesirable because it affects all syscalls */
50 probe tp_syscall.getppid = kernel.trace("sys_enter")
51 {
52 @__syscall_compat_gate(@const("__NR_getppid"), @const("__NR_compat_getppid"))
53 @_SYSCALL_GETPPID_NAME
54 @_SYSCALL_GETPPID_ARGSTR
55 }
56
57 probe nd_syscall.getppid.return = nd1_syscall.getppid.return!, nd2_syscall.getppid.return!, tp_syscall.getppid.return
58 { }
59
60 probe nd1_syscall.getppid.return = kprobe.function("sys_getppid").return
61 {
62 @_SYSCALL_GETPPID_NAME
63 @SYSC_RETVALSTR(returnval())
64 }
65
66 /* kernel 4.17+ */
67 probe nd2_syscall.getppid.return = kprobe.function(@arch_syscall0_prefix "sys_getppid").return ?
68 {
69 @_SYSCALL_GETPPID_NAME
70 @SYSC_RETVALSTR(returnval())
71 }
72
73 /* kernel 3.5+, but undesirable because it affects all syscalls */
74 probe tp_syscall.getppid.return = kernel.trace("sys_exit")
75 {
76 __set_syscall_pt_regs($regs)
77 @__syscall_compat_gate(@const("__NR_getppid"), @const("__NR_compat_getppid"))
78 @_SYSCALL_GETPPID_NAME
79 @SYSC_RETVALSTR($ret)
80 }