This file is indexed.

/usr/share/systemtap/tapset/linux/syscalls.stpm is in systemtap-common 2.9-2ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// syscalls tapset macros
// Copyright (C) 2013-2015 Red Hat Inc.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.


@define __syscall_nr_gate(syscall_nr)
%(
	# Here we don't care if we're in a compat task or not, we just
	# want to make sure we've got the correct syscall number.
	#
	# If _stp_syscall_nr() fails, that means we aren't in user
	# context. So, skip this call.
	try { if (_stp_syscall_nr() != @syscall_nr) next } catch { next }
%)

@define __syscall_gate(syscall_nr)
%(
	# On some platforms (like s390x and ppc64), the 32-bit
	# syscalls use the same syscall number as the 64-bit
	# syscall. So, we have to check to see if this is a
	# 32-on-64-bit user task.
	@__syscall_gate_compat_simple

	# If _stp_syscall_nr() fails, that means we aren't in user
	# context. So, skip this call.
	try { if (_stp_syscall_nr() != @syscall_nr) next } catch { next }
%)

@define __syscall_gate2(syscall_nr1, syscall_nr2)
%(
	# On some platforms (like s390x and ppc64), the 32-bit
	# syscalls use the same syscall number as the 64-bit
	# syscall. So, we have to check to see if this is a
	# 32-on-64-bit user task.
	@__syscall_gate_compat_simple

	try { __nr = _stp_syscall_nr() } catch { next }
	if ((__nr != @syscall_nr1) && (__nr != @syscall_nr2)) next
%)

@define __syscall_compat_gate(syscall_nr, compat_syscall_nr)
%(
    %( CONFIG_COMPAT == "y" %?
	try { __nr = _stp_syscall_nr() } catch { next }
	if (@__compat_task) {
		if (__nr != @compat_syscall_nr)
			next
	}
	else if (__nr != @syscall_nr)
		next
    %:
	try { if (_stp_syscall_nr() != @syscall_nr) next } catch { next }
    %)
%)

@define __compat_syscall_gate(compat_syscall_nr)
%(
    %( CONFIG_COMPAT == "y" %?
	try { __nr = _stp_syscall_nr() } catch { next }
	if (@__compat_task) {
		if (__nr != @compat_syscall_nr) next
	}
    %)
%)

@define __compat_syscall_gate_negative(compat_syscall_nr)
%(
    %( CONFIG_COMPAT == "y" %?
	try { __nr = _stp_syscall_nr() } catch { next }
	if (@__compat_task) {
		if (__nr == @compat_syscall_nr) next
	}
    %)
%)

@define __syscall_gate_compat_simple
%(
    %( CONFIG_COMPAT == "y" %?
        if (@__compat_task) next
    %)
%)

@define __pointer(val)
%(
    %( CONFIG_COMPAT == "y" %?
	# If this is a compat task, the high bits of a pointer may be
	# garbage.
	(@__compat_task ? (@val & 0xffffffff) : @val)
    %:
	@val
    %)
%)

@define _af_inet_info_u(my_addr_uaddr, addrlen)
%(
  %( systemtap_v >= "2.5" %?
     uaddr_af = _struct_sockaddr_u_sa_family(@my_addr_uaddr, @addrlen)
     if (_struct_sockaddr_u_sa_family(@my_addr_uaddr, @addrlen) =~ "AF_INET.*") {
       uaddr_ip = _struct_sockaddr_u_ip_addr(@my_addr_uaddr, @addrlen)
       uaddr_ip_port = _struct_sockaddr_u_tcp_port(@my_addr_uaddr, @addrlen)
       if (_struct_sockaddr_u_sa_family(@my_addr_uaddr, @addrlen) == "AF_INET6") {
         uaddr_ipv6_flowinfo =  _struct_sockaddr_u_ipv6_flowinfo(@my_addr_uaddr, @addrlen)
         uaddr_ipv6_scope_id =  _struct_sockaddr_u_ipv6_scope_id(@my_addr_uaddr, @addrlen)
       }
     }
  %)
%)

# The following argstr processing is modeled on strace's handling of
# futex. Because it is so complicated and is used in 4 places
# (syscall.futex, syscall.compat_futex, nd_syscall.futex, and
# nd_syscall.compat_futex), a macro is used to handle all the
# details.
@define __futex_argstr(uaddr, op, val, utime, uaddr2, val3)
%(
	if (@op == %{ /* pure */ FUTEX_WAKE_BITSET %}) {
		argstr = sprintf("%p, %s, %d, %#x", @uaddr, _futex_op_str(@op),
				 @val, @val3)
	}
	else if (@op == %{ /* pure */ FUTEX_WAIT %}) {
		argstr = sprintf("%p, %s, %d, %s", @uaddr, _futex_op_str(@op),
				 @val,
				 (@__compat_task
				  ? _struct_compat_timespec_u(@utime, 1)
				  : _struct_timespec_u(@utime, 1)))
	}
	else if (@op == %{ /* pure */ FUTEX_WAIT_BITSET %}) {
		argstr = sprintf("%p, %s, %d, %s, %#x", @uaddr,
				 _futex_op_str(@op), @val,
				 (@__compat_task
				  ? _struct_compat_timespec_u(@utime, 1)
				  : _struct_timespec_u(@utime, 1)), @val3)
	}
	else if (@op == %{ /* pure */ FUTEX_REQUEUE %}) {
		argstr = sprintf("%p, %s, %d, %d, %p", @uaddr,
				 _futex_op_str(@op), @val, @utime,
				 @uaddr2)
	}
	else if (@op == %{ /* pure */ FUTEX_CMP_REQUEUE %}
		 || @op == %{ /* pure */ FUTEX_CMP_REQUEUE_PI %}) {
		argstr = sprintf("%p, %s, %d, %u, %p, %d", @uaddr,
				 _futex_op_str(@op), @val, @utime,
				 @uaddr2, @val3)
	}
	else if (@op == %{ /* pure */ FUTEX_WAKE_OP %}) {
		argstr = sprintf("%p, %s, %d, %u, %p, %s", @uaddr,
				 _futex_op_str(@op), @val, @utime,
				 @uaddr2, _futex_wake_op_str(@val3))
	}
	else if (@op == %{ /* pure */ FUTEX_WAIT_REQUEUE_PI %}) {
		argstr = sprintf("%p, %s, %d, %s, %p", @uaddr,
				 _futex_op_str(@op), @val,
				 (@__compat_task
				  ? _struct_compat_timespec_u(@utime, 1)
				  : _struct_timespec_u(@utime, 1)),
				 @uaddr2)
	}
	else {
		argstr = sprintf("%p, %s, %d", @uaddr, _futex_op_str(@op),
				 @val)
	}
%)

%( systemtap_v <= "2.9" %?
@define __int32_compat(arg)
%(
    %( CONFIG_64BIT == "y" %?
        (@__compat_task ? __int32(@arg) : @arg)
    %:
        (__int32(@arg))
    %)
%)
%)

@define __keyctl_argstr(option, arg2, arg3, arg4, arg5)
%(
        if ((@option == %{ /* pure */ KEYCTL_READ %}) ||
                        (@option == %{ /* pure */ KEYCTL_DESCRIBE %}) ||
                        (@option == %{ /* pure */ KEYCTL_GET_SECURITY %})) {
                argstr = sprintf("%s, %s, %p, %d", _stp_keyctl_cmd_str(@option),
				 _stp_keyctl_keyring_shortcut_str(@arg2),
				 @arg3, @__compat_long(@arg4))
        }
        else if (@option == %{ /* pure */ KEYCTL_UPDATE %}) {
                argstr = sprintf("%s, %d, %s, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), user_string_quoted(@arg3),
				 @__compat_long(@arg4))
        }
        else if ((@option == %{ /* pure */ KEYCTL_REVOKE %}) ||
                        (@option == %{ /* pure */ KEYCTL_CLEAR %}) ||
                        (@option == %{ /* pure */ KEYCTL_INVALIDATE %}) ||
                        (@option == %{ /* pure */ KEYCTL_ASSUME_AUTHORITY %})) {
                argstr = sprintf("%s, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2))
        }
        else if ((@option == %{ /* pure */ KEYCTL_LINK %}) ||
                        (@option == %{ /* pure */ KEYCTL_UNLINK %})) {
                argstr = sprintf("%s, %d, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @__compat_long(@arg3))
        }
        else if (@option == %{ /* pure */ KEYCTL_SEARCH %}) {
                argstr = sprintf("%s, %d, %s, %s, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), user_string_quoted(@arg3),
				 user_string_quoted(@arg4), @__compat_long(@arg5))
        }
        else if (@option == %{ /* pure */ KEYCTL_CHOWN %}) {
                argstr = sprintf("%s, %d, %d, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @__compat_long(@arg3),
				 @__compat_long(@arg4))
        }
        else if (@option == %{ /* pure */ KEYCTL_SETPERM %}) {
                argstr = sprintf("%s, %d, %s", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), _stp_keyctl_perm_str(@arg3))
        }
        else if ((@option == %{ /* pure */ KEYCTL_INSTANTIATE %})) {
                argstr = sprintf("%s, %d, %s, %d, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), user_string_quoted(@arg3),
				 @__compat_long(@arg4), @__compat_long(@arg5))
        }
        else if ((@option == %{ /* pure */ KEYCTL_INSTANTIATE_IOV %})) {
                argstr = sprintf("%s, %d, %p, %d, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @arg3, @__compat_long(@arg4),
				 @__compat_long(@arg5))
        }
        else if (@option == %{ /* pure */ KEYCTL_NEGATE %}) {
                argstr = sprintf("%s, %d, %u, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @arg3, @__compat_long(@arg4))
        }
        else if (@option == %{ /* pure */ KEYCTL_REJECT %}) {
                argstr = sprintf("%s, %d, %u, %u, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @arg3, @arg4,
				 @__compat_long(@arg5))
        }
        else if (@option == %{ /* pure */ KEYCTL_SET_TIMEOUT %}) {
                argstr = sprintf("%s, %d, %u", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @arg3)
        }
        else if (@option == %{ /* pure */ KEYCTL_GET_KEYRING_ID %}) {
                argstr = sprintf("%s, %s, %d", _stp_keyctl_cmd_str(@option),
				 _stp_keyctl_keyring_shortcut_str(@arg2),
				 @__compat_long(@arg3))
        }
        else if (@option == %{ /* pure */ KEYCTL_SET_REQKEY_KEYRING %}) {
                argstr = sprintf("%s, %s", _stp_keyctl_cmd_str(@option),
				 _stp_keyctl_default_keyrings_str(@arg2))
        }
        else if (@option == %{ /* pure */ KEYCTL_JOIN_SESSION_KEYRING %}) {
                argstr = sprintf("%s, %p", _stp_keyctl_cmd_str(@option), @arg2)
        }
        else if (@option == %{ /* pure */ KEYCTL_GET_PERSISTENT %}) {
                argstr = sprintf("%s, %d, %d", _stp_keyctl_cmd_str(@option),
				 @__compat_long(@arg2), @__compat_long(@arg3))
        }
        else {
                argstr = sprintf("%d, %d, %d, %d, %d", @option,
				 @__compat_long(@arg2), @__compat_long(@arg3),
				 @__compat_long(@arg4), @__compat_long(@arg5))
        }
%)

@define __quotactl_argstr(subcmd, arg1, arg2, arg3, arg4)
%(
	if (@subcmd == %{ /* pure */ Q_QUOTAON %}) {
		argstr = sprintf("%s, %s, %s, %s",
		                 _quotactl_cmd_str(@arg1), user_string_quoted(@arg2),
		                 _quotactl_quota_type_str(@arg3),
		                 user_string_quoted(@arg4))
	}
	else if ((@subcmd == %{ /* pure */ Q_GETQUOTA %}) ||
	         (@subcmd == %{ /* pure */ Q_SETQUOTA %})) {
		argstr = sprintf("%s, %s, %d, %s",
		                 _quotactl_cmd_str(@arg1), user_string_quoted(@arg2),
		                 @arg3, _struct_dqblk_u(@arg4))
	}
	else if ((@subcmd == %{ /* pure */ Q_GETINFO %}) ||
	         (@subcmd == %{ /* pure */ Q_SETINFO %})) {
		argstr = sprintf("%s, %s, %d, %s",
		                 _quotactl_cmd_str(@arg1), user_string_quoted(@arg2),
		                 @arg3, _struct_dqinfo_u(@arg4))
	}
	else if (@subcmd == %{ /* pure */ Q_GETFMT %}) {
		argstr = sprintf("%s, %s, %d, %x",
		                 _quotactl_cmd_str(@arg1), user_string_quoted(@arg2),
		                 @arg3, @arg4)
	}
	else if ((@subcmd == %{ /* pure */ Q_SYNC %}) ||
	         (@subcmd == %{ /* pure */ Q_QUOTAOFF %})) {
		argstr = sprintf("%s, %s, %d, %p",
		                 _quotactl_cmd_str(@arg1), user_string_quoted(@arg2),
		                 @arg3, @arg4)
	}
	else {
		argstr = sprintf("%s, %p, %d, %p", _quotactl_cmd_str(@arg1),
		                 @arg2, @arg3, @arg4)
	}
%)

# @__compat_ulong() macro adds the ability to distinguish between compat and non-compat
# task to the __ulong() function making it full-featured couterpart to ulong_arg().
@define __compat_ulong(arg)
%(
	%( CONFIG_COMPAT == "y" %?
		(@__compat_task ? __uint32(@arg) : __ulong(@arg))
	%:
		__ulong(@arg)
	%)
%)

# @__compat_long() macro adds the ability to distinguish between compat and non-compat
# task to the __long() function making it full-featured couterpart to long_arg().
@define __compat_long(arg)
%(
	%( CONFIG_COMPAT == "y" %?
		(@__compat_task ? __int32(@arg) : __long(@arg))
	%:
		__long(@arg)
	%)
%)

@define __BIG_ENDIAN
%(
%{ /* pure */
#ifdef __BIG_ENDIAN
  1
#else
  0
#endif
%}
%)