Debian Codegraph @

tapset/linux/sysc_pselect6.stp

raw
1 # pselect6 _____________________________________________________
2 #
3 # long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
4 # fd_set __user *exp, struct timespec __user *tsp, void __user *sig)
5 #
6
7 @define _SYSCALL_PSELECT6_NAME
8 %(
9 name = "pselect6"
10 %)
11
12 @define _SYSCALL_PSELECT6_ARGSTR
13 %(
14 argstr = sprintf("%d, %p, %p, %p, %s, %p", nfds, readfds, writefds,
15 exceptfds, timeout_str, sigmask)
16 %)
17
18 @define _SYSCALL_PSELECT6_REGARGS
19 %(
20 nfds = int_arg(1)
21 readfds = pointer_arg(2)
22 writefds = pointer_arg(3)
23 exceptfds = pointer_arg(4)
24 timeout = pointer_arg(5)
25 sigmask = pointer_arg(6)
26 %)
27
28 @define _SYSCALL_PSELECT6_REGARGS_STORE
29 %(
30 if (@probewrite(nfds))
31 set_int_arg(1, nfds)
32
33 if (@probewrite(readfds))
34 set_pointer_arg(2, readfds)
35
36 if (@probewrite(writefds))
37 set_pointer_arg(3, writefds)
38
39 if (@probewrite(exceptfds))
40 set_pointer_arg(4, exceptfds)
41
42 if (@probewrite(timeout))
43 set_pointer_arg(5, timeout)
44
45 if (@probewrite(sigmask))
46 set_pointer_arg(6, sigmask)
47 %)
48
49 probe syscall.pselect6 = dw_syscall.pselect6 !, nd_syscall.pselect6 ? {}
50 probe syscall.pselect6.return = dw_syscall.pselect6.return !,
51 nd_syscall.pselect6.return ? {}
52
53 # dw_pselect6 _____________________________________________________
54
55 probe dw_syscall.pselect6 = kernel.function("sys_pselect6").call ?
56 {
57 @_SYSCALL_PSELECT6_NAME
58 nfds = __int32($n)
59 readfds = $inp
60 writefds = $outp
61 exceptfds = $exp
62 timeout = $tsp
63 timeout_str = _struct_timespec_u(timeout, 1)
64 sigmask = $sig
65 @_SYSCALL_PSELECT6_ARGSTR
66 }
67 probe dw_syscall.pselect6.return = kernel.function("sys_pselect6").return ?
68 {
69 @_SYSCALL_PSELECT6_NAME
70 @SYSC_RETVALSTR($return)
71 }
72
73 # nd_pselect6 _____________________________________________________
74
75 probe nd_syscall.pselect6 = nd1_syscall.pselect6!, nd2_syscall.pselect6!, tp_syscall.pselect6
76 { }
77
78 probe nd1_syscall.pselect6 = kprobe.function("sys_pselect6") ?
79 {
80 @_SYSCALL_PSELECT6_NAME
81 asmlinkage()
82 @_SYSCALL_PSELECT6_REGARGS
83 timeout_str = _struct_timespec_u(timeout, 1)
84 @_SYSCALL_PSELECT6_ARGSTR
85 }
86
87 /* kernel 4.17+ */
88 probe nd2_syscall.pselect6 = kprobe.function(@arch_syscall_prefix "sys_pselect6") ?
89 {
90 __set_syscall_pt_regs(pointer_arg(1))
91 @_SYSCALL_PSELECT6_NAME
92 @_SYSCALL_PSELECT6_REGARGS
93 timeout_str = _struct_timespec_u(timeout, 1)
94 @_SYSCALL_PSELECT6_ARGSTR
95 },
96 {
97 %( @_IS_SREG_KERNEL %? @_SYSCALL_PSELECT6_REGARGS_STORE %)
98 }
99
100 /* kernel 3.5+, but undesirable because it affects all syscalls */
101 probe tp_syscall.pselect6 = kernel.trace("sys_enter")
102 {
103 __set_syscall_pt_regs($regs)
104 @__syscall_gate(@const("__NR_pselect6"))
105 @_SYSCALL_PSELECT6_NAME
106 @_SYSCALL_PSELECT6_REGARGS
107 timeout_str = _struct_timespec_u(timeout, 1)
108 @_SYSCALL_PSELECT6_ARGSTR
109 },
110 {
111 %( @_IS_SREG_KERNEL %? @_SYSCALL_PSELECT6_REGARGS_STORE %)
112 }
113
114 probe nd_syscall.pselect6.return = nd1_syscall.pselect6.return!, nd2_syscall.pselect6.return!, tp_syscall.pselect6.return
115 { }
116
117 probe nd1_syscall.pselect6.return = kprobe.function("sys_pselect6").return ?
118 {
119 @_SYSCALL_PSELECT6_NAME
120 @SYSC_RETVALSTR(returnval())
121 }
122
123 /* kernel 4.17+ */
124 probe nd2_syscall.pselect6.return = kprobe.function(@arch_syscall_prefix "sys_pselect6").return ?
125 {
126 @_SYSCALL_PSELECT6_NAME
127 @SYSC_RETVALSTR(returnval())
128 }
129
130 /* kernel 3.5+, but undesirable because it affects all syscalls */
131 probe tp_syscall.pselect6.return = kernel.trace("sys_exit")
132 {
133 __set_syscall_pt_regs($regs)
134 @__syscall_gate(@const("__NR_pselect6"))
135 @_SYSCALL_PSELECT6_NAME
136 @SYSC_RETVALSTR($ret)
137 }
138
139 # pselect6 _____________________________________________________
140 #
141 # long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
142 # fd_set __user *exp, struct timespec __user *tsp, void __user *sig)
143 #
144
145 probe syscall.compat_pselect6 = dw_syscall.compat_pselect6 !, nd_syscall.compat_pselect6 ? {}
146 probe syscall.compat_pselect6.return = dw_syscall.compat_pselect6.return !,
147 nd_syscall.compat_pselect6.return ? {}
148
149 # dw_compat_pselect6 _____________________________________________________
150
151 probe dw_syscall.compat_pselect6 = kernel.function("compat_sys_pselect6").call ?
152 {
153 @_SYSCALL_PSELECT6_NAME
154 nfds = __int32($n)
155 readfds = @__pointer($inp)
156 writefds = @__pointer($outp)
157 exceptfds = @__pointer($exp)
158 timeout = @__pointer($tsp)
159 timeout_str = _struct_compat_timespec_u(timeout, 1)
160 sigmask = @__pointer($sig)
161 @_SYSCALL_PSELECT6_ARGSTR
162 }
163 probe dw_syscall.compat_pselect6.return = kernel.function("compat_sys_pselect6").return ?
164 {
165 @_SYSCALL_PSELECT6_NAME
166 @SYSC_RETVALSTR($return)
167 }
168
169 # nd_compat_pselect6 _____________________________________________________
170
171 probe nd_syscall.compat_pselect6 = nd1_syscall.compat_pselect6!, nd2_syscall.compat_pselect6!, tp_syscall.compat_pselect6
172 { }
173
174 probe nd1_syscall.compat_pselect6 = kprobe.function("compat_sys_pselect6") ?
175 {
176 @_SYSCALL_PSELECT6_NAME
177 asmlinkage()
178 @_SYSCALL_PSELECT6_REGARGS
179 timeout_str = _struct_compat_timespec_u(timeout, 1)
180 @_SYSCALL_PSELECT6_ARGSTR
181 }
182
183 probe nd2_syscall.compat_pselect6 = kprobe.function(@arch_syscall_prefix "compat_sys_pselect6") ?
184 {
185 __set_syscall_pt_regs(pointer_arg(1))
186 @_SYSCALL_PSELECT6_NAME
187 @_SYSCALL_PSELECT6_REGARGS
188 timeout_str = _struct_compat_timespec_u(timeout, 1)
189 @_SYSCALL_PSELECT6_ARGSTR
190 },
191 {
192 %( @_IS_SREG_KERNEL %? @_SYSCALL_PSELECT6_REGARGS_STORE %)
193 }
194
195 probe tp_syscall.compat_pselect6 = kernel.trace("sys_enter")
196 {
197 __set_syscall_pt_regs($regs)
198 @__compat_syscall_gate(@const("__NR_compat_pselect6"))
199 @_SYSCALL_PSELECT6_NAME
200 @_SYSCALL_PSELECT6_REGARGS
201 timeout_str = _struct_compat_timespec_u(timeout, 1)
202 @_SYSCALL_PSELECT6_ARGSTR
203 },
204 {
205 %( @_IS_SREG_KERNEL %? @_SYSCALL_PSELECT6_REGARGS_STORE %)
206 }
207
208 probe nd_syscall.compat_pselect6.return = nd1_syscall.compat_pselect6.return!, nd2_syscall.compat_pselect6.return!, tp_syscall.compat_pselect6.return
209 { }
210
211 probe nd1_syscall.compat_pselect6.return = kprobe.function("compat_sys_pselect6").return ?
212 {
213 @_SYSCALL_PSELECT6_NAME
214 @SYSC_RETVALSTR(returnval())
215 }
216
217 /* kernel 4.17+ */
218 probe nd2_syscall.compat_pselect6.return = kprobe.function(@arch_syscall_prefix "compat_sys_pselect6").return ?
219 {
220 @_SYSCALL_PSELECT6_NAME
221 @SYSC_RETVALSTR(returnval())
222 }
223
224 /* kernel 3.5+, but undesirable because it affects all syscalls */
225 probe tp_syscall.compat_pselect6.return = kernel.trace("sys_exit")
226 {
227 __set_syscall_pt_regs($regs)
228 @__compat_syscall_gate(@const("__NR_compat_pselect6"))
229 @_SYSCALL_PSELECT6_NAME
230 @SYSC_RETVALSTR($ret)
231 }