Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */ |
6314c2d3 | 2 | |
e42e81fd MD |
3 | #ifndef CREATE_SYSCALL_TABLE |
4 | ||
769ad370 MD |
5 | #define OVERRIDE_32_execve |
6 | #define OVERRIDE_64_execve | |
cb3ef14c | 7 | SC_LTTNG_TRACEPOINT_EVENT(execve, |
e17f92ba MD |
8 | TP_PROTO(sc_exit(long ret,) const char *filename, char *const *argv, char *const *envp), |
9 | TP_ARGS(sc_exit(ret,) filename, argv, envp), | |
57ede728 MD |
10 | TP_FIELDS(sc_exit(ctf_integer(long, ret, ret)) |
11 | sc_in(ctf_user_string(filename, filename)) | |
12 | sc_in(ctf_integer_hex(char *const *, argv, argv)) | |
13 | sc_in(ctf_integer_hex(char *const *, envp, envp)) | |
14 | ) | |
e42e81fd MD |
15 | ) |
16 | ||
769ad370 MD |
17 | #define OVERRIDE_32_clone |
18 | #define OVERRIDE_64_clone | |
cb3ef14c | 19 | SC_LTTNG_TRACEPOINT_EVENT(clone, |
e17f92ba | 20 | TP_PROTO(sc_exit(long ret,) unsigned long clone_flags, unsigned long newsp, |
ba21566b | 21 | void __user *parent_tid, |
b5aa4b6a | 22 | void __user *child_tid), |
e17f92ba | 23 | TP_ARGS(sc_exit(ret,) clone_flags, newsp, parent_tid, child_tid), |
57ede728 MD |
24 | TP_FIELDS( |
25 | sc_exit(ctf_integer(long, ret, ret)) | |
26 | sc_in(ctf_integer_hex(unsigned long, clone_flags, clone_flags)) | |
27 | sc_in(ctf_integer_hex(unsigned long, newsp, newsp)) | |
28 | sc_in(ctf_integer_hex(void *, parent_tid, parent_tid)) | |
29 | sc_in(ctf_integer_hex(void *, child_tid, child_tid)) | |
30 | ) | |
ba21566b MD |
31 | ) |
32 | ||
b5aa4b6a | 33 | /* present in 32, missing in 64 due to old kernel headers */ |
644d6e9c MD |
34 | #define OVERRIDE_32_getcpu |
35 | #define OVERRIDE_64_getcpu | |
cb3ef14c | 36 | SC_LTTNG_TRACEPOINT_EVENT(getcpu, |
e17f92ba MD |
37 | TP_PROTO(sc_exit(long ret,) unsigned __user *cpup, unsigned __user *nodep, void *tcache), |
38 | TP_ARGS(sc_exit(ret,) cpup, nodep, tcache), | |
57ede728 MD |
39 | TP_FIELDS( |
40 | sc_exit(ctf_integer(long, ret, ret)) | |
41 | sc_out(ctf_integer_hex(unsigned *, cpup, cpup)) | |
42 | sc_out(ctf_integer_hex(unsigned *, nodep, nodep)) | |
43 | sc_inout(ctf_integer_hex(void *, tcache, tcache)) | |
44 | ) | |
b5aa4b6a MD |
45 | ) |
46 | ||
af44bd3a MD |
47 | #define OVERRIDE_32_pipe2 |
48 | #define OVERRIDE_64_pipe2 | |
cb3ef14c | 49 | SC_LTTNG_TRACEPOINT_EVENT(pipe2, |
af44bd3a MD |
50 | TP_PROTO(sc_exit(long ret,) int * fildes, int flags), |
51 | TP_ARGS(sc_exit(ret,) fildes, flags), | |
57ede728 MD |
52 | TP_FIELDS(sc_exit(ctf_integer(long, ret, ret)) |
53 | sc_out(ctf_user_array(int, fildes, fildes, 2)) | |
54 | sc_in(ctf_integer(int, flags, flags)) | |
55 | ) | |
af44bd3a MD |
56 | ) |
57 | ||
29751f7c JD |
58 | #define LTTNG_SYSCALL_SELECT_locvar \ |
59 | unsigned long *fds_in, *fds_out, *fds_ex; \ | |
60 | unsigned long nr_bytes, nr_ulong; \ | |
61 | uint8_t overflow; | |
62 | ||
63 | #define LTTNG_SYSCALL_SELECT_code_pre \ | |
64 | sc_inout( \ | |
65 | { \ | |
66 | int err; \ | |
67 | unsigned int n_in_bytes; \ | |
68 | \ | |
69 | tp_locvar->fds_in = NULL; \ | |
70 | tp_locvar->fds_out = NULL; \ | |
71 | tp_locvar->fds_ex = NULL; \ | |
72 | tp_locvar->overflow = 0; \ | |
73 | \ | |
74 | sc_out( \ | |
75 | if (ret <= 0) \ | |
76 | goto error; \ | |
77 | ) \ | |
78 | \ | |
79 | if (n <= 0) \ | |
80 | goto error; \ | |
81 | \ | |
82 | /* On error or bogus input, don't copy anything. */ \ | |
83 | if (n >__FD_SETSIZE) \ | |
84 | goto error; \ | |
85 | \ | |
86 | n_in_bytes = DIV_ROUND_UP((unsigned int) n, BITS_PER_BYTE); \ | |
87 | \ | |
88 | /* \ | |
89 | * Limit atomic memory allocation to one page, since n \ | |
90 | * is limited to 1024 and the smallest page size on Linux \ | |
91 | * is 4k, this should not happen, don't try to make it work. \ | |
92 | */ \ | |
93 | if (n_in_bytes > PAGE_SIZE) { \ | |
94 | WARN_ON_ONCE(1); \ | |
95 | /* Inform the user that we did not output everything. */ \ | |
96 | tp_locvar->overflow = 1; \ | |
97 | goto error; \ | |
98 | } else { \ | |
99 | tp_locvar->nr_bytes = n_in_bytes; \ | |
100 | tp_locvar->nr_ulong = DIV_ROUND_UP(n_in_bytes, \ | |
101 | sizeof(unsigned long)); \ | |
102 | } \ | |
103 | \ | |
104 | if (inp) { \ | |
ec85ce1d JD |
105 | tp_locvar->fds_in = lttng_tp_mempool_alloc( \ |
106 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
29751f7c JD |
107 | if (!tp_locvar->fds_in) \ |
108 | goto error; \ | |
109 | \ | |
110 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
111 | tp_locvar->fds_in, inp, \ | |
112 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
113 | if (err != 0) \ | |
114 | goto error; \ | |
115 | } \ | |
116 | if (outp) { \ | |
ec85ce1d JD |
117 | tp_locvar->fds_out = lttng_tp_mempool_alloc( \ |
118 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
29751f7c JD |
119 | if (!tp_locvar->fds_out) \ |
120 | goto error; \ | |
121 | \ | |
122 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
123 | tp_locvar->fds_out, outp, \ | |
124 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
125 | if (err != 0) \ | |
126 | goto error; \ | |
127 | } \ | |
128 | if (exp) { \ | |
ec85ce1d JD |
129 | tp_locvar->fds_ex = lttng_tp_mempool_alloc( \ |
130 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
29751f7c JD |
131 | if (!tp_locvar->fds_ex) \ |
132 | goto error; \ | |
133 | \ | |
134 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
135 | tp_locvar->fds_ex, exp, \ | |
136 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
137 | if (err != 0) \ | |
138 | goto error; \ | |
139 | } \ | |
140 | goto end; \ | |
141 | \ | |
142 | error: \ | |
143 | tp_locvar->nr_bytes = 0; \ | |
144 | tp_locvar->nr_ulong = 0; \ | |
145 | end: ; /* Label at end of compound statement. */ \ | |
146 | } \ | |
147 | ) | |
148 | ||
149 | #define LTTNG_SYSCALL_SELECT_fds_field_LE(name, input) \ | |
150 | ctf_custom_field( \ | |
151 | ctf_custom_type( \ | |
ceabb767 | 152 | __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none) \ |
29751f7c | 153 | ), \ |
ceabb767 | 154 | _ ## name ## _length, \ |
29751f7c | 155 | ctf_custom_code( \ |
29751f7c JD |
156 | if (input) { \ |
157 | ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \ | |
158 | ctf_align(uint8_t) \ | |
159 | } else { \ | |
160 | ctf_integer_type(uint8_t, 0) \ | |
161 | ctf_align(uint8_t) \ | |
29751f7c | 162 | } \ |
ceabb767 MD |
163 | ) \ |
164 | ) \ | |
165 | ctf_custom_field( \ | |
166 | ctf_custom_type( \ | |
167 | { \ | |
168 | .atype = atype_sequence_nestable, \ | |
169 | .u.sequence_nestable.length_name = "_" #name "_length", \ | |
170 | .u.sequence_nestable.elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \ | |
171 | __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 16, none)), \ | |
172 | .u.sequence_nestable.alignment = 0, \ | |
173 | } \ | |
174 | ), \ | |
175 | name, \ | |
176 | ctf_custom_code( \ | |
177 | unsigned int src; \ | |
178 | unsigned int nr_bytes_out = 0; \ | |
179 | \ | |
180 | if (!input) \ | |
181 | goto skip_##name; \ | |
29751f7c JD |
182 | \ |
183 | for (src = 0; src < tp_locvar->nr_ulong; src++) { \ | |
184 | int dst; \ | |
185 | for (dst = 0; dst < sizeof(long); dst++) { \ | |
186 | if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \ | |
187 | goto skip_##name; \ | |
188 | } \ | |
189 | ctf_user_integer_type(uint8_t, \ | |
190 | ((uint8_t __user *) (input->fds_bits + src))[dst]); \ | |
191 | } \ | |
192 | } \ | |
193 | skip_##name: ; \ | |
194 | ) \ | |
195 | ) | |
196 | ||
197 | #define LTTNG_SYSCALL_SELECT_fds_field_BE(name, input) \ | |
198 | ctf_custom_field( \ | |
199 | ctf_custom_type( \ | |
ceabb767 | 200 | __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none) \ |
29751f7c | 201 | ), \ |
ceabb767 | 202 | _ ## name ## _length, \ |
29751f7c | 203 | ctf_custom_code( \ |
29751f7c JD |
204 | if (input) { \ |
205 | ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \ | |
206 | ctf_align(uint8_t) \ | |
207 | } else { \ | |
208 | ctf_integer_type(uint8_t, 0) \ | |
209 | ctf_align(uint8_t) \ | |
29751f7c | 210 | } \ |
ceabb767 MD |
211 | ) \ |
212 | ) \ | |
213 | ctf_custom_field( \ | |
214 | ctf_custom_type( \ | |
215 | { \ | |
216 | .atype = atype_sequence_nestable, \ | |
217 | .u.sequence_nestable.elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \ | |
218 | __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 16, none)), \ | |
219 | .u.sequence_nestable.alignment = 0, \ | |
220 | } \ | |
221 | ), \ | |
222 | name, \ | |
223 | ctf_custom_code( \ | |
224 | unsigned int src, nr_bytes_out = 0; \ | |
225 | \ | |
226 | if (!input) \ | |
227 | goto skip_##name; \ | |
29751f7c JD |
228 | \ |
229 | for (src = 0; src < tp_locvar->nr_ulong; src++) { \ | |
230 | int dst; \ | |
231 | for (dst = sizeof(long); dst >= 0; dst--) { \ | |
232 | if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \ | |
233 | goto skip_##name; \ | |
234 | } \ | |
235 | ctf_user_integer_type(uint8_t, \ | |
236 | ((uint8_t __user *) (input->fds_bits + src))[dst]); \ | |
237 | } \ | |
238 | } \ | |
239 | skip_##name: ; \ | |
240 | ) \ | |
241 | ) | |
242 | ||
243 | #define LTTNG_SYSCALL_SELECT_code_post \ | |
ec85ce1d JD |
244 | lttng_tp_mempool_free(tp_locvar->fds_in); \ |
245 | lttng_tp_mempool_free(tp_locvar->fds_out); \ | |
246 | lttng_tp_mempool_free(tp_locvar->fds_ex); | |
29751f7c | 247 | |
a6370148 | 248 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) |
29751f7c JD |
249 | #define OVERRIDE_32_select |
250 | #define OVERRIDE_64_select | |
251 | SC_LTTNG_TRACEPOINT_EVENT_CODE(select, | |
252 | TP_PROTO(sc_exit(long ret,) int n, fd_set __user *inp, fd_set __user *outp, | |
253 | fd_set __user *exp, struct timeval *tvp), | |
254 | TP_ARGS(sc_exit(ret,) n, inp, outp, exp, tvp), | |
255 | TP_locvar( | |
256 | LTTNG_SYSCALL_SELECT_locvar | |
257 | ), | |
258 | TP_code_pre( | |
259 | LTTNG_SYSCALL_SELECT_code_pre | |
260 | ), | |
261 | TP_FIELDS( | |
262 | sc_exit(ctf_integer(long, ret, ret)) | |
263 | sc_in(ctf_integer(int, n, n)) | |
264 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
265 | sc_inout(ctf_integer(struct timeval *, tvp, tvp)) | |
266 | ||
267 | sc_inout( | |
268 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
269 | LTTNG_SYSCALL_SELECT_fds_field_LE(readfds, inp) | |
270 | LTTNG_SYSCALL_SELECT_fds_field_LE(writefds, outp) | |
271 | LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds, exp) | |
272 | #else | |
273 | LTTNG_SYSCALL_SELECT_fds_field_BE(readfds, inp) | |
274 | LTTNG_SYSCALL_SELECT_fds_field_BE(writefds, outp) | |
275 | LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds, exp) | |
276 | #endif | |
277 | ) | |
278 | ), | |
279 | TP_code_post( | |
280 | LTTNG_SYSCALL_SELECT_code_post | |
281 | ) | |
282 | ) | |
639655f9 | 283 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ |
29751f7c JD |
284 | |
285 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
286 | #define OVERRIDE_32_pselect6 | |
287 | #define OVERRIDE_64_pselect6 | |
288 | SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6, | |
289 | TP_PROTO(sc_exit(long ret,) int n, fd_set __user * inp, fd_set __user * outp, | |
290 | fd_set __user * exp, struct timeval __user * tvp, void __user * sig), | |
291 | TP_ARGS(sc_exit(ret,) n, inp, outp, exp, tvp, sig), | |
292 | TP_locvar( | |
293 | LTTNG_SYSCALL_SELECT_locvar | |
294 | ), | |
295 | TP_code_pre( | |
296 | LTTNG_SYSCALL_SELECT_code_pre | |
297 | ), | |
298 | TP_FIELDS( | |
299 | sc_exit(ctf_integer(long, ret, ret)) | |
300 | sc_in(ctf_integer(int, n, n)) | |
301 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
302 | sc_inout(ctf_integer(struct timeval *, tvp, tvp)) | |
303 | sc_in(ctf_integer_hex(void *, sig, sig)) | |
304 | ||
305 | sc_inout( | |
306 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
307 | LTTNG_SYSCALL_SELECT_fds_field_LE(readfds, inp) | |
308 | LTTNG_SYSCALL_SELECT_fds_field_LE(writefds, outp) | |
309 | LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds, exp) | |
310 | #else | |
311 | LTTNG_SYSCALL_SELECT_fds_field_BE(readfds, inp) | |
312 | LTTNG_SYSCALL_SELECT_fds_field_BE(writefds, outp) | |
313 | LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds, exp) | |
314 | #endif | |
315 | ) | |
316 | ), | |
317 | TP_code_post( | |
318 | LTTNG_SYSCALL_SELECT_code_post | |
319 | ) | |
320 | ) | |
321 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
322 | ||
6a2ecd2e JD |
323 | #ifndef ONCE_LTTNG_TRACE_POLL_H |
324 | #define ONCE_LTTNG_TRACE_POLL_H | |
325 | ||
326 | #define LTTNG_POLL_NRFLAGS (POLLNVAL + 1) | |
327 | #define POLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \ | |
328 | ilog2(LTTNG_POLL_NRFLAGS - 1) | |
329 | ||
330 | /* | |
331 | * Only extract the values specified by iBCS2 for now. | |
332 | */ | |
333 | static struct lttng_event_field lttng_pollfd_flag_fields[] = { | |
334 | [ilog2(POLLIN)] = { | |
335 | .name = "POLLIN", | |
336 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
337 | }, | |
338 | [ilog2(POLLPRI)] = { | |
339 | .name = "POLLPRI", | |
340 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
341 | }, | |
342 | [ilog2(POLLOUT)] = { | |
343 | .name = "POLLOUT", | |
344 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
345 | }, | |
346 | [ilog2(POLLERR)] = { | |
347 | .name = "POLLERR", | |
348 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
349 | }, | |
350 | [ilog2(POLLHUP)] = { | |
351 | .name = "POLLHUP", | |
352 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
353 | }, | |
354 | [ilog2(POLLNVAL)] = { | |
355 | .name = "POLLNVAL", | |
356 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
357 | }, | |
358 | [ilog2(LTTNG_POLL_NRFLAGS)] = { | |
359 | .name = "padding", | |
360 | .type = __type_integer(int, POLL_FLAGS_PADDING_SIZE, 1, 0, | |
361 | __LITTLE_ENDIAN, 10, none), | |
362 | }, | |
363 | }; | |
364 | ||
365 | static struct lttng_event_field lttng_pollfd_fields[] = { | |
366 | [0] = { | |
367 | .name = "fd", | |
368 | .type = __type_integer(int, 0, 0, 0, __BYTE_ORDER, 10, none), | |
369 | }, | |
370 | [1] = { | |
371 | .name = "raw_events", | |
372 | .type = __type_integer(short, 0, 0, 0, __BYTE_ORDER, 16, none), | |
373 | }, | |
374 | [2] = { | |
375 | .name = "events", | |
376 | .type = { | |
ceabb767 MD |
377 | .atype = atype_struct_nestable, |
378 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_pollfd_flag_fields), | |
379 | .u.struct_nestable.fields = lttng_pollfd_flag_fields, | |
380 | .u.struct_nestable.alignment = 0, | |
6a2ecd2e JD |
381 | } |
382 | }, | |
383 | }; | |
384 | ||
385 | static struct lttng_type lttng_pollfd_elem = { | |
ceabb767 MD |
386 | .atype = atype_struct_nestable, |
387 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_pollfd_fields), | |
388 | .u.struct_nestable.fields = lttng_pollfd_fields, | |
389 | .u.struct_nestable.alignment = 0, | |
6a2ecd2e JD |
390 | }; |
391 | #endif /* ONCE_LTTNG_TRACE_POLL_H */ | |
392 | ||
393 | #define LTTNG_SYSCALL_POLL_locvar \ | |
394 | unsigned int fds_length, fds_max_len, alloc_fds; \ | |
395 | struct pollfd *fds; \ | |
396 | uint8_t overflow; | |
397 | ||
398 | #define LTTNG_SYSCALL_POLL_code_pre \ | |
399 | BUILD_BUG_ON(((ARRAY_SIZE(lttng_pollfd_flag_fields) - 1) + \ | |
400 | POLL_FLAGS_PADDING_SIZE) != \ | |
401 | sizeof(uint8_t) * BITS_PER_BYTE); \ | |
402 | tp_locvar->fds = NULL; \ | |
403 | tp_locvar->overflow = 0; \ | |
404 | \ | |
405 | sc_in( \ | |
406 | if (nfds > PAGE_SIZE / sizeof(struct pollfd)) { \ | |
407 | tp_locvar->fds_length = PAGE_SIZE / sizeof(struct pollfd); \ | |
408 | tp_locvar->fds_max_len = PAGE_SIZE / sizeof(struct pollfd); \ | |
409 | tp_locvar->overflow = 1; \ | |
410 | } else { \ | |
411 | tp_locvar->fds_length = nfds; \ | |
412 | tp_locvar->fds_max_len = nfds; \ | |
413 | } \ | |
414 | tp_locvar->alloc_fds = tp_locvar->fds_length * sizeof(struct pollfd); \ | |
415 | ) \ | |
416 | /* \ | |
417 | * On exit, the number of active FDs is determined by ret, \ | |
418 | * nfds stays the same as the entry, but we only want to \ | |
419 | * output the FDs that are relevant. \ | |
420 | */ \ | |
421 | sc_out( \ | |
422 | if (ret <= 0 || ret > nfds) \ | |
423 | goto error; \ | |
424 | \ | |
425 | if (nfds > PAGE_SIZE / sizeof(struct pollfd)) { \ | |
426 | tp_locvar->fds_length = PAGE_SIZE / sizeof(struct pollfd); \ | |
427 | tp_locvar->fds_max_len = PAGE_SIZE / sizeof(struct pollfd); \ | |
428 | tp_locvar->overflow = 1; \ | |
429 | } else { \ | |
430 | tp_locvar->fds_length = ret; \ | |
431 | tp_locvar->fds_max_len = nfds; \ | |
432 | } \ | |
433 | tp_locvar->alloc_fds = tp_locvar->fds_max_len * sizeof(struct pollfd); \ | |
434 | ) \ | |
435 | { \ | |
436 | int err; \ | |
437 | \ | |
ec85ce1d | 438 | tp_locvar->fds = lttng_tp_mempool_alloc(tp_locvar->alloc_fds); \ |
6a2ecd2e JD |
439 | if (!tp_locvar->fds) \ |
440 | goto error; \ | |
441 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
41a3cca2 | 442 | tp_locvar->fds, ufds, tp_locvar->alloc_fds); \ |
6a2ecd2e JD |
443 | if (err != 0) \ |
444 | goto error; \ | |
445 | } \ | |
446 | goto end; \ | |
447 | \ | |
448 | error: \ | |
449 | tp_locvar->fds_length = 0; \ | |
450 | tp_locvar->fds_max_len = 0; \ | |
451 | end: \ | |
452 | ; | |
453 | ||
454 | #define LTTNG_SYSCALL_POLL_fds_field \ | |
455 | sc_in( \ | |
456 | ctf_custom_field( \ | |
457 | ctf_custom_type( \ | |
ceabb767 MD |
458 | { \ |
459 | .atype = atype_sequence_nestable, \ | |
460 | .u.sequence_nestable.length_name = "fds_length", \ | |
461 | .u.sequence_nestable.elem_type = <tng_pollfd_elem, \ | |
462 | } \ | |
6a2ecd2e JD |
463 | ), \ |
464 | fds, \ | |
465 | ctf_custom_code( \ | |
466 | uint32_t i; \ | |
467 | \ | |
468 | ctf_align(int) /* Align on largest field in struct. */ \ | |
469 | for (i = 0; i < tp_locvar->fds_length; i++) { \ | |
470 | ctf_integer_type(int, tp_locvar->fds[i].fd) \ | |
471 | ctf_integer_type(short, tp_locvar->fds[i].events) \ | |
472 | ctf_integer_bitfield_type(uint8_t, \ | |
473 | (uint8_t) tp_locvar->fds[i].events) \ | |
474 | } \ | |
475 | ) \ | |
476 | ) \ | |
477 | ) \ | |
478 | sc_out( \ | |
479 | ctf_custom_field( \ | |
480 | ctf_custom_type( \ | |
ceabb767 MD |
481 | { \ |
482 | .atype = atype_sequence_nestable, \ | |
483 | .u.sequence_nestable.length_name = "fds_length", \ | |
484 | .u.sequence_nestable.elem_type = <tng_pollfd_elem, \ | |
485 | } \ | |
6a2ecd2e JD |
486 | ), \ |
487 | fds, \ | |
488 | ctf_custom_code( \ | |
489 | unsigned int i, nr = 0; \ | |
490 | \ | |
491 | ctf_align(int) /* Align on largest field in struct. */ \ | |
492 | /* \ | |
493 | * Iterate over the complete array, but only output \ | |
494 | * "ret" active FDs. \ | |
495 | */ \ | |
496 | for (i = 0; i < tp_locvar->fds_max_len; i++) { \ | |
497 | if (!tp_locvar->fds[i].revents) \ | |
498 | continue; \ | |
499 | if (nr++ >= tp_locvar->fds_length) \ | |
500 | break; \ | |
501 | ctf_integer_type(int, tp_locvar->fds[i].fd) \ | |
502 | ctf_integer_type(short, tp_locvar->fds[i].revents) \ | |
503 | ctf_integer_bitfield_type(uint8_t, \ | |
504 | (uint8_t) tp_locvar->fds[i].revents) \ | |
505 | } \ | |
506 | /* \ | |
507 | * If there is a discrepancy between ret and the \ | |
508 | * content of revents (e.g. caused by userspace corrupting \ | |
509 | * the array from a concurrent thread), we have to output \ | |
510 | * zeros to keep the trace readable. \ | |
511 | */ \ | |
512 | for (i = nr; i < tp_locvar->fds_length; i++) { \ | |
513 | ctf_integer_type(int, 0) \ | |
514 | ctf_integer_type(short, 0) \ | |
515 | ctf_integer_bitfield_type(uint8_t, 0) \ | |
516 | } \ | |
517 | ) \ | |
518 | ) \ | |
519 | ) | |
520 | ||
521 | #define LTTNG_SYSCALL_POLL_code_post \ | |
ec85ce1d | 522 | lttng_tp_mempool_free(tp_locvar->fds); |
6a2ecd2e | 523 | |
a6370148 | 524 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) |
6a2ecd2e JD |
525 | #define OVERRIDE_32_poll |
526 | #define OVERRIDE_64_poll | |
527 | SC_LTTNG_TRACEPOINT_EVENT_CODE(poll, | |
528 | TP_PROTO(sc_exit(long ret,) struct pollfd __user * ufds, | |
529 | unsigned int nfds, int timeout_msecs), | |
530 | TP_ARGS(sc_exit(ret,) ufds, nfds, timeout_msecs), | |
531 | TP_locvar( | |
532 | LTTNG_SYSCALL_POLL_locvar | |
533 | ), | |
534 | TP_code_pre( | |
535 | LTTNG_SYSCALL_POLL_code_pre | |
536 | ), | |
537 | TP_FIELDS( | |
538 | sc_exit(ctf_integer(long, ret, ret)) | |
539 | sc_in(ctf_integer(int, timeout_msecs, timeout_msecs)) | |
540 | sc_inout(ctf_integer(unsigned int, nfds, nfds)) | |
541 | sc_inout(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
542 | sc_in(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
543 | LTTNG_SYSCALL_POLL_fds_field | |
544 | ), | |
545 | TP_code_post( | |
546 | LTTNG_SYSCALL_POLL_code_post | |
547 | ) | |
548 | ) | |
639655f9 | 549 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ |
6a2ecd2e JD |
550 | |
551 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
552 | #define OVERRIDE_32_ppoll | |
553 | #define OVERRIDE_64_ppoll | |
554 | SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll, | |
555 | TP_PROTO(sc_exit(long ret,) struct pollfd __user * ufds, | |
556 | unsigned int nfds, struct timespec * tsp, const sigset_t * sigmask, size_t sigsetsize), | |
557 | TP_ARGS(sc_exit(ret,) ufds, nfds, tsp, sigmask, sigsetsize), | |
558 | TP_locvar( | |
559 | LTTNG_SYSCALL_POLL_locvar | |
560 | ), | |
561 | TP_code_pre( | |
562 | LTTNG_SYSCALL_POLL_code_pre | |
563 | ), | |
564 | TP_FIELDS( | |
565 | sc_exit(ctf_integer(long, ret, ret)) | |
566 | sc_in(ctf_integer(struct timespec *, tsp, tsp)) | |
567 | sc_in(ctf_integer(const sigset_t *, sigmask, sigmask)) | |
568 | sc_in(ctf_integer(size_t, sigsetsize, sigsetsize)) | |
569 | sc_inout(ctf_integer(unsigned int, nfds, nfds)) | |
570 | sc_inout(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
571 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
572 | LTTNG_SYSCALL_POLL_fds_field | |
573 | ), | |
574 | TP_code_post( | |
575 | LTTNG_SYSCALL_POLL_code_post | |
576 | ) | |
577 | ) | |
578 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
579 | ||
45e0ded1 JD |
580 | #include <linux/eventpoll.h> |
581 | ||
582 | SC_LTTNG_TRACEPOINT_ENUM(lttng_epoll_op, | |
583 | TP_ENUM_VALUES( | |
584 | ctf_enum_value("EPOLL_CTL_ADD", EPOLL_CTL_ADD) | |
585 | ctf_enum_value("EPOLL_CTL_DEL", EPOLL_CTL_DEL) | |
586 | ctf_enum_value("EPOLL_CTL_MOD", EPOLL_CTL_MOD) | |
587 | ) | |
588 | ) | |
589 | ||
590 | #ifndef ONCE_LTTNG_TRACE_EPOLL_CTL_H | |
591 | #define ONCE_LTTNG_TRACE_EPOLL_CTL_H | |
592 | ||
593 | #define LTTNG_EPOLL_NRFLAGS (POLLHUP + 1) | |
594 | #define EPOLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \ | |
595 | ilog2(LTTNG_EPOLL_NRFLAGS - 1) | |
596 | ||
597 | /* | |
598 | * Only extract the values specified by iBCS2 for now. | |
599 | */ | |
600 | static struct lttng_event_field lttng_epoll_ctl_events_fields[] = { | |
601 | /* 0x0001 */ | |
602 | [ilog2(POLLIN)] = { | |
603 | .name = "EPOLLIN", | |
604 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
605 | }, | |
606 | /* 0x0002 */ | |
607 | [ilog2(POLLPRI)] = { | |
608 | .name = "EPOLLPRI", | |
609 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
610 | }, | |
611 | /* 0x0004 */ | |
612 | [ilog2(POLLOUT)] = { | |
613 | .name = "EPOLLOUT", | |
614 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
615 | }, | |
616 | /* 0x0008 */ | |
617 | [ilog2(POLLERR)] = { | |
618 | .name = "EPOLLERR", | |
619 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
620 | }, | |
621 | /* 0x0010 */ | |
622 | [ilog2(POLLHUP)] = { | |
623 | .name = "EPOLLHUP", | |
624 | .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none), | |
625 | }, | |
626 | [ilog2(LTTNG_EPOLL_NRFLAGS)] = { | |
627 | .name = "padding", | |
628 | .type = __type_integer(int, EPOLL_FLAGS_PADDING_SIZE, 1, 0, | |
629 | __LITTLE_ENDIAN, 10, none), | |
630 | }, | |
631 | ||
632 | }; | |
633 | ||
634 | static struct lttng_event_field lttng_epoll_data_fields[] = { | |
635 | [0] = { | |
636 | .name = "u64", | |
637 | .type = __type_integer(uint64_t, 0, 0, 0, __BYTE_ORDER, 16, none), | |
638 | }, | |
639 | [1] = { | |
640 | .name = "fd", | |
641 | .type = __type_integer(int, 0, 0, 0, __BYTE_ORDER, 10, none), | |
642 | }, | |
643 | }; | |
644 | ||
645 | static struct lttng_event_field epoll_ctl_fields[] = { | |
646 | [0] = { | |
647 | .name = "data_union", | |
648 | .type = { | |
ceabb767 MD |
649 | .atype = atype_struct_nestable, |
650 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_data_fields), | |
651 | .u.struct_nestable.fields = lttng_epoll_data_fields, | |
652 | .u.struct_nestable.alignment = 0, | |
45e0ded1 JD |
653 | } |
654 | }, | |
655 | [1] = { | |
656 | .name = "raw_events", | |
657 | .type = __type_integer(uint32_t, 0, 0, 0, __BYTE_ORDER, 16, none), | |
658 | }, | |
659 | [2] = { | |
660 | .name = "events", | |
661 | .type = { | |
ceabb767 MD |
662 | .atype = atype_struct_nestable, |
663 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_ctl_events_fields), | |
664 | .u.struct_nestable.fields = lttng_epoll_ctl_events_fields, | |
665 | .u.struct_nestable.alignment = 0, | |
45e0ded1 JD |
666 | } |
667 | }, | |
668 | }; | |
669 | #endif /* ONCE_LTTNG_TRACE_EPOLL_CTL_H */ | |
670 | ||
671 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
672 | #define OVERRIDE_32_epoll_ctl | |
673 | #define OVERRIDE_64_epoll_ctl | |
674 | SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_ctl, | |
675 | TP_PROTO(sc_exit(long ret,) int epfd, int op, int fd, | |
676 | struct epoll_event __user * uevent), | |
677 | TP_ARGS(sc_exit(ret,) epfd, op, fd, uevent), | |
678 | TP_locvar( | |
679 | struct epoll_event event; | |
680 | int err; | |
681 | ), | |
682 | TP_code_pre( | |
683 | tp_locvar->err = lib_ring_buffer_copy_from_user_check_nofault( | |
684 | &tp_locvar->event, uevent, sizeof(struct epoll_event)); | |
685 | ), | |
686 | TP_FIELDS( | |
687 | sc_exit(ctf_integer(long, ret, ret)) | |
688 | sc_in(ctf_integer(int, epfd, epfd)) | |
689 | sc_in(ctf_enum(lttng_epoll_op, int, op_enum, op)) | |
690 | sc_in(ctf_integer(int, fd, fd)) | |
691 | sc_in( | |
692 | ctf_custom_field( | |
693 | ctf_custom_type( | |
ceabb767 MD |
694 | { |
695 | .atype = atype_struct_nestable, | |
696 | .u.struct_nestable.nr_fields = ARRAY_SIZE(epoll_ctl_fields), | |
697 | .u.struct_nestable.fields = epoll_ctl_fields, | |
698 | .u.struct_nestable.alignment = 0, | |
699 | } | |
45e0ded1 JD |
700 | ), |
701 | event, | |
702 | ctf_custom_code( | |
703 | ctf_align(uint64_t) | |
704 | if (!tp_locvar->err) { | |
705 | ctf_integer_type(uint64_t, tp_locvar->event.data) | |
706 | ctf_integer_type(int, tp_locvar->event.data) | |
707 | ctf_integer_bitfield_type(uint32_t, | |
708 | tp_locvar->event.events) | |
709 | ctf_integer_bitfield_type(uint8_t, | |
710 | (uint8_t) tp_locvar->event.events) | |
711 | } else { | |
712 | ctf_integer_type(uint64_t, 0) | |
713 | ctf_integer_type(int, 0) | |
714 | ctf_integer_bitfield_type(uint32_t, 0) | |
715 | ctf_integer_bitfield_type(uint8_t, 0) | |
716 | } | |
717 | ) | |
718 | ) | |
719 | ) | |
720 | ), | |
721 | TP_code_post() | |
722 | ) | |
723 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
724 | ||
f22697ca JD |
725 | #ifndef ONCE_LTTNG_TRACE_EPOLL_H |
726 | #define ONCE_LTTNG_TRACE_EPOLL_H | |
727 | ||
728 | static struct lttng_event_field lttng_epoll_wait_fields[] = { | |
729 | [0] = { | |
730 | .name = "data_union", | |
731 | .type = { | |
ceabb767 MD |
732 | .atype = atype_struct_nestable, |
733 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_data_fields), | |
734 | .u.struct_nestable.fields = lttng_epoll_data_fields, | |
735 | .u.struct_nestable.alignment = 0, | |
f22697ca JD |
736 | } |
737 | }, | |
738 | [1] = { | |
739 | .name = "raw_events", | |
740 | .type = __type_integer(uint32_t, 0, 0, 0, __BYTE_ORDER, 16, none), | |
741 | }, | |
742 | [2] = { | |
743 | .name = "events", | |
744 | .type = { | |
ceabb767 MD |
745 | .atype = atype_struct_nestable, |
746 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_ctl_events_fields), | |
747 | .u.struct_nestable.fields = lttng_epoll_ctl_events_fields, | |
748 | .u.struct_nestable.alignment = 0, | |
f22697ca JD |
749 | } |
750 | }, | |
751 | }; | |
752 | ||
753 | static struct lttng_type lttng_epoll_wait_elem = { | |
ceabb767 MD |
754 | .atype = atype_struct_nestable, |
755 | .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_wait_fields), | |
756 | .u.struct_nestable.fields = lttng_epoll_wait_fields, | |
757 | .u.struct_nestable.alignment = 0, | |
f22697ca JD |
758 | }; |
759 | ||
760 | #endif /* ONCE_LTTNG_TRACE_EPOLL_H */ | |
761 | ||
762 | #define LTTNG_SYSCALL_EPOLL_WAIT_locvar \ | |
763 | sc_out( \ | |
764 | unsigned int fds_length; \ | |
765 | uint8_t overflow; \ | |
766 | struct epoll_event *events; \ | |
767 | ) | |
768 | ||
769 | #define LTTNG_SYSCALL_EPOLL_WAIT_code_pre \ | |
770 | BUILD_BUG_ON(((ARRAY_SIZE(lttng_epoll_ctl_events_fields) - 1) + \ | |
771 | EPOLL_FLAGS_PADDING_SIZE) != \ | |
772 | sizeof(uint8_t) * BITS_PER_BYTE); \ | |
773 | sc_out({ \ | |
774 | int err; \ | |
775 | unsigned long maxalloc; \ | |
776 | \ | |
777 | tp_locvar->fds_length = 0; \ | |
778 | tp_locvar->events = NULL; \ | |
779 | tp_locvar->overflow = 0; \ | |
780 | \ | |
781 | if (maxevents <= 0 || ret <= 0 || ret > maxevents) \ | |
782 | goto skip_code; \ | |
783 | \ | |
784 | if (maxevents > PAGE_SIZE / sizeof(struct epoll_event)) { \ | |
785 | maxalloc = PAGE_SIZE / sizeof(struct epoll_event); \ | |
786 | } else { \ | |
787 | maxalloc = maxevents; \ | |
788 | } \ | |
789 | \ | |
790 | if (ret > maxalloc) { \ | |
791 | tp_locvar->fds_length = maxalloc; \ | |
792 | tp_locvar->overflow = 1; \ | |
793 | } else { \ | |
794 | tp_locvar->fds_length = ret; \ | |
795 | } \ | |
796 | \ | |
ec85ce1d JD |
797 | tp_locvar->events = lttng_tp_mempool_alloc( \ |
798 | maxalloc * sizeof(struct epoll_event)); \ | |
f22697ca JD |
799 | if (!tp_locvar->events) { \ |
800 | tp_locvar->fds_length = 0; \ | |
801 | goto skip_code; \ | |
802 | } \ | |
803 | \ | |
804 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
805 | tp_locvar->events, uevents, \ | |
41a3cca2 | 806 | maxalloc * sizeof(struct epoll_event)); \ |
f22697ca JD |
807 | if (err != 0) \ |
808 | tp_locvar->fds_length = 0; \ | |
809 | } \ | |
810 | skip_code: \ | |
811 | ) | |
812 | ||
813 | #define LTTNG_SYSCALL_EPOLL_WAIT_fds_field \ | |
814 | ctf_custom_field( \ | |
815 | ctf_custom_type( \ | |
ceabb767 MD |
816 | { \ |
817 | .atype = atype_sequence_nestable, \ | |
818 | .u.sequence_nestable.length_name = \ | |
819 | "fds_length", \ | |
820 | .u.sequence_nestable.elem_type = \ | |
821 | <tng_epoll_wait_elem, \ | |
822 | } \ | |
f22697ca JD |
823 | ), \ |
824 | fds, \ | |
825 | ctf_custom_code( \ | |
826 | uint32_t i; \ | |
827 | \ | |
828 | ctf_align(uint64_t) \ | |
829 | for (i = 0; i < tp_locvar->fds_length; i++) { \ | |
830 | ctf_integer_type(uint64_t, tp_locvar->events[i].data) \ | |
831 | ctf_integer_type(int, tp_locvar->events[i].data) \ | |
832 | ctf_integer_bitfield_type(uint32_t, \ | |
833 | tp_locvar->events[i].events) \ | |
834 | ctf_integer_bitfield_type(uint8_t, \ | |
835 | (uint8_t) tp_locvar->events[i].events) \ | |
836 | } \ | |
837 | ) \ | |
838 | ) | |
839 | ||
840 | #define LTTNG_SYSCALL_EPOLL_WAIT_code_post \ | |
841 | sc_out( \ | |
ec85ce1d | 842 | lttng_tp_mempool_free(tp_locvar->events); \ |
f22697ca JD |
843 | ) |
844 | ||
845 | ||
a6370148 | 846 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) |
f22697ca JD |
847 | #define OVERRIDE_32_epoll_wait |
848 | #define OVERRIDE_64_epoll_wait | |
849 | SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_wait, | |
850 | TP_PROTO(sc_exit(long ret,) int epfd, struct epoll_event __user * uevents, | |
851 | int maxevents, int timeout), | |
852 | TP_ARGS(sc_exit(ret,) epfd, uevents, maxevents, timeout), | |
853 | TP_locvar( | |
854 | LTTNG_SYSCALL_EPOLL_WAIT_locvar | |
855 | ), | |
856 | TP_code_pre( | |
857 | LTTNG_SYSCALL_EPOLL_WAIT_code_pre | |
858 | ), | |
859 | TP_FIELDS( | |
860 | sc_exit(ctf_integer(long, ret, ret)) | |
861 | sc_in(ctf_integer(int, epfd, epfd)) | |
862 | sc_in(ctf_integer(int, maxevents, maxevents)) | |
863 | sc_in(ctf_integer(int, timeout, timeout)) | |
864 | sc_out(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
865 | sc_out(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
866 | sc_out( | |
867 | LTTNG_SYSCALL_EPOLL_WAIT_fds_field | |
868 | ) | |
869 | ), | |
870 | TP_code_post( | |
871 | LTTNG_SYSCALL_EPOLL_WAIT_code_post | |
872 | ) | |
873 | ) | |
639655f9 | 874 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ |
f22697ca JD |
875 | |
876 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
877 | #define OVERRIDE_32_epoll_pwait | |
878 | #define OVERRIDE_64_epoll_pwait | |
879 | SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_pwait, | |
880 | TP_PROTO(sc_exit(long ret,) int epfd, struct epoll_event __user * uevents, | |
881 | int maxevents, int timeout, const sigset_t __user * sigmask, size_t sigsetsize), | |
882 | TP_ARGS(sc_exit(ret,) epfd, uevents, maxevents, timeout, sigmask, sigsetsize), | |
883 | TP_locvar( | |
884 | LTTNG_SYSCALL_EPOLL_WAIT_locvar | |
885 | ), | |
886 | TP_code_pre( | |
887 | LTTNG_SYSCALL_EPOLL_WAIT_code_pre | |
888 | ), | |
889 | TP_FIELDS( | |
890 | sc_exit(ctf_integer(long, ret, ret)) | |
891 | sc_in(ctf_integer(int, epfd, epfd)) | |
892 | sc_in(ctf_integer(int, maxevents, maxevents)) | |
893 | sc_in(ctf_integer(int, timeout, timeout)) | |
894 | sc_in(ctf_integer_hex(const sigset_t *, sigmask, sigmask)) | |
895 | sc_in(ctf_integer(size_t, sigsetsize, sigsetsize)) | |
896 | sc_out(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
897 | sc_out(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
898 | sc_out( | |
899 | LTTNG_SYSCALL_EPOLL_WAIT_fds_field | |
900 | ) | |
901 | ), | |
902 | TP_code_post( | |
903 | LTTNG_SYSCALL_EPOLL_WAIT_code_post | |
904 | ) | |
905 | ) | |
906 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
907 | ||
771af27e JW |
908 | #if (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) |
909 | #define OVERRIDE_32_socketpair | |
910 | #define OVERRIDE_64_socketpair | |
911 | SC_LTTNG_TRACEPOINT_EVENT(socketpair, | |
912 | TP_PROTO(sc_exit(long ret,) int family, int type, int protocol, int *usockvec), | |
913 | TP_ARGS(sc_exit(ret,) family, type, protocol, usockvec), | |
914 | TP_FIELDS( | |
915 | sc_exit(ctf_integer(long, ret, ret)) | |
916 | sc_in(ctf_integer(int, family, family)) | |
917 | sc_in(ctf_integer(int, type, type)) | |
918 | sc_in(ctf_integer(int, protocol, protocol)) | |
919 | sc_out(ctf_user_array(int, socket, usockvec, 2)) | |
920 | ) | |
921 | ) | |
922 | #endif /* (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
923 | ||
c8dfb724 GB |
924 | /* |
925 | * Enumeration of the open flags, as described in the 'open' | |
926 | * system call man page. | |
927 | */ | |
928 | SC_LTTNG_TRACEPOINT_ENUM(lttng_file_status_flags, | |
929 | TP_ENUM_VALUES( | |
930 | ctf_enum_value("O_RDONLY", O_RDONLY) | |
931 | ctf_enum_value("O_WRONLY", O_WRONLY) | |
932 | ctf_enum_value("O_RDWR", O_RDWR) | |
933 | ctf_enum_value("O_CREAT", O_CREAT) | |
934 | ctf_enum_value("O_EXCL", O_EXCL) | |
935 | ctf_enum_value("O_NOCTTY", O_NOCTTY) | |
936 | ctf_enum_value("O_TRUNC", O_TRUNC) | |
937 | ctf_enum_value("O_APPEND", O_APPEND) | |
938 | ctf_enum_value("O_NONBLOCK", O_NONBLOCK) | |
939 | ctf_enum_value("O_DSYNC", O_DSYNC) | |
940 | ctf_enum_value("FASYNC", FASYNC) | |
941 | ctf_enum_value("O_DIRECT", O_DIRECT) | |
942 | ctf_enum_value("O_LARGEFILE", O_LARGEFILE) | |
943 | ctf_enum_value("O_DIRECTORY", O_DIRECTORY) | |
944 | ctf_enum_value("O_NOFOLLOW", O_NOFOLLOW) | |
945 | ctf_enum_value("O_NOATIME", O_NOATIME) | |
946 | ctf_enum_value("O_CLOEXEC", O_CLOEXEC) | |
947 | ctf_enum_value("O_SYNC", __O_SYNC) | |
948 | ctf_enum_value("O_PATH", O_PATH) | |
949 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) | |
950 | ctf_enum_value("O_TMPFILE", __O_TMPFILE) | |
951 | #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) */ | |
952 | ) | |
953 | ) | |
954 | ||
955 | /* | |
956 | * Enumeration of the open flags, as described in the 'open' | |
957 | * system call man page. | |
958 | */ | |
959 | SC_LTTNG_TRACEPOINT_ENUM(lttng_file_mode, | |
960 | TP_ENUM_VALUES( | |
961 | ctf_enum_value("S_IRWXU", S_IRWXU) | |
962 | ctf_enum_value("S_IRUSR", S_IRUSR) | |
963 | ctf_enum_value("S_IWUSR", S_IWUSR) | |
964 | ctf_enum_value("S_IXUSR", S_IXUSR) | |
965 | ctf_enum_value("S_IRWXG", S_IRWXG) | |
966 | ctf_enum_value("S_IRGRP", S_IRGRP) | |
967 | ctf_enum_value("S_IWGRP", S_IWGRP) | |
968 | ctf_enum_value("S_IXGRP", S_IXGRP) | |
969 | ctf_enum_value("S_IRWXO", S_IRWXO) | |
970 | ctf_enum_value("S_IROTH", S_IROTH) | |
971 | ctf_enum_value("S_IWOTH", S_IWOTH) | |
972 | ctf_enum_value("S_IXOTH", S_IXOTH) | |
973 | ctf_enum_value("S_ISUID", S_ISUID) | |
974 | ctf_enum_value("S_ISGID", S_ISGID) | |
975 | ctf_enum_value("S_ISVTX", S_ISVTX) | |
976 | ) | |
977 | ) | |
978 | ||
979 | #define OVERRIDE_32_openat | |
980 | #define OVERRIDE_64_openat | |
981 | SC_LTTNG_TRACEPOINT_EVENT(openat, | |
982 | TP_PROTO(sc_exit(long ret,) int dfd, const char * filename, int flags, umode_t mode), | |
983 | TP_ARGS(sc_exit(ret,) dfd, filename, flags, mode), | |
984 | TP_FIELDS( | |
985 | sc_exit(ctf_integer(long, ret, ret)) | |
986 | sc_in(ctf_integer(int, dfd, dfd)) | |
987 | sc_in(ctf_user_string(filename, filename)) | |
988 | sc_in(ctf_enum(lttng_file_status_flags, int, flags, flags)) | |
989 | sc_in(ctf_enum(lttng_file_mode, umode_t, mode, mode)) | |
990 | ) | |
991 | ) | |
992 | ||
993 | #define OVERRIDE_32_open | |
994 | #define OVERRIDE_64_open | |
995 | SC_LTTNG_TRACEPOINT_EVENT(open, | |
996 | TP_PROTO(sc_exit(long ret,) const char * filename, int flags, umode_t mode), | |
997 | TP_ARGS(sc_exit(ret,) filename, flags, mode), | |
998 | TP_FIELDS( | |
999 | sc_exit(ctf_integer(long, ret, ret)) | |
1000 | sc_in(ctf_user_string(filename, filename)) | |
1001 | sc_in(ctf_enum(lttng_file_status_flags, int, flags, flags)) | |
1002 | sc_in(ctf_enum(lttng_file_mode, umode_t, mode, mode)) | |
1003 | ) | |
1004 | ) | |
1005 | ||
e42e81fd | 1006 | #endif /* CREATE_SYSCALL_TABLE */ |