1 #ifndef CREATE_SYSCALL_TABLE
3 #define OVERRIDE_32_execve
4 #define OVERRIDE_64_execve
5 SC_LTTNG_TRACEPOINT_EVENT(execve
,
6 TP_PROTO(sc_exit(long ret
,) const char *filename
, char *const *argv
, char *const *envp
),
7 TP_ARGS(sc_exit(ret
,) filename
, argv
, envp
),
8 TP_FIELDS(sc_exit(ctf_integer(long, ret
, ret
))
9 sc_in(ctf_user_string(filename
, filename
))
10 sc_in(ctf_integer_hex(char *const *, argv
, argv
))
11 sc_in(ctf_integer_hex(char *const *, envp
, envp
))
15 #define OVERRIDE_32_clone
16 #define OVERRIDE_64_clone
17 SC_LTTNG_TRACEPOINT_EVENT(clone
,
18 TP_PROTO(sc_exit(long ret
,) unsigned long clone_flags
, unsigned long newsp
,
19 void __user
*parent_tid
,
20 void __user
*child_tid
),
21 TP_ARGS(sc_exit(ret
,) clone_flags
, newsp
, parent_tid
, child_tid
),
23 sc_exit(ctf_integer(long, ret
, ret
))
24 sc_in(ctf_integer_hex(unsigned long, clone_flags
, clone_flags
))
25 sc_in(ctf_integer_hex(unsigned long, newsp
, newsp
))
26 sc_in(ctf_integer_hex(void *, parent_tid
, parent_tid
))
27 sc_in(ctf_integer_hex(void *, child_tid
, child_tid
))
31 /* present in 32, missing in 64 due to old kernel headers */
32 #define OVERRIDE_32_getcpu
33 #define OVERRIDE_64_getcpu
34 SC_LTTNG_TRACEPOINT_EVENT(getcpu
,
35 TP_PROTO(sc_exit(long ret
,) unsigned __user
*cpup
, unsigned __user
*nodep
, void *tcache
),
36 TP_ARGS(sc_exit(ret
,) cpup
, nodep
, tcache
),
38 sc_exit(ctf_integer(long, ret
, ret
))
39 sc_out(ctf_integer_hex(unsigned *, cpup
, cpup
))
40 sc_out(ctf_integer_hex(unsigned *, nodep
, nodep
))
41 sc_inout(ctf_integer_hex(void *, tcache
, tcache
))
45 #define OVERRIDE_32_pipe2
46 #define OVERRIDE_64_pipe2
47 SC_LTTNG_TRACEPOINT_EVENT(pipe2
,
48 TP_PROTO(sc_exit(long ret
,) int * fildes
, int flags
),
49 TP_ARGS(sc_exit(ret
,) fildes
, flags
),
50 TP_FIELDS(sc_exit(ctf_integer(long, ret
, ret
))
51 sc_out(ctf_user_array(int, fildes
, fildes
, 2))
52 sc_in(ctf_integer(int, flags
, flags
))
56 #define LTTNG_SYSCALL_SELECT_locvar \
57 unsigned long *fds_in, *fds_out, *fds_ex; \
58 unsigned long nr_bytes, nr_ulong; \
61 #define LTTNG_SYSCALL_SELECT_code_pre \
65 unsigned int n_in_bytes; \
67 tp_locvar->fds_in = NULL; \
68 tp_locvar->fds_out = NULL; \
69 tp_locvar->fds_ex = NULL; \
70 tp_locvar->overflow = 0; \
80 /* On error or bogus input, don't copy anything. */ \
81 if (n >__FD_SETSIZE) \
84 n_in_bytes = DIV_ROUND_UP((unsigned int) n, BITS_PER_BYTE); \
87 * Limit atomic memory allocation to one page, since n \
88 * is limited to 1024 and the smallest page size on Linux \
89 * is 4k, this should not happen, don't try to make it work. \
91 if (n_in_bytes > PAGE_SIZE) { \
93 /* Inform the user that we did not output everything. */ \
94 tp_locvar->overflow = 1; \
97 tp_locvar->nr_bytes = n_in_bytes; \
98 tp_locvar->nr_ulong = DIV_ROUND_UP(n_in_bytes, \
99 sizeof(unsigned long)); \
103 tp_locvar->fds_in = kmalloc( \
104 tp_locvar->nr_ulong * sizeof(unsigned long), \
105 GFP_ATOMIC | GFP_NOWAIT); \
106 if (!tp_locvar->fds_in) \
109 err = lib_ring_buffer_copy_from_user_check_nofault( \
110 tp_locvar->fds_in, inp, \
111 tp_locvar->nr_ulong * sizeof(unsigned long)); \
116 tp_locvar->fds_out = kmalloc( \
117 tp_locvar->nr_ulong * sizeof(unsigned long), \
118 GFP_ATOMIC | GFP_NOWAIT); \
119 if (!tp_locvar->fds_out) \
122 err = lib_ring_buffer_copy_from_user_check_nofault( \
123 tp_locvar->fds_out, outp, \
124 tp_locvar->nr_ulong * sizeof(unsigned long)); \
129 tp_locvar->fds_ex = kmalloc( \
130 tp_locvar->nr_ulong * sizeof(unsigned long), \
131 GFP_ATOMIC | GFP_NOWAIT); \
132 if (!tp_locvar->fds_ex) \
135 err = lib_ring_buffer_copy_from_user_check_nofault( \
136 tp_locvar->fds_ex, exp, \
137 tp_locvar->nr_ulong * sizeof(unsigned long)); \
144 tp_locvar->nr_bytes = 0; \
145 tp_locvar->nr_ulong = 0; \
146 end: ; /* Label at end of compound statement. */ \
150 #define LTTNG_SYSCALL_SELECT_fds_field_LE(name, input) \
153 .atype = atype_sequence, \
154 .u.sequence.length_type = __type_integer( \
155 uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none), \
156 .u.sequence.elem_type = __type_integer(uint8_t, 0, 0, 0, \
157 __BYTE_ORDER, 16, none), \
162 unsigned int nr_bytes_out = 0; \
165 ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \
168 ctf_integer_type(uint8_t, 0) \
173 for (src = 0; src < tp_locvar->nr_ulong; src++) { \
175 for (dst = 0; dst < sizeof(long); dst++) { \
176 if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \
179 ctf_user_integer_type(uint8_t, \
180 ((uint8_t __user *) (input->fds_bits + src))[dst]); \
187 #define LTTNG_SYSCALL_SELECT_fds_field_BE(name, input) \
190 .atype = atype_sequence, \
191 .u.sequence.length_type = __type_integer( \
192 uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none), \
193 .u.sequence.elem_type = __type_integer(uint8_t, 0, 0, 0, \
194 __BYTE_ORDER, 16, none), \
198 unsigned int src, nr_bytes_out = 0; \
201 ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \
204 ctf_integer_type(uint8_t, 0) \
209 for (src = 0; src < tp_locvar->nr_ulong; src++) { \
211 for (dst = sizeof(long); dst >= 0; dst--) { \
212 if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \
215 ctf_user_integer_type(uint8_t, \
216 ((uint8_t __user *) (input->fds_bits + src))[dst]); \
223 #define LTTNG_SYSCALL_SELECT_code_post \
224 kfree(tp_locvar->fds_in); \
225 kfree(tp_locvar->fds_out); \
226 kfree(tp_locvar->fds_ex);
228 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64)
229 #define OVERRIDE_32_select
230 #define OVERRIDE_64_select
231 SC_LTTNG_TRACEPOINT_EVENT_CODE(select
,
232 TP_PROTO(sc_exit(long ret
,) int n
, fd_set __user
*inp
, fd_set __user
*outp
,
233 fd_set __user
*exp
, struct timeval
*tvp
),
234 TP_ARGS(sc_exit(ret
,) n
, inp
, outp
, exp
, tvp
),
236 LTTNG_SYSCALL_SELECT_locvar
239 LTTNG_SYSCALL_SELECT_code_pre
242 sc_exit(ctf_integer(long, ret
, ret
))
243 sc_in(ctf_integer(int, n
, n
))
244 sc_inout(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
245 sc_inout(ctf_integer(struct timeval
*, tvp
, tvp
))
248 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
249 LTTNG_SYSCALL_SELECT_fds_field_LE(readfds
, inp
)
250 LTTNG_SYSCALL_SELECT_fds_field_LE(writefds
, outp
)
251 LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds
, exp
)
253 LTTNG_SYSCALL_SELECT_fds_field_BE(readfds
, inp
)
254 LTTNG_SYSCALL_SELECT_fds_field_BE(writefds
, outp
)
255 LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds
, exp
)
260 LTTNG_SYSCALL_SELECT_code_post
263 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) */
265 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
266 #define OVERRIDE_32_pselect6
267 #define OVERRIDE_64_pselect6
268 SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6
,
269 TP_PROTO(sc_exit(long ret
,) int n
, fd_set __user
* inp
, fd_set __user
* outp
,
270 fd_set __user
* exp
, struct timeval __user
* tvp
, void __user
* sig
),
271 TP_ARGS(sc_exit(ret
,) n
, inp
, outp
, exp
, tvp
, sig
),
273 LTTNG_SYSCALL_SELECT_locvar
276 LTTNG_SYSCALL_SELECT_code_pre
279 sc_exit(ctf_integer(long, ret
, ret
))
280 sc_in(ctf_integer(int, n
, n
))
281 sc_inout(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
282 sc_inout(ctf_integer(struct timeval
*, tvp
, tvp
))
283 sc_in(ctf_integer_hex(void *, sig
, sig
))
286 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
287 LTTNG_SYSCALL_SELECT_fds_field_LE(readfds
, inp
)
288 LTTNG_SYSCALL_SELECT_fds_field_LE(writefds
, outp
)
289 LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds
, exp
)
291 LTTNG_SYSCALL_SELECT_fds_field_BE(readfds
, inp
)
292 LTTNG_SYSCALL_SELECT_fds_field_BE(writefds
, outp
)
293 LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds
, exp
)
298 LTTNG_SYSCALL_SELECT_code_post
301 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
303 #endif /* CREATE_SYSCALL_TABLE */