Debian Codegraph @

tapset/linux/sysc_recvmmsg.stp

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