Debian Codegraph @

tapset/linux/sysc_getitimer.stp

raw
1 # getitimer __________________________________________________
2 # sys_getitimer(int which, struct itimerval __user *value)
3 #
4
5 @define _SYSCALL_GETITIMER_NAME
6 %(
7 name = "getitimer"
8 %)
9
10 @define _SYSCALL_GETITIMER_ARGSTR
11 %(
12 argstr = sprintf("%s, %p", _itimer_which_str(which), value_uaddr)
13 %)
14
15 @define _SYSCALL_GETITIMER_REGARGS
16 %(
17 which = int_arg(1)
18 value_uaddr = pointer_arg(2)
19 %)
20 @define _SYSCALL_GETITIMER_REGARGS_STORE
21 %(
22 if (@probewrite(which))
23 set_int_arg(1, which)
24
25 if (@probewrite(value_uaddr))
26 set_pointer_arg(2, value_uaddr)
27 %)
28
29 probe syscall.getitimer = dw_syscall.getitimer !, nd_syscall.getitimer ? {}
30 probe syscall.getitimer.return = dw_syscall.getitimer.return !,
31 nd_syscall.getitimer.return ? {}
32
33 probe syscall.compat_getitimer = dw_syscall.compat_getitimer !,
34 nd_syscall.compat_getitimer ? {}
35 probe syscall.compat_getitimer.return = dw_syscall.compat_getitimer.return !,
36 nd_syscall.compat_getitimer.return ? {}
37
38 # dw_getitimer _____________________________________________________
39
40 probe dw_syscall.getitimer = kernel.function("sys_getitimer").call
41 {
42 @_SYSCALL_GETITIMER_NAME
43 which = __int32($which)
44 value_uaddr = $value
45 @_SYSCALL_GETITIMER_ARGSTR
46 }
47 probe dw_syscall.getitimer.return = kernel.function("sys_getitimer").return
48 {
49 @_SYSCALL_GETITIMER_NAME
50 @SYSC_RETVALSTR($return)
51 }
52 # long compat_sys_getitimer(int which, struct compat_itimerval __user *it
53 probe dw_syscall.compat_getitimer = kernel.function("compat_sys_getitimer").call ?
54 {
55 @_SYSCALL_GETITIMER_NAME
56 which = __int32($which)
57 value_uaddr = @__pointer($it)
58 @_SYSCALL_GETITIMER_ARGSTR
59 }
60 probe dw_syscall.compat_getitimer.return = kernel.function("compat_sys_getitimer").return ?
61 {
62 @_SYSCALL_GETITIMER_NAME
63 @SYSC_RETVALSTR($return)
64 }
65
66 # nd_getitimer _____________________________________________________
67
68 probe nd_syscall.getitimer = nd1_syscall.getitimer!, nd2_syscall.getitimer!, tp_syscall.getitimer
69 { }
70
71 probe nd1_syscall.getitimer = kprobe.function("sys_getitimer") ?
72 {
73 @_SYSCALL_GETITIMER_NAME
74 asmlinkage()
75 @_SYSCALL_GETITIMER_REGARGS
76 @_SYSCALL_GETITIMER_ARGSTR
77 }
78
79 /* kernel 4.17+ */
80 probe nd2_syscall.getitimer = kprobe.function(@arch_syscall_prefix "sys_getitimer") ?
81 {
82 __set_syscall_pt_regs(pointer_arg(1))
83 @_SYSCALL_GETITIMER_NAME
84 @_SYSCALL_GETITIMER_REGARGS
85 @_SYSCALL_GETITIMER_ARGSTR
86 },
87 {
88 @_SYSCALL_GETITIMER_REGARGS_STORE
89 }
90
91 /* kernel 3.5+, but undesirable because it affects all syscalls */
92 probe tp_syscall.getitimer = kernel.trace("sys_enter")
93 {
94 __set_syscall_pt_regs($regs)
95 @__syscall_gate(@const("__NR_getitimer"))
96 @_SYSCALL_GETITIMER_NAME
97 @_SYSCALL_GETITIMER_REGARGS
98 @_SYSCALL_GETITIMER_ARGSTR
99 },
100 {
101 @_SYSCALL_GETITIMER_REGARGS_STORE
102 }
103
104 probe nd_syscall.getitimer.return = nd1_syscall.getitimer.return!, nd2_syscall.getitimer.return!, tp_syscall.getitimer.return
105 { }
106
107 probe nd1_syscall.getitimer.return = kprobe.function("sys_getitimer").return ?
108 {
109 @_SYSCALL_GETITIMER_NAME
110 @SYSC_RETVALSTR(returnval())
111 }
112
113 /* kernel 4.17+ */
114 probe nd2_syscall.getitimer.return = kprobe.function(@arch_syscall_prefix "sys_getitimer").return ?
115 {
116 @_SYSCALL_GETITIMER_NAME
117 @SYSC_RETVALSTR(returnval())
118 }
119
120 /* kernel 3.5+, but undesirable because it affects all syscalls */
121 probe tp_syscall.getitimer.return = kernel.trace("sys_exit")
122 {
123 __set_syscall_pt_regs($regs)
124 @__syscall_gate(@const("__NR_getitimer"))
125 @_SYSCALL_GETITIMER_NAME
126 @SYSC_RETVALSTR($ret)
127 }
128
129 # long compat_sys_getitimer(int which, struct compat_itimerval __user *it
130
131 probe nd_syscall.compat_getitimer = nd1_syscall.compat_getitimer!, nd2_syscall.compat_getitimer!, tp_syscall.compat_getitimer
132 { }
133
134 probe nd1_syscall.compat_getitimer = kprobe.function("compat_sys_getitimer") ?
135 {
136 @_SYSCALL_GETITIMER_NAME
137 asmlinkage()
138 which = int_arg(1)
139 value_uaddr = pointer_arg(2)
140 @_SYSCALL_GETITIMER_ARGSTR
141 }
142
143 /* kernel 4.17+ */
144 probe nd2_syscall.compat_getitimer = kprobe.function(@arch_syscall_prefix "compat_sys_getitimer") ?
145 {
146 __set_syscall_pt_regs(pointer_arg(1))
147 @_SYSCALL_GETITIMER_NAME
148 @_SYSCALL_GETITIMER_REGARGS
149 @_SYSCALL_GETITIMER_ARGSTR
150 },
151 {
152 @_SYSCALL_GETITIMER_REGARGS_STORE
153 }
154
155 /* kernel 3.5+, but undesirable because it affects all syscalls */
156 probe tp_syscall.compat_getitimer = kernel.trace("sys_enter")
157 {
158 __set_syscall_pt_regs($regs)
159 @__compat_syscall_gate(@const("__NR_compat_getitimer"))
160 @_SYSCALL_GETITIMER_NAME
161 @_SYSCALL_GETITIMER_REGARGS
162 @_SYSCALL_GETITIMER_ARGSTR
163 },
164 {
165 @_SYSCALL_GETITIMER_REGARGS_STORE
166 }
167
168 probe nd_syscall.compat_getitimer.return = nd1_syscall.compat_getitimer.return!, nd2_syscall.compat_getitimer.return!, tp_syscall.compat_getitimer.return
169 { }
170
171 probe nd1_syscall.compat_getitimer.return = kprobe.function("compat_sys_getitimer").return ?
172 {
173 @_SYSCALL_GETITIMER_NAME
174 @SYSC_RETVALSTR(returnval())
175 }
176
177 /* kernel 4.17+ */
178 probe nd2_syscall.compat_getitimer.return = kprobe.function(@arch_syscall_prefix "compat_sys_getitimer").return ?
179 {
180 @_SYSCALL_GETITIMER_NAME
181 @SYSC_RETVALSTR(returnval())
182 }
183
184 /* kernel 3.5+, but undesirable because it affects all syscalls */
185 probe tp_syscall.compat_getitimer.return = kernel.trace("sys_exit")
186 {
187 __set_syscall_pt_regs($regs)
188 @__compat_syscall_gate(@const("__NR_compat_getitimer"))
189 @_SYSCALL_GETITIMER_NAME
190 @SYSC_RETVALSTR($ret)
191 }