Compare commits

..

366 Commits
v4.22 ... v4.23

Author SHA1 Message Date
9a7661cc62 Prepare for 4.23 release
* NEWS: Update for 4.23 release.
2018-06-14 11:00:00 +00:00
2b6e074846 Update copyright headers
Headers updated automatically using maint/update_copyright_years.sh
script.
2018-06-14 11:00:00 +00:00
3afef04492 tests: add missing copyright headers
* tests/prctl-spec-inject.test: Add copyright header.
* tests/qualify_personality.sh: Likewise.
2018-06-14 11:00:00 +00:00
f52ff7d49c maint: document release procedure
* maint/README-release: New file.
* maint/gen-release-notes.sh: Likewise.
* maint/gen-release-github.sh: Likewise.
* maint/gen-release-gitlab.sh: Likewise.
2018-06-14 11:00:00 +00:00
6ef3718d6b maint: prepend contributor names in tag messages with an asterisk
* maint/gen-tag-message.sh: Prepend every line of
gen-contributors-list.sh output with an asterisk.
2018-06-14 11:00:00 +00:00
451c269e80 Update NEWS 2018-06-14 12:16:04 +02:00
dea01d8d83 Wire up rseq syscall
This new syscall was introduced by Linux commit v4.17-1308-gd7822b1.

* linux/dummy.h (sys_rseq): New macro.
* linux/arm/syscallent.h (398): Add rseq entry.
* linux/i386/syscallent.h (386): Likewise.
* linux/powerpc/syscallent.h (387): Likewise.
* linux/powerpc64/syscallent.h (387): Likewise.
* linux/x32/syscallent.h (334): Likewise.
* linux/x86_64/syscallent.h (334): Likewise.
2018-06-13 23:51:31 +00:00
2cc81216cb tests: check decoding of io_pgetevents syscall
* configure.ac (AC_CHECK_TYPES): Check for struct __aio_sigset
in <linux/aio_abi.h>.
* tests/aio_pgetevents.c: New file.
* tests/.gitignore: Add aio_pgetevents.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (aio_pgetevents): New test.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-13 16:18:38 +00:00
8f996fc157 Implement io_pgetevents syscall decoding
Introduced by Linux commit v4.17-rc3-7-g7a074e9.

* print_aio_sigset.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* aio.c (print_io_getevents): Rename from SYS_FUNC(io_getevents), add
has_usig flag, print user sigset on exiting if has_usig is set to true.
(SYS_FUNC(io_getevents), SYS_FUNC(io_pgetevents)): New functions,
wrappers for print_io_getevents.
* linux/32/syscallent.h ([292]): Wire up io_pgetevents.
* linux/64/syscallent.h ([292]): Likewise.
* linux/i386/syscallent.h ([385]): Likewise.
* linux/x32/syscallent.h ([333]): Likewise.
* linux/x86_64/syscallent.h ([333]): Likewise.
* NEWS: Mention this improvement.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-13 16:18:38 +00:00
6527c044f3 travis: re-enable testing with the latest mainline kernel headers
As <linux/signal.h> is out of the game now, the Linux commit
v4.17-rc3-7-g7a074e9 should not cause harm anymore, so let's enable
testing with the latest mainline kernel headers again.

* .travis.yml (matrix): Do not specify KBRANCH for KHEADERS=torvalds/linux.
2018-06-13 16:18:38 +00:00
b27397a7d2 Workaround incompatibility between <linux/signal.h> and libc headers
Override <linux/signal.h> with <signal.h> so that those few linux
headers that include <linux/signal.h> could be included along with libc
headers.

* linux/linux/signal.h: New file.
* Makefile.am (strace_SOURCES): Add it.
2018-06-13 16:18:38 +00:00
bff4578491 tests: add personality specification syntax checks
* tests/options-syntax.test: Add personality specification syntax
checks.
2018-06-13 15:05:09 +00:00
be8985d455 tests: add basic checks for personality designation support
* tests/qualify_personality.sh: New file.
* tests/qualify_personality_empty.in: Likewise.
* tests/trace_personality_32.in: Likewise.
* tests/trace_personality_64.in: Likewise.
* tests/trace_personality_regex_32.in: Likewise.
* tests/trace_personality_regex_64.in: Likewise.
* tests/trace_personality_regex_x32.in: Likewise.
* tests/trace_personality_x32.in: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add them.
* tests/gen_tests.in (trace_personality_32, trace_personality_64,
trace_personality_x32, trace_personality_regex_32,
trace_personality_regex_64, trace_personality_regex_x32): New tests.
2018-06-13 15:05:09 +00:00
380d205bb8 Add support for personality designation in regex qualifications
* basic_filters.c (qualify_syscall_regex): Copy syscall name
to a temporary buffer, append the personality designation to it,
and check it against regular expression if the syscall name
hasn't been matched already.

References: https://github.com/strace/strace/issues/35
2018-06-13 15:05:09 +00:00
3fedf07869 Add support for personality designation in syscall qualifications
* syscall.c (personality_designators): New array.
* defs.h (personality_designators): New declaration.
* basic_filters.c (qualify_syscall_separate_personality,
qualify_syscall_number_personality): New functions.
(qualify_syscall_number): Use qualify_syscall_separate_personality for
checking for a personality specification, call
qualify_syscall_number_personality for setting number set for specific
personality.
(qualify_syscall_name_personality): New function.
(qualify_syscall_name): Use qualify_syscall_separate_personality for
checking for a personality specification, call
qualify_syscall_name_personality for setting number set for specific
personality.
* strace.1.in (.SS Filtering): Document it.
* NEWS: Mention it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Closes: https://github.com/strace/strace/issues/35
2018-06-13 15:05:09 +00:00
4a329a0677 tests: add basic checks for inject=SET:syscall= expression syntax
* tests/qual_fault-syscall.test: New test.
* tests/qual_inject-error-signal-syscall.test: Likewise.
* tests/qual_inject-retval-syscall.test: Likewise.
* tests/qual_inject-signal-syscall.test: Likewise.
* tests/Makefile.am (MISC_TESTS): Add them.
* tests/qual_fault-syntax.test: Add checks for inject=SET:syscall=
expression syntax.
* tests/qual_inject-syntax.test: Likewise.
* tests/qual_fault.test: Append $suffix to -e fault arguments, override
$NAME with $name_override if the latter is set.
* tests/qual_inject-error-signal.test: Append $suffix to -e inject
arguments, override $NAME with $name_override if the latter is set.
* tests/qual_inject-retval.test: Likewise.
* tests/qual_inject-signal.test: Likewise.
2018-06-13 15:05:09 +00:00
883617d8b7 Implement injection of syscalls with no side effects as an alternative to -1
* defs.h (INJECT_F_SYSCALL, INJECT_ACTION_FLAGS, TCB_TAMPERED_NO_FAIL,
syscall_tampered_nofail): New macros.
(inject_data): Add scno field.
* filter_qualify.c (struct inject_personality_data): New type.
(parse_inject_token): Add "pdata" argument, parse "syscall=" option.
(parse_inject_expression): Add "pdata" argument, forward it to
parse_inject_token.
(qualify_inject_common) <pdata>: New variable array, pass it to
parse_inject_expression, copy it into inject_vec.
* syscall.c (tamper_with_syscall_entering): Inject the specified syscall
if INJECT_F_SYSCALL is set.
(tamper_with_syscall_exiting): Update the check for a failed syscall
injection.
(get_syscall_result): Update get_error invocation.
* strace.1.in: Document new syscall injection expression.
* NEWS: Mention it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Closes: https://github.com/strace/strace/issues/26
2018-06-13 15:05:09 +00:00
7e0c7e0e88 ia64: remove legacy i386 entries from the syscall entry table
Remove the last piece of IA-32 mode support.  Besides being obsolete,
these bogus syscall entries cause problems with syscall name resolution.

* linux/ia64/syscallent.h [CST > 0]: Remove.

Complements: v4.21~17 "linux/ia64: remove IA-32 mode support"
2018-06-13 15:05:09 +00:00
525f70debe linux: set error flags in arch_set_error on POWER and Alpha
* alpha/set_error.c (arch_set_error): Set alpha_r3 to 1, update tracee's
REG_A3.
* powerpc/set_error.c (arch_set_error): Set bit 28 in CCR register,
update tracee's PT_CCR.

Fixes: v4.15~126 "Implement arch specific methods of changing syscall number and error code"
2018-06-11 14:02:06 +00:00
d2aa5046e9 tests: check decoding of IFLA_LINKINFO netlink attribute
* tests/nlattr_ifla_linkinfo.c: New file.
* tests/pure_executables.list: Add nlattr_ifla_linkinfo.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (nlattr_ifla_linkinfo): New test.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-11 14:02:06 +00:00
418625eaaa tests: add print_quoted_stringn to print string with a size limit
This is similar to print_quoted_cstring, but not quite the same.

* tests/print_quoted_string.c (print_quoted_stringn): New function.
* tests/tests.h (print_quoted_stringn): New declaration.
2018-06-11 14:02:06 +00:00
b178553f22 tests: add fallback_func argument to TEST_NESTED_NLATTR_OBJECT_EX_
* tests/test_nlattr.h (TEST_NESTED_NLATTR_OBJECT_EX_): Add fallback_func
argument, call it instead of print_quoted_hex.
(TEST_NESTED_NLATTR_OBJECT_EX, TEST_NESTED_NLATTR_OBJECT): Specify
print_quoted_hex as a fallback_func.
* tests/nlattr_ifla_af_spec.c: Specify print_quoted_hex as
a fallback_func in TEST_NESTED_NLATTR_OBJECT_EX_ calls.
2018-06-11 14:02:06 +00:00
49d030ab8a tests/test_nlattr.h: add ability to provide additional nlattr payload
* tests/test_nlattr.h (print_nlattr): Add add_data argument, print
opening square bracket if add_data is set to true.
(TEST_NLATTR_EX_): Rename from TEST_NLATTR_, add nla_total_len_
argument, use it for msg_len calculation, print square brackets
if nla_total_len_ is greater than nla_data_len_.
(TEST_NLATTR_): New macro, a wrapper for TEST_NLATTR_EX_.
2018-06-11 14:02:06 +00:00
193e5f6aff rtnl_link: decode struct ifla_bridge_id unconditionally
Since it is relatively simple.

* rtnl_link.c (decode_ifla_bridge_id): Provide struct definition for
the id variable.
[!HAVE_STRUCT_IFLA_BRIDGE_ID] (decode_ifla_bridge_id): Decode struct
ifla_bridge_id.
2018-06-11 14:02:06 +00:00
deeb2d42ae nlattr: specify size for ethernet protocol
Otherwise it tries to decode payload of size 1, which makes little
sense.

* nlattr.c (decode_nla_ether_proto) <opts>: Specify size field.

Fixes: v4.22-321-gfd0cd65 "nlattr: add ethernet protocol decoder"
2018-06-11 14:02:06 +00:00
a781b2659f rtnl_link: use ARRSZ_PAIR where appropriate
It reduces code duplication somewhat and allows avoiding errors like
the one fixed in the previous commit.

* rtnl_link.c (decode_ifla_protinfo, decode_nla_linkinfo_data_bridge,
decode_nla_linkinfo_data_tun, decode_ifla_linkinfo, decode_ifla_port,
decode_ifla_vf_ports, decode_ifla_xdp,
DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg)): Use ARRSZ_PAIR in
decode_nlattr call arguments.
2018-06-11 14:02:06 +00:00
b870441f58 rtnl_link: fix incorrect variable names in ARRAY_SIZE arguments
* rtnl_link.c (decode_nla_linkinfo_data_bridge): Change
rtnl_ifla_info_data_bridge_attrs to ifla_info_data_bridge_nla_decoders
in ARRAY_SIZE call.
(decode_nla_linkinfo_data_tun): Change rtnl_ifla_info_data_tun_attrs
to ifla_info_data_tun_nla_decoders in ARRAY_SIZE call.

Fixes: v4.22-328-g1e6d5a8 "rtnl_link: implement IFLA_INFO_DATA for bridges"
Fixes: v4.22-329-g4eab3a4 "rtnl_link: implement IFLA_INFO_DATA for tun devices"
2018-06-11 14:02:06 +00:00
9e85a344d7 mips: add missing pure flag to syscall entries
* linux/mips/syscallent-n32.h ([6038], [6100], [6102], [6105], [6106],
[6108], [6109], [6178]): Add pure flag to getpid, getuid, getgid, geteuid,
getegid, getpgid, getpgrp, and gttid syscall descriptors.
* linux/mips/syscallent-n64.h ([5038], [5100], [5102], [5105], [5106],
[5108], [5109], [5178]): Likewise.
* linux/mips/syscallent-o32.h ([4020], [4024], [4047], [4049], [4050],
[4064], [4065], [4222]): Likewise.

Complements: v4.21~29 "Add pure syscall flag"
2018-06-11 14:02:06 +00:00
58c47fe58a mips: add missing "never fails" flag to getpgrp syscall entries
* linux/mips/syscallent-n32.h ([6109]): Add NF flag.
* linux/mips/syscallent-n64.h ([5109]): Likewise.
* linux/mips/syscallent-o32.h ([4065]): Likewise.

Complements: v4.21~46 "Add SYSCALL_NEVER_FAILS flag to getpgrp"
2018-06-11 14:02:06 +00:00
36b44f9380 Update NEWS
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-07 18:02:01 +00:00
b6fec72d5e xlat: describe IPV4_DEVCONF_* weirdness
* xlat/inet_devconf_indices.in: Add a comment about fallback definitions.
2018-06-07 18:02:01 +00:00
e3e4a524a1 configure.ac: fix the check for struct tc_sizespec on old kernel headers
* configure.ac (AC_CHECK_TYPES): Include <linux/types.h> before
<linux/pkt_sched.h> to check for struct tc_sizespec on linux kernel
headers without v2.6.29-rc4~77^2~26 fix.
2018-06-07 14:01:24 +00:00
762ee767f0 travis: use kernel headers from v4.17
There is too much noise when using unreleased kernel uapi.

* ci/install-dependencies.sh (clone_repo): Add optional "branch"
argument, pass it to "git clone".
($KHEADERS): Pass $KBRANCH as branch argument of clone_repo.
* .travis.yml (matrix): Specify KBRANCH=v4.17 for
KHEADERS=torvalds/linux.
2018-06-06 15:10:37 +00:00
4f652c1ec4 tests: check decoding of IFLA_AF_SPEC netlink attribute
* configure.ac (AC_CHECK_TYPES): Check for struct ifla_cacheinfo in
<linux/rtnetlink.h>
(AC_CHECK_DECLS): Check for IFLA_AF_SPEC in <linux/rtnetlink.h>.
* tests/nlattr_ifla_af_spec.c: New file.
* tests/pure_executables.list: Add nlattr_ifla_af_spec.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (nlattr_ifla_af_spec): New test.
2018-06-06 15:10:37 +00:00
6229d93cb2 tests: add TEST_NESTED_NLATTR_ARRAY_EX to test_nlattr.h
An ability to specify custom depth is going to be needed later to check
IFLA_AF_SPEC decoding.

* configure.ac (AC_CHECK_DECLS): Check for TCA_STAB_DATA in
<linux/pkt_sched.h>.
* tests/test_nlattr.h (TEST_NESTED_NLATTR_ARRAY_EX): Rename from
TEST_NESTED_NLATTR_ARRAY, add depth_ argument, perform padding and
output accordingly.
(TEST_NESTED_NLATTR_ARRAY): New macro, a thin wrapper around
TEST_NESTED_NLATTR_ARRAY_EX.
* tests/nlattr_tca_stab.c [!HAVE_DECL_TCA_STAB_DATA] (TCA_STAB_DATA):
New enumeration declaration.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-06 15:10:37 +00:00
ce3bddf6c4 tests: pass index to print_elem_ callback in TEST_NLATTR_NESTED_ARRAY
* tests/test_nlattr.h (TEST_NLATTR_NESTED_ARRAY): Pass array index
to the print_elem_ callback.
* tests/nlattr_tca_stab.c (print_uint16): Add index argument.
2018-06-06 15:10:37 +00:00
e62b6a5e92 tests: move common ifinfomsg boilerplate into a separate header
* configure.ac (AC_CHECK_DECLS): Check for IFLA_PORT_SELF, IFLA_PROTINFO, and
IFLA_XDP in <linux/rtnetlink.h>.
* tests/nlattr_ifla.h: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/nlattr_ifla_brport.c [!HAVE_DECL_IFLA_PROTINFO] (IFLA_PROTINFO):
New declaration.
(hdrlen, init_ifinfomsg, print_ifinfomsg): Remove.
(IFLA_ATTR): Define to IFLA_PROTINFO.
Include nlattr_ifla.h.
* tests/nlattr_ifla_port.c [!HAVE_DECL_IFLA_PORT_SELF] (IFLA_PORT_SELF):
New declaration.
(hdrlen, init_ifinfomsg, print_ifinfomsg): Remove.
(IFLA_ATTR): Define to IFLA_PORT_SELF.
Include nlattr_ifla.h.
* tests/nlattr_ifla_xdp.c
* tests/nlattr_ifla_xdp.c [!HAVE_DECL_IFLA_XDP] (IFLA_XDP): New
declaration.
(hdrlen, init_ifinfomsg, print_ifinfomsg): Remove.
(IFLA_ATTR): Define to IFLA_XDP.
Include nlattr_ifla.h.
2018-06-06 15:10:37 +00:00
4eab3a43fd rtnl_link: implement IFLA_INFO_DATA for tun devices
* xlat/rtnl_ifla_info_data_tun_attrs.in: New file.
* xlat/tun_device_types.in: Likewise.
* rtnl_link.c: Include xlat/rtnl_ifla_info_data_tun_attrs.h and
xlat/tun_device_types.h.
(decode_nla_tun_type, decode_nla_linkinfo_data_tun): New functions.
(ifla_info_data_tun_nla_decoders): New decoder dispatcher table.
(decode_nla_linkinfo_data): Use decode_nla_linkinfo_data_tun if kind
is
"tun".
2018-06-06 15:10:37 +00:00
1e6d5a84b8 rtnl_link: implement IFLA_INFO_DATA for bridges
* xlat/rtnl_ifla_info_data_bridge_attrs.in: New file.
* rtnl_link.c: Include xlat/rtnl_ifla_info_data_bridge_attrs.h.
(ifla_info_data_bridge_nla_decoders): New decoder dispatcher table.
(decode_nla_linkinfo_data_bridge, decode_nla_linkinfo_data): New
functions.
(ifla_linkinfo_nla_decoders) <IFLA_INFO_DATA>: Use
decode_nla_linkinfo_data as a decoder.
2018-06-06 15:10:37 +00:00
c95426f6ae rtnl_link: implement IFLA_INFO_XSTATS decoding
So far, only CAN provides it.

* rtnl_link.c (decode_nla_linkinfo_xstats_can,
decode_nla_linkinfo_xstats): New function.
(ifla_linkinfo_nla_decoders) <IFLA_INFO_XSTATS>: Use
decode_nla_linkinfo_xstats as a decoder.
2018-06-06 15:10:37 +00:00
7503a0f9e4 rtnl_link: add basic IFLA_INFO_* handling
Dispatch for IFLA_INFO_* attributes should be performed based on the
string provided in a IFLA_INFO_KIND attribute.

* nlattr.h (struct ifla_linkinfo_ctx): New type definition.
* rtnl_link.c (decode_nla_linkinfo_kind): New function.
(ifla_linkinfo_nla_decoders) <IFLA_INFO_KIND>: Use
decode_nla_linkinfo_kind as decoder.
(decode_ifla_linkinfo): Add struct ifla_linkinfo_ctx context, pass it to
the decode_nlattr call as opaque data.
2018-06-06 15:10:37 +00:00
97eb4367e4 rtnl_link: decode IFLA_AF_SPEC
* xlat/in6_addr_gen_mode.in: New file.
* xlat/inet6_devconf_indices.in: Likewise.
* xlat/inet6_if_flags.in: Likewise.
* xlat/inet_devconf_indices.in: Likewise.
* xlat/rtnl_ifla_af_spec_inet6_attrs.in: Likewise.
* xlat/rtnl_ifla_af_spec_inet_attrs.in: Likewise.
* xlat/snmp_icmp6_stats.in: Likewise.
* xlat/snmp_ip_stats.in: Likewise.
* rtnl_link.c: Include netinet/in.h, xlat/in6_addr_gen_mode.h,
xlat/inet_devconf_indices.h, xlat/inet6_devconf_indices.h,
xlat/inet6_if_flags.h, xlat/rtnl_ifla_af_spec_inet_attrs.h,
xlat/rtnl_ifla_af_spec_inet6_attrs.h, xlat/snmp_icmp6_stats.h,
and xlat/snmp_ip_stats.h.
(decode_ifla_inet_conf, decode_ifla_inet6_flags,
decode_ifla_inet6_conf, decode_ifla_inet6_stats,
decode_ifla_inet6_cacheinfo, decode_ifla_inet6_icmp6_stats,
decode_ifla_inet6_token, decode_ifla_inet6_agm, decode_ifla_af,
decode_ifla_af_spec): New functions.
(ifla_inet_nla_decoders, ifla_inet6_nla_decoders,
nla_decoder_table_desc): New static constant variables.
(ifinfomsg_nla_decoders) <[IFLA_AF_SPEC]>: Change value from NULL to
decode_ifla_af_spec.
2018-06-06 15:10:37 +00:00
c0827b1ae9 nlattr: add size check to decode_nla_xval and decode_nla_flags
If the field size is known, do not print as valid numbers those
attributes that are too short, and ignore extra data.

This change puts xval/flags printing in line with the reset of attribute
decoders.

* nlattr.h (struct decode_nla_xlat_opts): Add size field.
* nlattr.c (decode_nla_xval, decode_nla_flags): Check that len is at
least opts->size, limit len to opts->size.
(decode_nla_ip_proto): Specify size of 1.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-06 15:10:37 +00:00
6d98338f09 nlattr: add UID/GID netlink attribute decoders
* nlattr.h (DECL_NLA(uid), DECL_NLA(gid)): New declarations.
* nlattr.c (decode_nla_uid, decode_nla_gid): New functions.
2018-06-06 15:10:37 +00:00
f29c4f1319 nlattr: add unsigned int decoders that print in hex form
* nlattr.h (DECL_NLA(x8), DECL_NLA(x16), DECL_NLA(x32), DECL_NLA(x64)):
New declarations.
* nlattr.c (DECODE_NLA_INTEGER(x8, uint8_t, "%#" PRIx8),
DECODE_NLA_INTEGER(x16, uint16_t, "%#" PRIx16),
DECODE_NLA_INTEGER(x32, uint32_t, "%#" PRIx32),
DECODE_NLA_INTEGER(x64, uint64_t, "%#" PRIx64)): New decoders.
2018-06-06 15:10:37 +00:00
fd0cd658cc nlattr: add ethernet protocol decoder
* nlattr.h (DECL_NLA(ether_proto)): New declaration.
* nlattr.c (process_host_order, decode_nla_ether_proto): New functions.
2018-06-06 15:10:37 +00:00
79a02d029c nlattr: add value processing support for xlat/flags nlattr decoders
Needed for upcoming decoder of ethernet proto which is stored in the
host order and has to be converted to the network order before printing
as an xval constant.  This change also adds ability to provide
prefix/suffix in order to enclose the printed value in something that
describes the performed conversion.

* nlattr.h (struct decode_nla_xlat_opts): Add prefix, suffix, and
process_fn fields.
* nlattr.c (decode_nla_xval, decode_nla_flags): Handle process_fn,
prefix, snd uffix parameters.
2018-06-06 15:10:37 +00:00
bdc6ca9e56 nlattr: introduce decode_nla_flags
Similar to decode_nla_xval.

* nlattr.c (decode_nla_flags): New function.
* nlattr.h: (DECL_NLA(flags)): New declaration.
2018-06-06 15:10:37 +00:00
dbc5d26b29 nlattr: add ability to pass nla_type to decoder in decode_nlattr
As of now, it's impossible to introduce a dispatching nlattr decoder
that performs actions based on the type of the message, so let's use
a combination of zero decoder list size and non-zero decoder pointer
for this.

This is going to be used later in IFLA_AF_SPEC decoding.

* nlattr.c (decode_nlattr_with_data): Handle zero size and non-NULL
decoders in a special way.
(decode_nlattr): Add an error message about ignoring of opaque_data
argument when zero size and non-NULL decoders are provided.
* nlattr.h (decode_nlattr): Add a comment about the new special case.
2018-06-06 15:10:37 +00:00
88d6b7287c tests: use STRINGIFY instead of _STR
Remove _STR which is essentially the same as STRINGIFY but from
the namespace where we should not introduce new identifiers.

* tests/tests.h (_STR): Remove.
* tests/add_key.c (main): Replace _STR with STRINGIFY.
* tests/keyctl.c (XARG_STR): Likewise.
* tests/request_key.c (main): Likewise.
2018-06-06 10:10:43 +00:00
f7c6046026 tests: check decoding of IFLA_EVENT netlink attribute
* tests/nlattr_ifinfomsg.c (main): Add a check for IFLA_EVENT attribute
decoding.
2018-06-06 10:10:43 +00:00
41bfa3bf5f xlat: handle xlat constants that are not identifiers
Extend xlat generator to support such input lines as
	IPV4_DEVCONF_FORWARDING-1	0

This is going to be used later in IFLA_AF_SPEC decoding.

* xlat/gen.sh (cond_def): If the xlat value is not an identifier name,
extract an identifier name from the beginning of xlat value.
2018-06-05 11:04:09 +00:00
3a7d7d8f8c xlat.c: handle NULL xlat in lookup routines as incremental search
This is going to be used later in IFLA_AF_SPEC decoding.

* xlat.c (xlookup): Add static variable pos, store xlat there when it is
non-NULL, use pos for lookup.
(xlat_search, xlat_idx): Add static variables pos and memb_left, store
xlat and nmemb there when xlat is non-NULL, use them for lookup.
(printxvals_ex): Store the last non-NULL xlat in static variable "last".
If the first xlat argument is NULL, use "last" instead.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-05 11:04:09 +00:00
9fd42fc53a xlat.c: cleanup printxvals_ex a bit
* xlat.c (printxvals_ex): Change "str" variable visibility to the whole
function, jump to va_end instead of duplicating call and return, return
!!str.
2018-06-05 11:04:09 +00:00
27850e48f3 Leverage the fact that inet_protocols xlat is sorted
* defs.h (inet_protocols): Move up, add description.
(inet_protocols_size): New declaration.
* net.c (inet_protocols_size): New constant variable.
* nlattr.c (decode_nla_ip_proto): Specify xlat_size, set xt to XT_SORTED.
2018-06-05 11:04:09 +00:00
e390ab2427 Print arp_hardware_types as a sorted xlat
* rtnl_link.c (DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg)): Use
PRINT_FIELD_XVAL_SORTED_SIZED instead of PRINT_FIELD_XVAL for
arp_hardware_types.
* sock.c (print_ifreq): Likewise.
2018-06-04 16:18:14 +00:00
7d0396345d Provide a value for arp_hardware_types_size array
* defs.h (arp_hardware_types_size): New declaration.
* sockaddr.c (arp_hardware_types_size): New variable.
2018-06-04 16:18:14 +00:00
fd3aa07209 print_fields.h: introduce PRINT_FIELD_XVAL_SORTED_SIZED
For those cases when array definition is not readily available
and should be provided separately.

* print_fields.h (PRINT_FIELD_XVAL_SORTED_SIZED): New macro.
2018-06-04 16:18:14 +00:00
56f3d28453 tests/opipe.test: remove unneeded run_prog call
There is no need to invoke grep using run_prog.

* tests/opipe.test: Remove run_prog decoration for the grep invocation.
2018-06-04 16:18:14 +00:00
93ef3d32ab tests: check BPF_OBJ_GET_INFO_BY_FD decoding
* tests/bpf-obj_get_info_by_fd-prog-v.c: New file.
* tests/bpf-obj_get_info_by_fd-prog.c: Likewise.
* tests/bpf-obj_get_info_by_fd-v.c: Likewise.
* tests/bpf-obj_get_info_by_fd.c: Likewise.
* configure.ac (AC_CHECK_HEADERS): Check for struct bpf_insn,
struct bpf_map_info, and struct bpf_prog_info.
* tests/pure_executables.list: Add bpf-obj_get_info_by_fd,
bpf-obj_get_info_by_fd-v, bpf-obj_get_info_by_fd-prog, and
bpf-obj_get_info_by_fd-prog-v.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (bpf-obj_get_info_by_fd,
bpf-obj_get_info_by_fd-v, bpf-obj_get_info_by_fd-prog,
bpf-obj_get_info_by_fd-prog-v): New tests.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-04 01:11:05 +00:00
ebdc322480 bpf: enhance BPF_OBJ_GET_INFO_BY_FD decoder further
* bpf.c (print_ebpf_prog): Remove "decode" argument, all users updated.
(print_bpf_prog_info): Use the minimum of xlated_prog_len values on
entering and exiting syscall as the size of xlated_prog_insns array
to be decoded.  Likewise, use the minimum of nr_map_ids values on entering
and exiting syscall as the size of map_ids array to be decoded.
2018-06-04 01:11:05 +00:00
05813058ed bpf: enhance BPF_OBJ_GET_INFO_BY_FD decoder
* bpf.c (print_bpf_map_info): Print only those fields that are
present in the structure, as it has been growing over time.
(print_bpf_prog_info): Likewise.  Print map_ids field as an array
of uint32_t instead of uint64_t; print "name" field.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-02 16:32:10 +00:00
ec27280cf3 bpf: move handling of the saved state to BPF_OBJ_GET_INFO_BY_FD decoder
As it is needed for proper info_len printing on exiting.

* bpf.c (print_bpf_obj_info_fn): Change return type to void, add "saved"
argument.
(struct obj_get_info_saved): New type definition.
(print_bpf_map_info, print_bpf_prog_info): Change return type to void,
add "saved" argument, do not handle private tcb data allocation and
obtainment.
(print_bpf_obj_info_addr): Change return type to void, add tcb argument,
print the address only on exiting.
(print_bpf_obj_info): Change return type to void, add "saved" argument.
(BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Handle private data
allocation/saving/restoring, use it for storing/printing info_len field.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-02 16:32:10 +00:00
712fd66dfb bpf: print log_buf field as a string
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print log_buf field
as a string.
* tests/bpf.c: Update expected output.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-02 16:32:10 +00:00
bcac74438d bpf: print xlated_prog_insns only when xlated_prog_len had not been 0
If xlated_prog_len is zero on entering syscall and non-zero on exiting,
the program itself is not written into xlated_prog_insns.

* bpf.c (print_ebpf_prog): Add decode argument, print the address only
if decode is false.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Specify decode == true argument
to print_ebpf_prog.
(print_bpf_prog_info): Specify saved xlated_prog_len as decode argument
to print_ebpf_prog.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-02 16:32:10 +00:00
d4b2f1c4b6 bpf: move print_big_u64_addr inside print_ebpf_prog
* bpf.c (print_ebpf_prog): Add static qualifier.  Change the type
of "addr" argument from kernel_ulong_t to uint64_t, print it using
print_big_u64_addr.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD), print_bpf_prog_info): Do not call
print_big_u64_addr before print_ebpf_prog.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-06-02 16:32:10 +00:00
401818ec3f bpf_attr.h: add ATTRIBUTE_ALIGNED(8) to all fields of type uint64_t
Our policy is that all fields of type uint64_t in this header file
must have this attribute.

This shouldn't cause any contradictions with <linux/bpf.h>
unless the latter is buggy.

By word "buggy" I mean containing such changes as Linux kernel commit
v4.16-rc1~123^2~109^2~5^2~4.

* bpf_attr.h (struct BPF_MAP_UPDATE_ELEM_struct): Add
ATTRIBUTE_ALIGNED(8) to "flags" field.
(struct bpf_prog_info_struct): Add ATTRIBUTE_ALIGNED(8) to "load_time"
field.
2018-06-02 16:32:10 +00:00
c0c2117be0 tests: cast printf arguments to short when %h format qualifier is used
Reported by clang.

* tests/mknod.c (main): Cast printf argument for %#03ho format to short.
* tests/mknodat.c (main): Likewise.
* tests/net-sockaddr.c (main): Cast printf argument for %hu format
to short.
* tests/semop.c (main): Likewise.
2018-06-02 16:32:10 +00:00
0773735c9d xlat/evdev_keycode.in: remove constants with duplicating values
Those are used for describing input device category and not specific
button.

Reported by clang.

* xlat/evdev_keycode.in (BTN_MOUSE, BTN_JOYSTICK, BTN_GAMEPAD, BTN_DIGI,
BTN_WHEEL, BTN_TRIGGER_HAPPY): Remove.
2018-06-02 16:32:10 +00:00
5c84cf7ddb configure.ac: include <sys/socket.h> before <linux/rtnetlink.h>
This is needed for old Linux UAPI headers that do no contain commit
v3.1-rc2~19^2~29.

* configure.ac: Include <sys/socket.h> before <linux/rtnetlink.h>
in AC_CHECK_* invocations.
2018-06-01 13:37:12 +00:00
45049d4a4d configure.ac: check for linux/rtnetlink.h instead of linux/if_link.h for declarations
Historically, type definitions and declarations related to netlink route
interface attributes were in linux/rtnetlink.h, later they were moved
elsewhere (first linux/if.h, then linux/if_link.h) with the inclusion
of the corresponding header file in linux/rtnetlink.h.

* configure.ac: Use <linux/rtnetlink.h> instead of <linux/if_link.h>
in checks for interface netlink attributes-related declarations
and definitions.
2018-06-01 13:37:12 +00:00
5c481739d7 m4: move the gawk script from m4/gen_bpf_attr_m4.sh into a separate file
As it turns out, old versions of gawk do not support -e option.

* m4/gen_bpf_attr_m4.sh: Move the gawk script ...
* m4/gen_bpf_attr_m4.awk: ... here.
2018-06-01 13:37:12 +00:00
514a667cc3 s390: wire up kexec_file_load syscall
* linux/s390/syscallent.h ([381]): Add kexec_file_load syscall.
* linux/s390/syscallent.h ([381]): Likewise.
2018-06-01 13:37:12 +00:00
08b2c1b82d tests: check short read of struct flock/flock64
* tests/fcntl-common.c (test_flock_einval): Check short read
of struct flock.
(test_flock64_einval): Check short read of struct flock64.
2018-06-01 01:46:06 +00:00
dbbe61067c tests: extend struct flock/flock64 decoding checks
* tests/fcntl-common.c (test_flock_einval, test_flock): Create
struct_kernel_flock object using tail_alloc.
(test_flock64_einval): Create struct_kernel_flock64 object using
tail_alloc.
* tests/fcntl64.c (test_flock64_lk64): Likewise.
2018-06-01 01:46:06 +00:00
d476d264de tests: extend F_OFD_* decoding checks
Check that non-faulty F_OFD_* fcntl operations are decoded properly.

* tests/fcntl-common.c: Include <string.h>.
(test_flock64_ofd): New function.
(test_flock64): Invoke it, remove [F_OFD_SETLK].
2018-06-01 01:46:06 +00:00
b6542c5068 tests/fcntl-common.c: define and initialize errstr
Initialize errstr inside invoke_test_syscall so that its users
won't have to go into trouble of caring about clobbering errno.

* tests/fcntl-common.c (errstr): New variable.
(invoke_test_syscall): Initialize it.
(test_flock_einval, test_flock64_einval, test_flock,
test_f_owner_ex_type_pid): Use it.
* tests/fcntl.c (test_flock64_undecoded): Likewise.
* tests/fcntl64.c (test_flock64_lk64): Likewise.
2018-06-01 01:46:06 +00:00
419da8e231 tests/fcntl-common.c: add fd argument to invoke_test_syscall
Extend invoke_test_syscall for later use with different file
descriptors.

* tests/fcntl-common.c (invoke_test_syscall): Add fd argument, pass it
to TEST_SYSCALL_NR syscall.  All users updated.
2018-06-01 01:46:06 +00:00
9c7052f403 tests: move F_OFD_SETLK* checks from fcntl64.c to fcntl-common.c
This change enables F_OFD_SETLK* tests for fcntl as well.

* tests/fcntl64.c (test_flock64): Rename to test_flock64_lk64.
[F_OFD_SETLK]: Remove.
(test_flock64_einval): Move ...
* tests/fcntl-common.c: ... here.
(test_flock64_lk64): New protype.
(test_flock64_einval, test_flock64): New functions.
* tests/fcntl.c (test_flock64_einval): Rename to test_flock64_undecoded.
(TEST_FLOCK64_UNDECODED): New macro.
(test_flock64): Rename to test_flock64_lk64, replace TEST_FLOCK64_EINVAL
with TEST_FLOCK64_UNDECODED.
2018-06-01 01:46:06 +00:00
3160ea8999 tests: move F_OWNER_* tests to fcntl-common.c
This change enables F_OWNER_* tests for fcntl64 as well.

* tests/fcntl.c: Move main, [TEST_FLOCK64_EINVAL],
and [TEST_F_OWNER_EX] ...
* tests/fcntl-common.c: ... here.
(test_flock64): New prototype.
* tests/fcntl64.c (main): Remove.
2018-06-01 01:46:06 +00:00
da78779d37 tests: rename struct_flock.c to fcntl-common.c
It is not limited to struct flock, more fcntl tests are going to land
in this file.

* tests/struct_flock.c: Rename to fcntl-common.c.
* tests/Makefile.am (EXTRA_DIST): Rename struct_flock.c
to fcntl-common.c.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
2018-06-01 01:46:06 +00:00
245df3c44b tests: check decoding of new FRA_* netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for struct fib_rule_port_range
in <linux/fib_rules.h>.
* tests/nlattr_fib_rule_hdr.c: Include <linux/in.h>.
(FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE, FRA_DPORT_RANGE): New
macro constants.
[!HAVE_STRUCT_FIB_RULE_PORT_RANGE] (struct fib_rule_port_range): New
type.
(main): Check decoding of new FRA_* netlink attributes.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-30 20:50:29 +00:00
6c3f75ecfa rtnl_rule: decode new FRA_* attributes
* nlattr.h (DECL_NLA(ip_proto), DECL_NLA(rt_proto)): New declarations.
* nlattr.c (decode_nla_ip_proto): New function.
* rtnl_route.c (decode_nla_rt_proto): Likewise.
* rtnl_rule.c (decode_rule_port_rang): Likewise.
(fib_rule_hdr_nla_decoders) <[FRA_PROTOCOL]>: New attribute, introduced
by Linux commit v4.17-rc1~148^2~371.
(fib_rule_hdr_nla_decoders) <[FRA_IP_PROTO], [FRA_SPORT_RANGE],
[FRA_DPORT_RANGE]>: New attributes, introduced by Linux commit
v4.17-rc1~148^2~328^2~4.
* xlat/rtnl_rule_attrs.in (FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE,
FRA_DPORT_RANGE): New constants.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-30 20:50:29 +00:00
01f39a8001 nlattr: introduce decode_nla_xval helper
* nlattr.c (decode_nla_xval): New function.
* nlattr.h: Include "xlat.h".
(struct decode_nla_xlat_opts): New type.
(DECL_NLA(xval)): New declaration.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-30 20:50:29 +00:00
4646db8e4d Move definitions of xlat_type and xlat_style from defs.h to xlat.h
* defs.h (enum xlat_type, enum xlat_style, XLAT_STYLE_FORMAT_SHIFT,
XLAT_STYLE_VERBOSITY_MASK, XLAT_STYLE_FORMAT_MASK, XLAT_STYLE_SPEC_BITS,
XLAT_STYLE_MASK): Move ...
* xlat.h: ... here.
2018-05-30 20:50:29 +00:00
607f2b5e58 travis: switch from gcc-7 to gcc-8
* .travis.yml (matrix): Change gcc-7 to gcc-8.
2018-05-30 14:44:55 +00:00
4a4c3aa762 tests: use syscall() for ioctl() calls with oversized arguments
* tests/ioctl_inotify.c (sys_ioctl): New function.
(main): Use sys_ioctl for ioctl calls with oversized arguments.
* tests/ioctl_loop.c: Likewise.
* tests/ioctl_perf.c: Likewise.
2018-05-30 14:44:55 +00:00
004742588e print_ifindex: respect xlat style settings
Print interface indices according to the preferred xlat style settings.

* print_ifindex.c (INI_PFX, INI_SFX): New helper macros.
[HAVE_IF_INDEXTONAME] (get_ifname): New function.
[HAVE_IF_INDEXTONAME] (print_ifindex): Implement as a wrapper around
get_ifname and print_xlat_ex.
2018-05-30 10:54:34 +00:00
bf15325cd6 tests/test_nlattr.h: fix pointer calculation in TEST_NLATTR_ARRAY, take 2
The old code works only when an array contains exactly two items.

* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Fix pointer address
for the case of incomplete read.
2018-05-30 10:54:34 +00:00
540d70fcb6 nlattr: print index names in netlink meminfo array
* xlat/netlink_sk_meminfo_indices.in: New file.
* nlattr.c: Include xlat/netlink_sk_meminfo_indices.h.
(decode_nla_meminfo): Use print_array_ex, pass
netlink_sk_meminfo_indices as index xlat table.
* tests/nlattr_inet_diag_msg.c: Update expected output.
2018-05-30 10:13:06 +00:00
10adc310cb Introduce ARRSZ_PAIR macro
A shorthand similar to ARG_STR in its purpose: it provides and ability
to pass an array an its size without variable name duplication.

* macros.h (ARRSZ_PAIR): New macro.
2018-05-30 10:13:06 +00:00
30fe991db8 print_array: add support for printing array indices
* defs.h (XLAT_STYLE_SPEC_BITS, XLAT_STYLE_MASK): New macro constants.
(tfetch_mem_fn, print_fn): New typedefs.
(enum print_array_flag_bits, enum print_array_flags): New enumerations.
(print_array_ex): Rename from print_array, add flags, index_xlat,
index_xlat_size, and index_dflt arguments.
(print_array): New static inline function, a thin wrapper around
print_array_ex.
util.c: Include "xlat.h".
(print_array): Rename to print_array_ex, add flags, index_xlat,
index_xlat_size, and index_dflt arguments.  Print array indices
according to the style settings specified by flags if PAF_PRINT_INDICES
is set.
2018-05-30 10:13:06 +00:00
eb2c0b8bdf Enhance printing of unfetchable object addresses in sequences and arrays
* btrfs.c (btrfs_print_tree_search): Print the address of unfetchable
object inside the sequence using printaddr_comment.
* msghdr.c (decode_msg_control): Likewise.
* execve.c (printargv): Print the address of unfetchable object inside
the array using printaddr_comment.
* netlink.c (fetch_nlmsghdr): Add in_array argument.  When in_array
is true, print the address of unfetchable object using
printaddr_comment.
* nlattr.c (fetch_nlattr): Likewise.
* tests/execve.c (main): Update expected output.
* tests/execveat.c (main): Likewise.
* tests/msg_control.c (test_scm_rights1, test_scm_rights2,
test_scm_security): Likewise.
* tests/netlink_protocol.c (send_query): Likewise.
* tests/nlattr.c (test_nlattr): Likewise.
2018-05-29 09:58:10 +00:00
d54388e1ce print_array: enhance printing of unfetchable object addresses
When umoven_func invocation fails to fetch data, it prints the faulty
address.  If this happens to a subsequent umoven_func invocation,
the printed address may be undistinguishable from a valid data printed
by print_func, e.g. when the data is printed in a numeric form like
[0x1, 0x2, 0x3, 0xdefaced].

Fix this source of confusion by moving the printing of the faulty
address from umoven_func to print_array itself.  This change renames
umoven_func to tfetch_mem_func and changes its semantics, so that
 - tfetch_mem_func never prints anything;
 - tfetch_mem_func returns true if the fetch succeeded,
   and false otherwise.

* defs.h (print_array): Replace umoven_func argument with
tfetch_mem_func.
* util.c (print_array): Replace umoven_func argument with
tfetch_mem_func, document expected tfetch_mem_func return value
semantics.  When tfetch_mem_func returns false, print either addr
or "... /* addr */" depending on the context (inside the array or not).
* bpf.c (print_ebpf_prog, print_bpf_prog_info,
BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Replace umoven_or_printaddr
argument of print_array with tfetch_mem.
* bpf_filter.c (print_bpf_fprog): Likewise.
* btrfs.c (btrfs_print_logical_ino_container,
btrfs_print_ino_path_container, btrfs_print_qgroup_inherit,
btrfs_ioctl): Likewise.
* dm.c (dm_decode_dm_target_deps): Likewise.
* epoll.c (epoll_wait_common): Likewise.
* file_ioctl.c (file_ioctl): Likewise.
* ipc_sem.c (tprint_sembuf_array): Likewise.
* kexec.c (print_kexec_segments): Likewise.
* mem.c (SYS_FUNC(subpage_prot)): Likewise.
* net.c (print_getsockopt): Likewise.
* netlink.c (decode_nlmsgerr_attr_cookie): Likewise.
* netlink_netlink_diag.c (decode_netlink_diag_groups): Likewise.
* netlink_packet_diag.c (decode_packet_diag_mclist): Likewise.
* netlink_unix_diag.c (decode_unix_diag_inode): Likewise.
* nlattr.c (decode_nla_meminfo): Likewise.
* numa.c (print_nodemask, SYS_FUNC(move_pages),
* perf_ioctl.c (perf_ioctl_query_bpf): Likewise.
* poll.c (decode_poll_entering): Likewise.
* printsiginfo.c (print_siginfo_array): Likewise.
* rtnl_tc.c (decode_tca_stab_data): Likewise.
* sock.c (decode_ifconf): Likewise.
* uid.c (print_groups): Likewise.
* io.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents)): Replace
umoven_or_printaddr argument of print_array with tfetch_mem.
(tprint_iov_upto): Replace umoven_or_printaddr_ignore_syserror
with tfetch_mem_ignore_syserror.
* v4l2.c (print_v4l2_format_fmt): Replace umoven_or_printaddr argument
of print_array with tfetch_mem.
(print_v4l2_ext_controls): Replace umoven_or_printaddr_ignore_syserror
with tfetch_mem_ignore_syserror.
* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Rename
to fetch_struct_mmsghdr_for_print, do not print address, return bool.
(decode_mmsgvec): Replace fetch_struct_mmsghdr_or_printaddr
with fetch_struct_mmsghdr_for_print.
* tests/aio.c (main): Update expected output.
* tests/bpf.c (print_BPF_PROG_QUERY_attr5): Likewise.
* tests/ioctl_perf-success.c (main): Likewise.
* tests/ioctl_v4l2.c (main): Update expected output.
* tests/kexec_load.c (main): Likewise.
* tests/mmsg_name.c (test_mmsg_name): Update expected output.
* tests/move_pages.c (print_page_array, print_node_array): Likewise.
* tests/poll.c (print_pollfd_array_entering): Likewise.
* tests/preadv-pwritev.c (main): Likewise.
* tests/preadv2-pwritev2.c (dumpio): Likewise.
* tests/process_vm_readv_writev.c (print_iov): Likewise.
* tests/pwritev.c (print_iovec): Likewise.
* tests/readv.c (main): Likewise.
* tests/seccomp-filter-v.c
* tests/semop.c (main): Likewise.
* tests/set_mempolicy.c (print_nodes): Likewise.
* tests/setgroups.c (main): Likewise.
* tests/test_nlattr.h (print_nlattr) Likewise.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-05-29 09:58:10 +00:00
143d007bbd Introduce tfetch_* family of functions and macros
These new functions are going to be used instead of umove_or_printaddr*
as umoven_func argument of print_array.

* defs.h (tfetch_mem64, tfetch_mem64_ignore_syserror): New
function prototypes.
(tfetch_mem, tfetch_mem_ignore_syserror): New static inline
wrappers.
(tfetch_obj): New macro wrapper around tfetch_mem.
* util.c (tfetch_mem64, tfetch_mem64_ignore_syserror): New
functions.
(umoven_or_printaddr64, umoven_or_printaddr64_ignore_syserror): Use
them.
2018-05-29 09:58:10 +00:00
ca84856654 Introduce printaddr_comment
* defs.h (printaddr_comment): New static inline wrapper around
tprintf_comment.
2018-05-29 09:58:10 +00:00
87faa97539 Turn printaddr into a thin wrapper around printaddr64
* util.c (printaddr): Move ...
* defs.h: ... here, add "static inline" qualifiers.
2018-05-29 09:58:10 +00:00
fa054ebf9b defs.h: add comments about umove* return values
* defs.h (umoven, umoven_or_printaddr64,
umoven_or_printaddr64_ignore_syserror, umovestr): Add comments about
return values.
2018-05-29 01:15:19 +00:00
b6cb4866e2 tests: use TAIL_ALLOC_OBJECT_CONST_PTR where appropriate
* tests/kcmp.c (main): Use TAIL_ALLOC_OBJECT_CONST_PTR.
* tests/modify_ldt.c (main): Likewise.
* tests/netlink_protocol.c (send_query): Likewise.
* tests/ptrace.c (test_peeksiginfo, main): Likewise.
* tests/s390_guarded_storage.c (main): Likewise.
* tests/s390_sthyi.c (main): Likewise.
* tests/xet_thread_area_x86.c (main): Likewise.
2018-05-28 17:34:50 +00:00
ccde0129ea bpf: decode bpf_attr.info field used by BPF_OBJ_GET_INFO_BY_FD command
* bpf_attr.h [!BPF_TAG_SIZE] (BPF_TAG_SIZE): Define.
[BPF_TAG_SIZE]: Check that BPF_TAG_SIZE is 8.
(struct bpf_map_info_struct, struct bpf_prog_info_struct): New
structures.
(bpf_map_info_struct_size, expected_bpf_map_info_struct_size,
bpf_prog_info_struct_size, expected_bpf_prog_info_struct_size): New
macro constants.
* bpf.c (print_bpf_obj_info_fn): New type.
(print_bpf_map_info, print_bpf_prog_info, fetch_bpf_obj_info,
print_bpf_obj_info_addr, print_bpf_obj_info): New functions.
(BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Print bpf_fd and info_len
fields only on entering, call print_bpf_obj_info for printing info field.
* tests/bpf.c (BPF_OBJ_GET_INFO_BY_FD_checks): Print info field
as a pointer.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-28 17:34:50 +00:00
9228e78d4f bpf: add support for checking structures outside union bpf_attr
struct bpf_prog_info and bpf_map_info need essentially the same handling
as union bpf_attr.

* gen_bpf_attr_check.sh: Derive type_name from $struct if it doesn't
start with "BPF_", derive TYPE_NAME from type_name, use them in code
generation.
* m4/gen_bpf_attr_m4.sh: Rewrite parsing/generation code into awk,
add support for structures outside union bpf_attr.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-28 17:34:50 +00:00
dae6367f18 bpf: remove bpf_priv_data
As various bpf commands need different data to save between entering
and exiting of the syscall, do not emulate union bpf_attr approach.

* bpf.c (struct bpf_priv_data): Remove.
(DECL_BPF_CMD_DECODER): Remove "struct bpf_priv_data *" argument.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use set_tcb_priv_ulong
and get_tcb_priv_ulong to keep bpf_attr.query.prog_cnt field.
(SYS_FUNC(bpf)): Remove priv variable, do not initialize it,
and do not pass it to bpf_cmd_decoders.
2018-05-28 17:34:50 +00:00
ee96027445 tests: add union bpf_attr.query.prog_ids field decoding checks
* tests/bpf-success-v.c: New file.
* tests/bpf-success.c: Likewise.
* tests/bpf-success-v.test: New test.
* tests/bpf-success.test: Likewise.
* tests/.gitignore: Add bpf-success and bpf-success-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add bpf-success.test and bpf-success-v.test.
* tests/bpf.c [INJECT_RETVAL] (sys_bpf): Check that retuned value
is equivalent to the injected one; append "(INJECTED)" string to errstr.
(prog_load_ids, prog_load_ids_ptr): New variables.
(init_BPF_PROG_QUERY_attr4, print_BPF_PROG_QUERY_attr4,
init_BPF_PROG_QUERY_attr5, print_BPF_PROG_QUERY_attr5): New functions.
(BPF_PROG_QUERY_checks): Drop "const" qualifier, add new checks.
2018-05-28 17:34:50 +00:00
c3b04cdf6e bpf: BPF_PROG_QUERY bpf_attr.query.prog_ids printing fixes
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use
print_uint32_array_member instead of print_uint64_array_member for
printing prog_ids elements (and change the type of prog_id_buf from
uint64_t to uint32_t), as they are 32-bit; use common trick with
print_big_u64_addr for handling possible ambiguity with prog_ids
address.
* tests/bpf.c (BIG_ADDR_MAYBE): New macro.
(BPF_PROG_QUERY_checks): Update expected output.
2018-05-28 17:34:50 +00:00
d8dfba18be bpf: add support for instruction decoding
* xlat/ebpf_regs.in: New file.
* bpf.c (struct ebpf_insn, struct ebpf_insns_data): New type definitions.
(print_ebpf_insn, print_ebpf_prog): New functions.
(DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Use them.
2018-05-28 17:34:50 +00:00
bd19a4d271 tests: check decoding of successful PERF_EVENT_IOC_{ID,QUERY_BPF} ioctls
As these have some argument output on the exit path.

* tests/ioctl_perf-success.c: New file.
* tests/ioctl_perf-success.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
(check_PROGRAMS): Add ioctl_perf-success.
* tests/.gitignore: Likewise.
* tests/ioctl_perf.c: Remove TODO.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-28 17:34:50 +00:00
7adb5a2f9e Implement PERF_EVENT_IOC_* decoding
* perf.c (fetch_perf_event_attr, print_perf_event_attr): Remove "static"
qualifier.
* defs.h (fetch_perf_event_attr, print_perf_event_attr): New
declarations.
* perf_event_struct.h (struct perf_event_query_bpf): New type
definition.
* perf_ioctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/perf_ioctl_cmds.in: New file.
* xlat/perf_ioctl_flags.in: Likewise.
* ioctl.c (ioctl_decode) <case '$'>: Call perf_ioctl.
* tests/gen_tests.in (ioctl_perf): New test.
* tests/ioctl_perf.c: New file.
* tests/pure_executables.list: ioctl_perf.
* tests/.gitignore: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-28 17:34:50 +00:00
d5c63293c1 tests: fix ipc_msgbuf.test
* tests/ipc_msgbuf.test: Fix -a argument.
2018-05-28 17:34:50 +00:00
e1d94ea918 xlat: update IPPROTO_* constants
* xlat/inet_protocols.in (IPPROTO_GGP, IPPROTO_HELLO, IPPROTO_ND):
Remove, not defined in Linux.
(IPPROTO_BEETPH): New constant, introduced by Linux commit
v2.6.19-rc1~33^2.
(IPPROTO_L2TP): New constant, introduced by Linux commit
v2.6.35-rc1~473^2~594.
(IPPROTO_MH): New constant, introduced by Linux commit
v2.6.19-rc1~1272^2~157.
Add default values to constants, sort the file.
2018-05-25 09:15:03 +00:00
970eacfcdb xlat: add fallback definitions to RTPROT_* constants
* xlat/routing_protocols.in: Add default values to constants.
2018-05-25 09:15:03 +00:00
5cf62f3e7a xlat: add SECCOMP_FILTER_FLAG_SPEC_ALLOW
* xlat/seccomp_filter_flags.in (SECCOMP_FILTER_FLAG_SPEC_ALLOW): New
constant, introduced by Linux commit v4.17-rc3-24-g00a02d0.
* tests/seccomp-filter.c: Update expected output.
* tests/seccomp-filter-v.c: Likewise.
2018-05-25 09:15:03 +00:00
be0d6a847b prctl: add PR_GET_SPECULATION_CTRL/PR_SET_SPECULATION_CTRL decoding
* xlat/pr_spec_cmds.in: New fille.
* xlat/pr_spec_get_store_bypass_flags.in: Likewise.
* xlat/pr_spec_set_store_bypass_flags.in: Likewise.
* xlat/prctl_options.in (PR_GET_SPECULATION_CTRL,
PR_SET_SPECULATION_CTRL): New constants, introduced by Linux commit
v4.17-rc3-15-gb617cfc.
* prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL,
case PR_SET_SPECULATION_CTRL>: Implement decoding of new prctl options.
* tests/Makefile.am (check_PROGRAMS): Add prctl-spec-inject.
(DECODER_TESTS): Add prctl-spec-inject.test.
* tests/prctl-spec-inject.c: New file.
* tests/prctl-spec-inject.test: New test.
* tests/.gitignore: Add prctl-spec-inject.
2018-05-25 09:15:03 +00:00
42c9ff9cfe tests: add keyctl variants with different xlat verbosity levels
* tests/keyctl-Xabbrev.c: New file.
* tests/keyctl-Xraw.c: Likewise.
* tests/keyctl-Xverbose.c: Likewise.
* tests/keyctl.c (XARG_STR): New macro.
(do_keyctl): Print command in accordance with XLAT_RAW/XLAT_VERBOSE settings.
(main): Update expected output.
* tests/pure_executables.list: Add keyctl-Xabbrev, keyctl-Xraw,
and keyctl-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (keyctl-Xabbrev, keyctl-Xraw, keyctl-Xverbose): New
tests.
2018-05-25 09:15:03 +00:00
22aa768c1d keyctl: print KEYCTL_SET_REQKEY_KEYRING argument as an integer
* xlat/key_reqkeys.in: Add #val_type int.
* keyctl.c (SYS_FUNC(keyctl)) <case KEYCTL_SET_REQKEY_KEYRING>: Print
arg2 as an integer.
* tests/keyctl.c: Update expected output.
2018-05-25 09:15:03 +00:00
4105c9fb5d keyctl: respect xlat style when printing errno
* keyctl.c (keyctl_reject_key): Use print_xlat_ex for printing error
argument.
2018-05-25 09:15:03 +00:00
798fef882a syscall.c: unify error value printing
There's little reason not to decode error code for syscalls printed in
raw; moreover, it creates inconsistencies for unknown syscall printing.

Another issue was with error numbers unknown to strace: previously, they
were printed as "... = -1 1234 (Unknown error 1234)" which looked kinda
weird.

* syscall.c (print_err_ret): New function.
(syscall_exiting_trace): Remove u_error variable, use tcp->u_error
instead. Remove u_error_str variable.
(syscall_exiting_trace) <if (raw(tcp))>: Call print_err_ret if u_error
is non-zero.
(syscall_exiting_trace) <if (!(sys_res & RVAL_NONE) && tcp->u_error)>:
Use print_err_ret for default error printing.
* tests/nsyscalls.c [!LINUX_MIPSO32] (test_syscall): Update expected
output.
* tests/qual_fault.c (invoke) <if (is_raw)>: Likewise.
* strace.1.in (.SH DESCIPTION): Update unknown syscall example.
2018-05-25 09:15:03 +00:00
07a4f1954a ioctl: implement INOTIFY_IOC_SETNEXTWD decoding
* inotify_ioctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (DECL_IOCTL(inotify)): New declaration.
* ioctl.c (ioctl_decode) <case 'I'>: Call inotify_ioctl.
* tests/ioctl_inotify.c: New file.
* tests/.gitignore: Add ioctl_inotify.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (ioctl_inotify): New test.
2018-05-25 09:15:03 +00:00
597bfc6e1f tests/test_nlattr.h: avoid testing cropped objects of size 1
* tests/test_nlattr.h (TEST_NLATTR_OBJECT_EX_): Check
"len < sizeof(obj_)" case only if "sizeof(obj_) > 1".
2018-05-25 09:15:03 +00:00
d809cd9639 tests: pass index to print_elem_ callback in TEST_NLATTR_ARRAY
* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Pass array index to the
print_elem_ callback.
* tests/nlattr_inet_diag_msg.c (print_uint): Add index argument.
* tests/nlattr_netlink_diag_msg.c (print_xlong): Likewise.
* tests/nlattr_packet_diag_msg.c (print_packet_diag_mclist,
print_sock_filter): Likewise.
* tests/nlattr_unix_diag_msg.c (print_uint): Likewise.
2018-05-25 09:15:03 +00:00
e73a3cdb45 tests: further cleanup bpf big address checks
Replace BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT with BIG_ADDR().

* tests/bpf.c (BIG_ADDR): New macro.
(BIG_ADDR_IS_64BIT, BIG_ADDR_IS_32BIT): Remove.
(BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
BPF_RAW_TRACEPOINT_OPEN_checks): Use BIG_ADDR() instead of
BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT.
2018-05-24 12:23:39 +00:00
c1ed4aa030 tests: cleanup bpf big address checks
Introduce BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT to reduce redundancy.

* tests/bpf.c (BIG_ADDR_IS_64BIT, BIG_ADDR_IS_32BIT): New macros.
(BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
BPF_RAW_TRACEPOINT_OPEN_checks): Use them.
2018-05-23 23:27:43 +00:00
03b50140c7 bpf: add support for BPF_RAW_TRACEPOINT_OPEN command decoding
* bpf_attr.h (struct BPF_RAW_TRACEPOINT_OPEN_struct): New type
definition.
(BPF_RAW_TRACEPOINT_OPEN_struct_size,
expected_BPF_RAW_TRACEPOINT_OPEN_struct_size): New macros.
* xlat/bpf_commands.in (BPF_RAW_TRACEPOINT_OPEN): New constant,
introduced by Linux commit v4.17-rc1~148^2~19^2~4^2~3.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_RAW_TRACEPOINT): Likewise.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_RAW_TRACEPOINT_OPEN)): New bpf
command decoder.
(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add
BPF_CMD_ENTRY(BPF_RAW_TRACEPOINT_OPEN).
* tests/bpf.c (union bpf_attr_data): Add
BPF_ATTR_DATA_FIELD(BPF_RAW_TRACEPOINT_OPEN).
(BPF_PROG_LOAD_checks): Update.
(init_BPF_RAW_TRACEPOINT_attr2): New function.
(BPF_RAW_TRACEPOINT_OPEN_checks): New checks array.
(main) <checks>: Add CHK(BPF_RAW_TRACEPOINT_OPEN).
2018-05-23 23:27:43 +00:00
9b2605de2d bpf: add support for decoding struct bpf_attr.expected_attach_type field
* bpf_attr.h (struct BPF_PROG_LOAD_struct): Add expected_attach_type
field.
(BPF_PROG_LOAD_struct_size): Update to offsetofend of
expected_attach_type field.
(expected_BPF_PROG_LOAD_struct_size): Update to 72.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Decode
expected_attach_type field.
* tests/bpf.c: Update expected output.
2018-05-23 23:27:43 +00:00
0f1cf622ba nlattr: do not assume that SK_MEMINFO_VARS is constant
SK_MEMINFO_VARS changes over time (as it was in Linux commit
v4.7-rc1~154^2~354^2~4, for example), so we cannot use it
for sanity checks.

* nlattr.c (print_meminfo): Remove.
(decode_nla_meminfo): Use generic print_uint32_array_member element
printer callback.
* tests/nlattr_inet_diag_msg.c (main): Update expected output.
2018-05-23 23:27:43 +00:00
4245bdfe41 Introduce print_uint32_array_member helper function
Analogous to print_int32_array_member, this helper is going to be used
in various decoders, including BPF_PROG_QUERY, PERF_EVENT_IOC_*,
and netlink meminfo.

* defs.h (print_uint32_array_member): New declaration.
* util.c (print_uint32_array_member): New function.
2018-05-23 23:27:43 +00:00
ddf97dcf74 Introduce print_int32_array_member helper function
Analogous to print_uint64_array_member, this helper is going to be used
for IFLA_AF_SPEC decoding.

* defs.h (print_int32_array_member): New declaration.
* util.c (print_int32_array_member): New function.
2018-05-23 23:27:43 +00:00
8aa2908a4d defs.h: move print_uint64_array_member and print_array declarations down
In preparation for the forthcoming changes.
2018-05-23 23:27:43 +00:00
acd3d3e992 tests/test_nlattr.h: fix pointer calculation in TEST_NLATTR_ARRAY
The old code works only when an array contains exactly two items.

* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Fix pointer address
for the case of incomplete read.
2018-05-23 23:27:43 +00:00
7ff51ab3d8 sockaddr: add support for sockaddr_l2 without l2_bdaddr_type
Apparently, struct sockaddr_l2 changed over time: the l2_bdaddr_type
field was added only by commit v3.5-rc1~35^2~3^2~18^2^2~39.

* configure.ac (AC_CHECK_HEADERS): Move bluetooth/bluetooth.h check into
a separate check.
(AC_CHECK_HEADERS([bluetooth/bluetooth.h])): New check, also checks for
struct sockaddr_l2.l2_bdaddr_type member in case of success.
* sockaddr.c (print_sockaddr_data_bt) <case offsetof(struct sockaddr_l2,
l2_bdaddr_type)>: Add to sizeof(struct sockaddr_l2) case. Print
l2_bdaddr_type field only if the provided sockaddr is big enough.
* tests/net-sockaddr.c (check_l2): Put l2_bdaddr_type usage/printing
under HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE ifdef, add a check for the
sockaddr_l2 structure without the l2_bdaddr_type field.
2018-05-23 23:27:43 +00:00
a112d4a0fd sock: guess ifr_hwaddr size in SIOCSIFHWADDR/SIOCGIFHWADDR
And make the output more structured.

* sock.c: Include xlat/arp_hardware_types.h in XLAT_MACROS_ONLY mode.
(print_ifreq) <case SIOCSIFHWADDR, case SIOCGIFHWADDR>: Introduce
hwaddr_sizes array, print ifr_hwaddr.sa_family, print ifr_hwaddr.sa_data
using hwaddr_sizes and PRINT_FIELD_MAC_SZ.
2018-05-23 23:27:43 +00:00
df9ddd8632 Simplify errnoent and signalent
Remove personality support for errnoent and signalent as
there is nothing personality-specific in these files.

* linux/aarch64/errnoent1.h: Remove.
* linux/aarch64/signalent1.h: Likewise.
* linux/powerpc64/errnoent1.h: Likewise.
* linux/powerpc64/signalent1.h: Likewise.
* linux/riscv/errnoent1.h: Likewise.
* linux/riscv/signalent1.h: Likewise.
* linux/s390x/errnoent1.h: Likewise.
* linux/s390x/signalent1.h: Likewise.
* linux/sparc64/errnoent1.h: Likewise.
* linux/sparc64/signalent1.h: Likewise.
* linux/tile/errnoent1.h: Likewise.
* linux/tile/signalent1.h: Likewise.
* linux/x32/errnoent1.h: Likewise.
* linux/x32/signalent1.h: Likewise.
* linux/x86_64/errnoent1.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/x86_64/signalent1.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* Makefile.am (EXTRA_DIST): Remove them.
* defs.h (errnoent0): Rename to errnoent.
(signalent0): Rename signalent.
(nerrnos, nsignals): Change to const variables unconditionally.
* syscall.c (errnoent0): Rename to errnoent.
(signalent0): Rename signalent.
(nerrnos, nsignals): Change to const variables unconditionally.
(nerrnos0, nsignals0): Remove.
[SUPPORTED_PERSONALITIES > 1] (errnoent1, signalent1, nerrnos1,
nsignals1): Remove.
[SUPPORTED_PERSONALITIES > 2] (errnoent2, signalent2, nerrnos2,
nsignals2): Likewise.
(set_personality): Do not assign errnoent, signalent, nerrnos,
and nsignals.
2018-05-22 01:08:31 +00:00
0a5cc72a62 strace.1.in: mention -Xraw in -eraw description
* strace.1.in (\fB\-e\ raw\fR=\,\fIset\fR): Mention -X raw.
2018-05-21 11:02:54 +00:00
e453f28934 strace.1.in: display -k option description only if it is enabled
Leverage the fact that manpage is generated and add condition statements
around mentions of -k option.

* strace.1.in (.SH SYNOPSIS): Put option list inside an
".if '@ENABLE_STACKTRACE_TRUE@'#' .ig end_unwind_opt ... .end_unwind_opt"
condition; add a second list of options without -k and put it inside
".if '@ENABLE_STACKTRACE_FALSE@'#' .ig end_no_unwind_opt ... .end_no_unwind_opt"
condition.
(.SS Output format) <-k>: Put it inside
".if '@ENABLE_STACKTRACE_TRUE@'#' .ig end_unwind ... .end_unwind"
condition, remove the mention of --enable-stacktrace configuration
option requirement.
2018-05-21 11:02:54 +00:00
4531bae51a strace.1.in: format a reference to "open" syscall using bold font
* strace.1.in (.SH DESCRIPTION): Format a reference to "open" syscall
using bold font.
2018-05-21 11:02:54 +00:00
48af7b3c25 tests/qual_fault.test: add -efu arguments to the interpreter
* tests/qual_fault.test (#!/bin/sh): Add -efu arguments.
2018-05-21 11:02:54 +00:00
fbfe5335e5 tests/qual_fault.test: swap expected/output files in match_diff calls
match_diff expects the first argument as strace output and the second
argument as expected output.

* tests/qual_fault.test (check_fault_injection): Swap arguments
in match_diff calls.
2018-05-21 11:02:54 +00:00
25efe1822a defs.h: convert some macro wrappers into static inline functions
* defs.h (pathtrace_select, pathtrace_match, printxval_searchn,
printxval_indexn, sprintxval, sprintflags, printnum_slong,
printnum_ulong, printnum_ptr, printnum_kptr): Convert macro wrappers
into static inline functions.
2018-05-21 11:02:54 +00:00
3869880887 xlat: add support for xlat_styles in printxval_dispatch
* defs.h (printxval_dispatch_ex): Rename from printxval_dispatch, add
style argument.
(printxval_dispatch): New static inline function, a thin wrapper around
printxval_dispatch_ex.
* xlat.c (printxval_dispatch): Rename to printxval_dispatch_ex, add
style argument, handle it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-21 11:02:54 +00:00
947627ed15 Make printxval_dispatch publicly available
* evdev.c (enum xlat_type, printxval_dispatch): Move elsewhere.
* defs.h (enum_xlat_type): Move from evdev.c.
(printxval_dispatch): New declaration.
* xlat.c (printxval_dispatch): Move from evdev.c, drop static qualifier.
2018-05-21 11:02:54 +00:00
095f97cab5 Revert "evdev: remove XT_NORMAL"
This reverts commit cc52da10c6
in preparation for printxval_dispatch generalisation.

* evdev.c (enum xlat_type): Add XT_NORMAL back.
(printxval_dispatch): Handle XT_NORMAL again.
2018-05-21 11:02:54 +00:00
c6143f3e41 defs.h: introduce is_bigendian macro
This macro is going to be used in inline checks.

* defs.h (is_bigendian): New macro constant.
2018-05-21 11:02:54 +00:00
0b578fd0ba util.c: make memory allocation error messages more informative
As those are pretty unusual, let's add some additional information
that can be reported by users.

* util.c (print_quoted_string_ex, dumpstr): Add reasons for memory
allocation errors.
(sizeof_iov): Change type from size_t to unsigned int.
(dumpiov_upto): Rewrite size initialisation similarly to the way it's
done in print_quoted_string_ex, add reasons for memory allocation errors.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-21 11:02:54 +00:00
11eb621896 strace.1.in: fix -A description
* strace.1.in (.SS Output format) <-A>: Add missing .B.
2018-05-19 09:15:27 +00:00
bca93b2a18 strace.1.in: document x32 64-bit syscall peculiarity
* strace.1.in (.SH NOTES): Document "#64" suffix for 64-bit syscalls on
x32.
2018-05-19 09:15:27 +00:00
299fa3fcac linux/x32/syscallent.h: change 64-bit syscall designation
The current way of designation of 64-bit specific syscalls in x32
personality not only conflicts with fault injection specification
syntax, but also makes it impossible to specify such syscalls at all
(since everything that starts from a digit is considered a syscall
number specification).  So, let's change prefix to suffix and use
octothorpe instead of colon as a separator.

* linux/x32/syscallent.h (13, 15, 16, 19, 20, 45, 46, 47, 54, 55, 59,
101, 127, 128. 129, 131, 134, 156, 174, 177, 178, 180, 205, 206, 209,
211, 214, 215, 222, 236, 244, 246, 247, 273, 274, 278, 279, 295, 296,
297, 299, 307, 310, 311, 32, 327, 328): Change "64:" prefix to "#64"
suffix in syscall name.

Closes: https://github.com/strace/strace/issues/36
2018-05-19 09:15:27 +00:00
871a9107df xlat: add BPF_PROG_TYPE_SK_MSG
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_MSG): New constant,
introduced by Linux commit v4.17-rc1~148^2~156^2~1^2~13.
* tests/bpf.c (BPF_PROG_LOAD_checks): Update expected output.
2018-05-19 09:15:27 +00:00
b532e92c6e xlat: update bpf_attach_type constants
* xlat/bpf_attach_type.in (BPF_SK_MSG_VERDICT): New constant,
introduced by Linux commit v4.17-rc1~148^2~156^2~1^2~13.
(BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND): New constants,
introduced by Linux commit v4.17-rc1~148^2~19^2^2~6.
(BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT): New constants,
introduced by Linux commit v4.17-rc1~148^2~19^2^2~3.
(BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND): New constants,
introduced by Linux commit v4.17-rc1~148^2~19^2^2~1.
* tests/bpf.c (BPF_PROG_QUERY_checks): Update expected output.
2018-05-19 09:15:27 +00:00
2604ea997b xlat/sock_rds_options.in: make it sorted
Define SO_TIMESTAMP twice, for PA-RISC and all the other architectures.

* xlat/sock_rds_options.in [!__hppa__] (SO_TIMESTAMP): Define to 29.
[__hppa__] (SO_TIMESTAMP): Define to 0x4012.
* net.c (print_sockopt_fd_level_name) <case SOL_RDS>: Use
printxval_search instead of printxval.
2018-05-19 09:15:27 +00:00
a94e301a9f Update ioctl entries from linux v4.17
* linux/32/ioctls_inc_align16.h: Update from linux v4.17-rc5
using ioctls_gen.sh.
* linux/32/ioctls_inc_align32.h: Likewise.
* linux/32/ioctls_inc_align64.h: Likewise.
* linux/64/ioctls_inc.h: Likewise.
* linux/x32/ioctls_inc0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.
2018-05-17 22:54:45 +03:00
d29f44fd49 maint: update for linux 4.17-rc5
* maint/ioctls_sym.sh: (x86_list): Add KVM_HYPERV_EVENTFD.
2018-05-17 22:54:35 +03:00
cb3a15fe21 bpf: use indexed lookups where appropriate
* xlat/bpf_attach_type.in: Add "#value_indexed" directive.
* xlat/bpf_class.in: Likewise.
* xlat/bpf_map_types.in: Likewise.
* xlat/bpf_map_update_elem_flags.in: Likewise.
* xlat/bpf_prog_types.in: Likewise.
* xlat/ebpf_class.in: Likewise.
* bpf_filter.c (print_bpf_filter_code): Use printxval_index
instead of printxval for decoding bpf_class and ebpf_class.
* print_fields.h (PRINT_FIELD_XVAL_INDEX): New macro.
* bpf.c: Use it instead of PRINT_FIELD_XVAL for decoding bpf_attach_type,
bpf_map_types, bpf_map_update_elem_flags, and bpf_prog_types.
2018-05-16 10:58:32 +00:00
dbaa7ae9b4 bpf: use printxval_index lookup instead of printxval
* xlat/bpf_commands.in: Add "#value_indexed" directive.
* bpf.c (SYS_FUNC(bpf)): Use printxval_index instead of printxval.
2018-05-15 21:41:47 +00:00
4e0c0becf9 time: use indexed lookups
* defs.h (xlat_idx): New prototype.
* xlat.c (xlat_idx): Remove static qualifier.
* time.c (do_adjtimex): Use xlat_idx instead of xlookup.
(SYS_FUNC(getitimer), SYS_FUNC(setitimer)): Use printxval_index
instead of printxval.
[ALPHA] (SYS_FUNC(osf_getitimer), SYS_FUNC(osf_setitimer)): Likewise.
(printclockname) [CLOCKID_TO_FD]: Likewise.
* xlat/adjtimex_state.in: Add "#value_indexed" directive.
* xlat/clocknames.in: Likewise.
* xlat/cpuclocknames.in: Add "#value_indexed" directive, add default
values to constants.
* xlat/itimer_which.in: Likewise.
2018-05-15 21:41:47 +00:00
0c75ebaad0 linux/arm/raw_syscall.h: avoid r7 specified register variables with Thumb
If Thumb code is being generated and frame pointers are enabled, the
Thumb frame pointer in r7 clashes with any local variable which may
need to be assigned to r7 (e.g. the syscall NR when making a raw
syscall).

With gcc, the double use of r7 results in a build error, e.g.

  strace-4.22/tests/inject-nf.c:86:1: error: r7 cannot be used in asm here

With clang, the double use of r7 can result in the compiler silently
generating broken code which crashes at run time due to frame pointer
corruption:

  https://bugs.llvm.org/show_bug.cgi?id=34165

In most cases the problem isn't visible as frame pointers will be
disabled automatically due to optimisation level. However to handle
cases where frame pointers are enabled (e.g. when CFLAGS etc are set
to support a debug build, etc) provide a version of raw_syscall_0
which manually saves and restores the frame pointer value in r7
to a temporary register before setting up the syscall NR in r7
and invoking the syscall.

* linux/arm/raw_syscall.h (raw_syscall_0) [__thumb__]: Provide
an alternative version.

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
2018-05-15 21:41:47 +00:00
3ab43e0228 sockaddr: use printxval_index lookup instead of printxval
* xlat/addrfams.in: Add "#value_indexed" directive.
* xlat/af_packet_types.in: Likewise.
* xlat/hci_channels.in: Likewise.
* sockaddr.c (print_sockaddr_data_bt, print_sockaddr,
* print_sockaddr_data_ll): Use printxval_index instead of printxval.
2018-05-15 21:41:47 +00:00
c89c8faa63 sockaddr: use printxval_search for ARPHRD_* constants
This xlat table is quite big.

* sockaddr.c (print_sockaddr_data_ll): Replace printxval call with
printxval_search for printing of struct sockaddr_ll.sll_hatype field.
2018-05-15 21:41:47 +00:00
dc7901f5c3 Add a common MAC address printing routine
* print_mac.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprint_mac_addr): New declaration.
(print_mac_addr): New function, a thin wrapper around sprint_mac_addr.
* print_fields.h (PRINT_FIELD_MAC, PRINT_FIELD_MAC_SZ): New macros.
* rtnl_link.c (decode_ifla_bridge_id): Use PRINT_FIELD_MAC for bridge
address printing.
* sock.c (print_ifreq) <case SIOCGIFHWADDR>: Use print_mac_addr for
ifr_hwaddr printing.
* sockaddr.c (print_sockaddr_data_bt): Use print_mac_addr for
{sco,rc,l2}_bdaddr field printing.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-15 21:41:47 +00:00
2d82c2c50a sockaddr: decode Bluetooth L2 CID values
* xlat/bluetooth_l2_cid.in: New file.
* sockaddr.c: Include xlat/bluetooth_l2_cid.h.
(print_bluetooth_l2_cid): New function.
(print_sockaddr_data_bt): Use it to decode struct sockaddr_l2.l2_cid
field.
* tests/net-sockaddr.c (check_l2): Update expected output.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-15 21:41:47 +00:00
0e72230ef3 sockaddr: decode Bluetooth L2 PSM values
* xlat/bluetooth_l2_psm.in: New file.
* sockaddr.c: Include xlat/bluetooth_l2_psm.h.
(print_bluetooth_l2_psm): New function.
(print_sockaddr_data_bt): Use it to decode struct sockaddr_l2.l2_psm
field.
* tests/net-sockaddr.c (check_l2): Update expected output.
2018-05-15 21:41:47 +00:00
9da6cfcc46 sockaddr: decode bluetooth address type names
* xlat/bdaddr_types.in: New file.
* sockaddr.c: Include xlat/bdaddr_types.h.
(print_sockaddr_data_bt): Decode struct sockaddr_l2.l2_bdaddr_type field
using constants from bdaddr_types xlat.
* tests/net-sockaddr.c (check_l2): Check decoding
of struct sockaddr_l2.l2_bdaddr_type field.
2018-05-15 21:41:47 +00:00
17dbd04e65 sockaddr: decode Bluetooth socket address unconditionally
* sockaddr.c [HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include
bluetooth/bluetooth.h, bluetooth/hci.h, bluetooth/l2cap.h,
bluetooth/rfcomm.h, and bluetooth/sco.h.
[!HAVE_BLUETOOTH_BLUETOOTH_H]: Include xlat/hci_channels.h.
(btohs): New function.
(print_sockaddr_data_bt): Define unconditionally, add definitions
of struct sockaddr_hci, struct bdaddr, struct sockaddr_sco,
struct sockaddr_rc, and struct sockaddr_l2.
(sa_printers) <AF_BLUETOOTH>: Define unconditionally.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-15 21:41:47 +00:00
6e0abf45e4 Avoid using print_array as a local variable name
We have a function with the same name.

* netlink.c (decode_netlink) <print_array>: Rename to is_array, all
users updated.
* nlattr.c (decode_nlattr) <print_array>: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-15 13:30:16 +00:00
27f2d621ee xlat: update MSG_* constants
Sync them with kernel's include/linux/socket.h, since syscalls perform
almost no checks for incorrect flags.

* xlat/msg_flags.in (MSG_OOB, MSG_PEEK, MSG_DONTROUTE, MSG_CTRUNC,
MSG_PROBE, MSG_TRUNC, MSG_DONTWAIT, MSG_EOR, MSG_WAITALL, MSG_FIN,
MSG_SYN, MSG_CONFIRM, MSG_RST, MSG_ERRQUEUE, MSG_NOSIGNAL, MSG_MORE,
MSG_WAITFORONE, MSG_FASTOPEN, MSG_CMSG_CLOEXEC): Add default values
to all constants.
(MSG_SENDPAGE_NOTLAST, MSG_NO_SHARED_FRAGS): New constants.  It is
an internal one, but, apparently, nothing prohibits passing it
to the kernel.
(MSG_CMSG_COMPAT): New constant.  Override the value provided
by system headers.
(MSG_EOF): Commented out, as it is a synonym for MSG_FIN.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-15 13:30:16 +00:00
4e4ac87b03 socketutils: use exact match of unix domain sockets on fresh kernels
* socketutils.c (unix_send_query): Do not add NLM_F_DUMP to nlmsg_flags
when kernel version is 4.4.4 or later, initialize udiag_cookie
unconditionally.

Complements: v4.12~536 ("Change unix_diag requests back to use full dump instead of exact match")
2018-05-14 22:54:33 +00:00
95ce60d1da socketutils: do not request NDIAG_SHOW_MEMINFO
This information is not used and it looks like it negatively affects
ability to find the socket under high load.

* socketutils.c (netlink_send_query) <req>: Remove NDIAG_SHOW_MEMINFO
flag from netlink_diag_req.ndiag_show field.
* tests/netlink_netlink_diag.c (send_query) <req>: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-14 17:20:21 +00:00
346e8002b0 tests: introduce midtail_alloc and use it in netlink tests
netlink tests happen to access memory located before the tail_malloc'ed
pointers, a practice that doesn't go well with the latest compilers
because tail_malloc is marked with ATTRIBUTE_MALLOC.
For example, glibc in -D_FORTIFY_SOURCE=2 mode and gcc 8 with
-Warray-bounds enabled complain about negative offsets out of bounds.
Fix this issue by introducing midtail_alloc.

* tests/tests.h (midtail_alloc): New macro.
* tests/netlink_crypto.c: Use it instead of tail_malloc for nlh0 allocation.
* tests/netlink_netfilter.c: Likewise.
* tests/netlink_protocol.c: Likewise.
* tests/netlink_route.c: Likewise.
* tests/netlink_selinux.c: Likewise.
* tests/netlink_sock_diag.c: Likewise.
* tests/nlattr_br_port_msg.c: Likewise.
* tests/nlattr_crypto_user_alg.c: Likewise.
* tests/nlattr_dcbmsg.c: Likewise.
* tests/nlattr_fib_rule_hdr.c: Likewise.
* tests/nlattr_ifaddrlblmsg.c: Likewise.
* tests/nlattr_ifaddrmsg.c: Likewise.
* tests/nlattr_ifinfomsg.c: Likewise.
* tests/nlattr_ifla_brport.c: Likewise.
* tests/nlattr_ifla_port.c: Likewise.
* tests/nlattr_ifla_xdp.c: Likewise.
* tests/nlattr_inet_diag_msg.c: Likewise.
* tests/nlattr_inet_diag_req_compat.c: Likewise.
* tests/nlattr_inet_diag_req_v2.c: Likewise.
* tests/nlattr_mdba_mdb_entry.c: Likewise.
* tests/nlattr_mdba_router_port.c: Likewise.
* tests/nlattr_ndmsg.c: Likewise.
* tests/nlattr_ndtmsg.c: Likewise.
* tests/nlattr_netconfmsg.c: Likewise.
* tests/nlattr_netlink_diag_msg.c: Likewise.
* tests/nlattr_nlmsgerr.c: Likewise.
* tests/nlattr_packet_diag_msg.c: Likewise.
* tests/nlattr_rtgenmsg.c: Likewise.
* tests/nlattr_rtmsg.c: Likewise.
* tests/nlattr_smc_diag_msg.c: Likewise.
* tests/nlattr_tc_stats.c: Likewise.
* tests/nlattr_tca_stab.c: Likewise.
* tests/nlattr_tcamsg.c: Likewise.
* tests/nlattr_tcmsg.c: Likewise.
* tests/nlattr_unix_diag_msg.c: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 22:01:45 +00:00
afc49df0b0 Use MIN where appropriate
* netlink.c (decode_nlmsghdr_with_payload): Use MIN.
* netlink_packet_diag.c (print_packet_diag_mclist): Likewise.
* nlattr.c (decode_nlattr_with_data): Likewise.
* rtnl_route.c (decode_rta_multipath): Likewise.
2018-05-09 22:01:45 +00:00
3f59353ab3 xlat: add fallback definitions to {msg,sem,shm}ctl command constants
* xlat/msgctl_flags.in: Add default values to all constants, reorder
to make them sorted by value.
* xlat/semctl_flags.in: Likewise.
* xlat/shmctl_flags.in: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 22:01:45 +00:00
22f04a6c69 xlat: add MSG_STAT_ANY
* xlat/msgctl_flags.in (MSG_STAT_ANY): New constant, introduced
by Linux commit v4.17-rc1~52^2~21.
* tests/ipc_msg.c: Check it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 22:01:45 +00:00
4fb8970101 xlat: add SEM_STAT_ANY
* xlat/semctl_flags.in (SEM_STAT_ANY): New constant, introduced
by Linux commit v4.17-rc1~52^2~22.
* tests/ipc_sem.c: Check it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 22:01:45 +00:00
fe6e9eaa99 xlat: add SHM_STAT_ANY
* xlat/shmctl_flags.in (SHM_STAT_ANY): New constant, introduced
by Linux commit v4.17-rc1~52^2~23.
* tests/ipc_shm.c: Check it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 22:01:45 +00:00
a228405a08 net: print SO_GET_FILTER in getsockopt
SO_ATTACH_FILTER and SO_GET_FILTER have the same value; the former
constant is intended for use in setsockopt, and the latter is for
getsockopt.  Handle that the same way as similar SOL_IP/SOL_IPV6 socket
options are handled.

* xlat/getsock_options.in: New file.
* xlat/setsock_options.in: Likewise.
* xlat/sockoptions.in (SO_ATTACH_FILTER): Move to
xlat/setsock_options.in.
* net.c: Include "xlat/setsock_options.h" and "xlat/getsock_options.h".
(print_sockopt_fd_level_name) <case SOL_SOCKET>: Use
getsock_options or setsock_options as auxiliary xlats based on the value
of is_getsockopt flag.
* tests/sock_filter-v.c: Update expected output.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 12:44:28 +00:00
b537ddc752 tests: add sock_filtrer-v variants with different xlat verbosity levels
* tests/sock_filter-v-Xabbrev.c: New file.
* tests/sock_filter-v-Xraw.c: Likewise.
* tests/sock_filter-v-Xverbose.c: Likewise.
* tests/sock_filter-v.c (PRINT_STMT_SYM, PRINT_STMT_SYM_,
PRINT_STMT_VAL, PRINT_STMT_VAL_, PRINT_JUMP_): Remove.
(HEX_FMT, XLAT_FMT, XLAT_ARGS, PRINT_STMT): New macros.
(PRINT_JUMP): Rewrite.
(print_filter): Rewrite using PRINT_STMT and new PRINT_JUMP.
(main): Print SOL_SOCKET, SO_ATTACH_FILTER, and SO_ATTACH_REUSEPORT_CBPF
using XLAT_FMT/XLAT_ARGS macros.
* tests/pure_executables.list: Add sock_filter-v-Xabbrev,
sock_filter-v-Xraw, and sock_filter-v-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (sock_filter-v-Xabbrev, sock_filter-v-Xraw,
sock_filter-v-Xverbose): New tests.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-09 12:44:28 +00:00
0f001dee00 defs.h: fix ethernet_protocols comment
Starting with commit v4.22~109, sorted xlat tables are terminated
with XLAT_END.

* defs.h (ethernet_protocols): Remove the "unterminated" part from
description.
2018-05-08 20:59:20 +00:00
701ae0b878 xlat: rename *sock*options xlat tables
Such names as sockrxrpcoptions are incomprehensible.

* xlat/getsockipoptions.in: Rename to xlat/getsock_ip_options.in.
* xlat/getsockipv6options.in: Rename to xlat/getsock_ipv6_options.in.
* xlat/setsockipoptions.in: Rename to xlat/setsock_ip_options.in.
* xlat/setsockipv6options.in: Rename to xlat/setsock_ipv6_options.in.
* xlat/sockalgoptions.in: Rename to xlat/sock_alg_options.in.
* xlat/sockbluetoothoptions.in: Rename to xlat/sock_bluetooth_options.in.
* xlat/sockcaifoptions.in: Rename to xlat/sock_caif_options.in.
* xlat/sockdccpoptions.in: Rename to xlat/sock_dccp_options.in.
* xlat/sockipoptions.in: Rename to xlat/sock_ip_options.in.
* xlat/sockipv6options.in: Rename to xlat/sock_ipv6_options.in.
* xlat/sockipxoptions.in: Rename to xlat/sock_ipx_options.in.
* xlat/sockirdaoptions.in: Rename to xlat/sock_irda_options.in.
* xlat/sockiucvoptions.in: Rename to xlat/sock_iucv_options.in.
* xlat/sockkcmoptions.in: Rename to xlat/sock_kcm_options.in.
* xlat/sockllcoptions.in: Rename to xlat/sock_llc_options.in.
* xlat/socknetlinkoptions.in: Rename to xlat/sock_netlink_options.in.
* xlat/socknfcllcpoptions.in: Rename to xlat/sock_nfcllcp_options.in.
* xlat/sockoptions.in: Rename to xlat/sock_options.in.
* xlat/sockpacketoptions.in: Rename to xlat/sock_packet_options.in.
* xlat/sockpnpoptions.in: Rename to xlat/sock_pnp_options.in.
* xlat/sockpppol2tpoptions.in: Rename to xlat/sock_pppol2tp_options.in.
* xlat/sockrawoptions.in: Rename to xlat/sock_raw_options.in.
* xlat/sockrdsoptions.in: Rename to xlat/sock_rds_options.in.
* xlat/sockrxrpcoptions.in: Rename to xlat/sock_rxrpc_options.in.
* xlat/socksctpoptions.in: Rename to xlat/sock_sctp_options.in.
* xlat/socktcpoptions.in: Rename to xlat/sock_tcp_options.in.
* xlat/socktipcoptions.in: Rename to xlat/sock_tipc_options.in.
* xlat/socktlsoptions.in: Rename to xlat/sock_tls_options.in.
* xlat/sockudpoptions.in: Rename to xlat/sock_udp_options.in.
* net.c: Update.
2018-05-08 20:59:20 +00:00
1e436b309e net: decode more SOL_* socket options
* xlat/sockalgoptions.in: New file.
* xlat/sockbluetoothoptions.in: Likewise.
* xlat/sockcaifoptions.in: Likewise.
* xlat/sockdccpoptions.in: Likewise.
* xlat/sockiucvoptions.in: Likewise.
* xlat/sockkcmoptions.in: Likewise.
* xlat/sockllcoptions.in: Likewise.
* xlat/socknfcllcpoptions.in: Likewise.
* xlat/sockpnpoptions.in: Likewise.
* xlat/sockpppol2tpoptions.in: Likewise.
* xlat/sockrdsoptions.in: Likewises.
* xlat/sockrxrpcoptions.in: Likewise.
* xlat/socktipcoptions.in: Likewise.
* xlat/socktlsoptions.in: Likewise.
* xlat/sockudpoptions.in: Likewise.
* net.c: Include "xlat/sockalgoptions.h", "xlat/sockbluetoothoptions.h",
"xlat/sockcaifoptions.h", "xlat/sockdccpoptions.h",
"xlat/sockiucvoptions.h", "xlat/sockkcmoptions.h",
"xlat/sockllcoptions.h", "xlat/socknfcllcpoptions.h",
"xlat/sockpnpoptions.h", "xlat/sockpppol2tpoptions.h",
"xlat/sockrdsoptions.h", "xlat/sockrxrpcoptions.h",
"xlat/socktipcoptions.h", "xlat/socktlsoptions.h",
and "xlat/sockudpoptions.h".
(print_sockopt_fd_level_name): Decode SOL_UDP, SOL_IRDA, SOL_LLC,
SOL_DCCP, SOL_TIPC, SOL_RXRPC, SOL_PPPOL2TP, SOL_BLUETOOTH, SOL_PNPIPE,
SOL_RDS, SOL_IUCV, SOL_CAIF, SOL_ALG, SOL_NFC, SOL_KCM, and SOL_TLS
socket option names.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-08 20:59:20 +00:00
4784564caf net: decode more AF_* protocol names
* xlat/caif_protocols.in: New file.
* xlat/can_protocols.in: Likewise.
* xlat/irda_protocols.in: Likewise.
* xlat/isdn_protocols.in: Likewise.
* xlat/kcm_protocols.in: Likewise.
* xlat/nfc_protocols.in: Likewise.
* xlat/phonet_protocols.in: Likewise.
* xlat/smc_protocols.in: Likewise.
* net.c: Include "xlat/irda_protocols.h", "xlat/can_protocols.h",
"xlat/isdn_protocols.h", "xlat/phonet_protocols.h",
"xlat/caif_protocols.h", "xlat/nfc_protocols.h",
"xlat/kcm_protocols.h", and "xlat/smc_protocols.h".
(SYS_FUNC(socket)): Decode AF_IRDA, AF_CAN, AF_RXRPC, AF_ISDN,
AF_PHONET, AF_CAIF, AF_NFC, AF_KCM, and AF_SMC protocol names.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-08 20:59:20 +00:00
fb3d571696 Remove some duplicate fallback definitions
There is no need to provide duplicate fallback definitions anymore,
inclusion of the appropriate xlat header in XLAT_MACROS_ONLY mode
does the right thing.

* btrfs.c [!BTRFS_FIRST_FREE_OBJECTID] (BTRFS_FIRST_FREE_OBJECTID):
Remove, a fallback definition is already provided by included
"xlat/btrfs_tree_objectids.h".
* net.c: Include "xlat/addrfams.h" in XLAT_MACROS_ONLY mode.
[!AF_BLUETOOTH] (AF_BLUETOOTH): Remove.
* syscall.c: Include "xlat/nt_descriptor_types.h" in XLAT_MACROS_ONLY
mode.
[!NT_PRSTATUS] (NT_PRSTATUS): Remove.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-08 20:59:20 +00:00
1b22898d37 xlat/gen.sh: introduce XLAT_MACROS_ONLY macro
Sometimes we need just fallback definitions and nothing else.
This change adds an interface of skipping xlat table prototypes
and definitions.

* xlat/gen.sh (gen_header): Place xlat table prototype or definition
under "#ifndef XLAT_MACROS_ONLY" guard.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-08 20:59:20 +00:00
8783de909c rtnl_link: print IFLA_NEW_IFINDEX using decode_nla_ifindex
As it is an interface index.

* rtnl_link.c (ifinfomsg_nla_decoders) <[IFLA_NEW_IFINDEX]>: Change
the value from decode_nla_s32 to decode_nla_ifindex.
2018-05-08 14:25:27 +00:00
c802a67751 ci: install libbluetooth-dev
* ci/install-dependencies.sh (common_packages): Add libbluetooth-dev.
2018-05-08 14:25:27 +00:00
3f7d3fcfc9 xlat: provide fallback definitions for HCI_CHANNEL_* constants
* xlat/hci_channels.in: Provide fallback definitions.
2018-05-08 14:25:27 +00:00
e77cec74e0 s390: simplify s390_runtime_instr command printing
As the header with command definitions is now a part of UAPI (since
Linux commit v4.16-rc1~21^2~11), there's no need for a very special
printing routine for command names.

* s390.c (SYS_FUNC(s390_runtime_instr)): Use printxval_d to print
the command argument.
* tests/s390_runtime_instr.c: Update expected output.
2018-05-08 14:25:27 +00:00
5b4317dcc8 tests/init.sh: add run_prog_match_grep
* tests/init.sh (run_prog_match_grep): New function, similar
to run_prog_match_diff.
2018-05-08 14:25:27 +00:00
3435de54af tests: add so_peercred variants with different xlat verbosity levels
* tests/so_peercred-Xabbrev.c: New file.
* tests/so_peercred-Xraw.c: Likewise.
* tests/so_peercred-Xverbose.c: Likewise.
* tests/pure_executables.list: Add so_peercred-Xabbrev,
so_peercred-Xraw, and so_peercred-Xverbose.
* tests/.gitignore: Likewise.
* tests/so_peercred.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/gen_tests.in (so_peercred-Xabbrev, so_peercred-Xraw,
so_peercred-Xverbose): New tests.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-08 14:25:27 +00:00
034b10936c tests: add personality variants with different xlat verbosity levels
* tests/personality-Xabbrev.c: New file.
* tests/personality-Xraw.c: Likewise.
* tests/personality-Xverbose.c: Likewise.
* tests/pure_executables.list: Add personality-Xabbrev,
personality-Xraw, and personality-Xverbose.
* tests/.gitignore: Likewise.
* tests/personality.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/personality.test: Add support for accepting test arguments.
* tests/gen_tests.in (personality-Xabbrev, personality-Xraw,
personality-Xverbose): New tests.
2018-05-08 13:42:45 +00:00
5ece159986 tests: add fanotify_mark variants with different xlat verbosity levels
* tests/fanotify_mark-Xabbrev.c: New file.
* tests/fanotify_mark-Xraw.c: Likewise.
* tests/fanotify_mark-Xverbose.c: Likewise.
* tests/pure_executables.list: Add fanotify_mark-Xabbev,
fanotify_mark-Xraw, and fanotify_mark-Xverbose.
* tests/.gitignore: Likewise.
* tests/fanotify_mark.c: Add handling of XLAT_RAW and XLAT_VERBOSE
flags.
* tests/gen_tests.in (fanotify_mark-Xabbev, fanotify_mark-Xraw,
fanotify_mark-Xverbose): New tests.
2018-05-08 13:39:50 +00:00
8085045d17 xlat: provide fallback definitions for IFF_* constants
* xlat/iffflags.in: Provide fallback definitions.  Mention that
the array is sorted.
2018-05-07 21:45:46 +00:00
70fc6a4dfd xlat: update IFF_* constants
* xlat/iffflags.in (IFF_DYNAMIC): New constant, had been introduced
before the current git repository was conceived.
(IFF_LOWER_UP, IFF_DORMANT): New constants, introduced by Linux commit
v2.6.17-rc1~1175^2~206.
(IFF_ECHO): New constant, introduced by Linux commit
v2.6.25-rc1~1162^2~1415.
2018-05-07 21:45:46 +00:00
93ffdbe75c xlat: provide fallback definitions for ARPHRD_* constants
* xlat/arp_hardware_types.in: Provide fallback definitions, sort.
2018-05-07 21:45:46 +00:00
79b15b57df tests: add more v4l2 checks
* tests/ioctl_v4l2.c (main): Add more VIDIOC_S_EXT_CTRLS checks.
2018-05-07 10:52:16 +00:00
429d45bcab tests: add variants of IPC tests with different xlat verbosity levels
* tests/.gitignore: Add ipc_msg-Xabbrev, ipc_msg-Xraw, ipc_msg-Xverbose,
ipc_msgbuf-Xabbrev, ipc_msgbuf-Xraw, ipc_msgbuf-Xverbose,
ipc_sem-Xabbrev, ipc_sem-Xraw, ipc_sem-Xverbose, ipc_shm-Xabbrev,
ipc_shm-Xraw, and ipc_shm-Xverbose.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (ipc_msg-Xabbrev, ipc_msg-Xraw, ipc_msg-Xverbose,
ipc_msgbuf-Xabbrev, ipc_msgbuf-Xraw, ipc_msgbuf-Xverbose,
ipc_sem-Xabbrev, ipc_sem-Xraw, ipc_sem-Xverbose, ipc_shm-Xabbrev,
ipc_shm-Xraw, ipc_shm-Xverbose): New tests.
* tests/ipc_msg-Xabbrev.c: New file.
* tests/ipc_msg-Xraw.c: Likewise.
* tests/ipc_msg-Xverbose.c: Likewise.
* tests/ipc_msgbuf-Xabbrev.c: Likewise.
* tests/ipc_msgbuf-Xraw.c: Likewise.
* tests/ipc_msgbuf-Xverbose.c: Likewise.
* tests/ipc_sem-Xabbrev.c: Likewise.
* tests/ipc_sem-Xraw.c: Likewise.
* tests/ipc_sem-Xverbose.c: Likewise.
* tests/ipc_shm-Xabbrev.c: Likewise.
* tests/ipc_shm-Xraw.c: Likewise.
* tests/ipc_shm-Xverbose.c: Likewise.
* tests/ipc.sh: Add support for accepting test arguments.
* tests/ipc_msgbuf.test: Likewise.
* tests/ipc_msg.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/ipc_msgbuf.c: Likewise.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.
2018-05-07 10:52:16 +00:00
e1f99483eb tests: make ipc tests a bit more strict
* tests/gen_tests.in (ipc_msg, ipc_sem, ipc_shm): Add -a option.
* tests/ipc_msg.c: Replace " +" with " " in expected output.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.
2018-05-07 10:52:16 +00:00
01a4fcd466 ipc_shm: print SHM_HUGE_SHIFT using print_xlat_u
* ipc_shm.c (SYS_FUNC(shmget)): Print SHM_HUGE_SHIFT using print_xlat_u.
2018-05-07 10:52:16 +00:00
e428788fe1 tests: check all bits of mtype in ipc_msgbuf test
* tests/ipc_msgbuf.c: Include <unistd.h> and <asm/unistd.h>.
(sys_msgrcv): New function.
(msgrcv): Use it instead of msgrcv.  Add bits to mtype,
check for -mtype in msgrcv.
2018-05-07 10:52:16 +00:00
c02090b49b tests: print expected output by ipc_msgbuf test itself
* tests/ipc_msgbuf.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove tests/ipc_msgbuf.expected.
* tests/ipc_msgbuf.c: Add expected output.
* tests/ipc_msgbuf.test: Add -a31.  Redirect output to $EXP.  Call
match_grep with $LOG and $EXP arguments.
2018-05-07 10:52:16 +00:00
952059fc69 xlat: provide fallback definitions for SKF_*_OFF constants
* xlat/skf_off.in: New file.
* bpf_sock_filter.c: Include "xlat/skf_off.h".
2018-05-07 10:52:16 +00:00
c483165463 xlat: provide fallback definitions for BPF_* constants
* xlat/bpf_class.in: Add default values for constants.
* xlat/bpf_miscop.in: Likewise.
* xlat/bpf_mode.in: Likewise.
* xlat/bpf_op_alu.in: Likewise.
* xlat/bpf_op_jmp.in: Likewise.
* xlat/bpf_rval.in: Likewise.
* xlat/bpf_size.in: Likewise.
* xlat/bpf_src.in: Likewise.
2018-05-07 10:52:16 +00:00
5924b08b48 xlat: fix F_* fallback definitions on mips64
* xlat/fcntlcmds.in (F_GETLK64, F_SETLK64, F_SETLKW64) [__mips64]: Fix
default values.

Fixes: v4.22-122-gfa8f486 ("xlat: fix F_* fallback definitions on alpha, hppa, mips, and sparc")
2018-05-06 23:28:24 +00:00
26f83f30b9 xlat: add fallback definitions to SO_* constants
Regenerate xlat/sockoptions.in using the following script:

  sed -n 's/^\(SO_[^[:space:]]*\).*/\1/p' xlat/sockoptions.in |
  uniq |
  while read name; do
    sed -rn 's/#define[[:space:]]+('"$name"')[[:space:]]+([[:digit:]]+)$/\2\t\1/p' \
      /path/to/linux/include/uapi/asm-generic/socket.h
  done |
  sort -n |
  while read def name; do
    grep -EH '#define[[:space:]]+'"$name"'[[:space:]]+(0x[[:xdigit:]]+|[[:digit:]]+)' \
      /path/to/linux/arch/*/include/uapi/asm/socket.h |
    sed -rn 's|^[^#]*/arch/([^/]+)/include/uapi/asm/socket\.h:#define[[:space:]]+'"$name"'[[:space:]]+([^[:space:]]+)([[:space:]].*)?$|\1\t\2|p' |
    sed s/parisc/hppa/ |sort |
    awk -vname="$name" -vdef="$def" '
      {
        i=strtonum($2)
        if (i == def) next
        if (a[i])
          a[i]=a[i] " || defined __" $1 "__"
        else
          a[i]="defined __" $1 "__"
      }
      END {
        iftext="#if"
        for (i in a) {
          printf("%s %s\n%s %u\n",iftext,a[i],name,i)
          iftext="#elif"
        }
        if (iftext != "#if")
          print "#else"
        printf("%s %s\n", name, def)
        if (iftext == "#if")
          print ""
        else
          print "#endif\n"
      }'
  done

* xlat/sockoptions.in: Add fallback definitions.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-06 23:28:24 +00:00
8669e0c142 xlat: remove socket options with duplicate names
* xlat/sockoptions.in (SO_GET_FILTER): Remove as it is defined
to SO_ATTACH_FILTER.
(SO_DETACH_BPF): Remove as it is defined to SO_DETACH_FILTER.
2018-05-06 21:18:34 +00:00
46c9a20614 xlat: remove socket options that do not exist in Linux
* xlat/sockoptions.in (SO_ALLRAW, SO_ICS, SO_IMASOCKET, SO_LISTENING,
SO_MGMT, SO_ORDREL, SO_PARALLELSVR, SO_PROTOTYPE, SO_RDWRSO_SEMA,
SO_USELOOPBACK): Remove.
2018-05-06 21:18:34 +00:00
77fef8df57 xlat: treat socketlayers as a sorted array
* xlat/socketlayers.in: Add a comment that the xlat is sorted.
* net.c (print_sockopt_fd_level_name): Use printxval_search
instead of printxval for decoding socket layer name.
2018-05-06 21:18:34 +00:00
02114f254c net: decode Bluetooth protocol names unconditionally
As we have all BTPROTO_* constant definitions now, there is no need
to rely on bluetooth.h header anymore.

* net.c (AF_BLUETOOTH): Provide a fallback definition.
[HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include <bluetooth/bluetooth.h>.
[!HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
[!HAVE_BLUETOOTH_BLUETOOTH_H] (decode_sockbuf): Decode AF_BLUETOOTH.
(decode_sockbuf) <case AF_BLUETOOTH>: Use printxval_index.
* xlat/bt_protocols.in: Add "#value_indexed" directive.
2018-05-06 21:18:34 +00:00
616fa24122 xlat/gen.sh: invoke the shell interpreter with -e -u options
* xlat/gen.sh: Change interpreter from "/bin/sh" to "/bin/sh -eu".
2018-05-06 15:34:41 +00:00
93dbeb50ca xlat: update FPE_* constants
* xlat/sigfpe_codes.in (FPE_FLTUNK): New constant, introduced by Linux
commit v4.17-rc1~107^2~2.
(FPE_CONDTRAP): New constant, introduced by Linux commit
v4.17-rc1~31^2~3.
2018-05-06 15:34:41 +00:00
3fd36c5f6a xlat: add MAP_FIXED_NOREPLACE
* xlat/mmap_flags.in (MAP_FIXED_NOREPLACE): New constant, introduced
by Linux commit v4.17-rc1~52^2~14.
2018-05-06 15:34:41 +00:00
379ad5a1b0 xlat: provide fallback definitions for BTPROTO_* constants
As they are architecture-independent.

* xlat/bt_protocols.in: Add values to constants.
2018-05-06 15:34:41 +00:00
4bc986fc23 xlat: add NETLINK_SMC
* xlat/netlink_protocols.in (NETLINK_SMC): New constant, introduced
by Linux commit v4.11-rc1~94^2~43^2.
2018-05-06 15:34:41 +00:00
c0cf981ec8 xlat: provide fallback definitions for V4L2_CID_* constants
* xlat/v4l2_control_id_bases.in: New file with fallback definitions.
* xlat/v4l2_control_ids.in: Add fallback definitions.
* v4l2.c: Reorder includes, include "xlat/v4l2_control_id_bases.h",
remove legacy V4L2_CID_* constant definitions.
2018-05-06 15:34:41 +00:00
79377eeaaf xlat: update V4L2_CID_* constants
Synchronise v4l2_control_ids list with the one provided by kernel's
include/uapi/linux/v4l2-controls.h.  A few notes:
 - V4L2_CID_CHROMA_GAIN and V4L2_CID_COLORFX_CBCR moved in accordance
   with their position/values.
 - V4L2_CID_WHITENESS is removed as it has the same value as
   V4L2_CID_GAMMA.
 - V4L2_CID_PRIVATE_BASE is removed.
 - V4L2_CID_HCENTER and V4L2_CID_VCENTER that were removed by Linux
   commit v3.9-rc1~93^2~237, are retained for historical reasons.

* xlat/v4l2_control_ids.in: Update.
2018-05-06 15:34:41 +00:00
ab68755e74 xlat: provide fallback definitions for V4L2_CTRL_CLASS_* constants
As those are architecture-independant.  Also note that the xlat
is sorted.

* xlat/v4l2_control_classes.in: Add values.
2018-05-06 15:34:41 +00:00
afc00b1807 xlat: update V4L2_CTRL_CLASS_* constants
* xlat/v4l2_control_classes.in (V4L2_CTRL_CLASS_DV): New constant,
introduced by Linux commit v3.7-rc1~101^2^2~322.
(V4L2_CTRL_CLASS_RF_TUNER): New constant, introduced by Linux commit
v3.15-rc1~85^2~192.
(V4L2_CTRL_CLASS_DETECT): New constant, introduced by Linux commit
v3.17-rc1~112^2~340.
2018-05-06 15:34:41 +00:00
5f43328a74 xlat: update BPF_F_* constants
Apparently, BPF_F_RDONLY and BPF_F_WRONLY are also used in map_flags.
Moreover, set of flags depends on the type of map, but let's leave that
for another day.

* xlat/bpf_map_flags.in (BPF_F_RDONLY, BPF_F_WRONLY): New constants.
(BPF_F_STACK_BUILD_ID): New constant, introduced by Linux commit
v4.17-rc1~148^2~156^2~3^2~1.
* xlat/bpf_map_flags.in: Update expected output.
2018-05-06 15:34:41 +00:00
52c5d58e04 xlat: add V4L2_PIX_FMT_HEVC
* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_HEVC): New constant, introduced
by Linux commit v4.17-rc1~143^2~60.
2018-05-06 15:34:41 +00:00
822a70b3ec xlat: add ETH_P_PREAUTH
* xlat/ethernet_protocols.in (ETH_P_PREAUTH): New constant, introduced
by Linux commit v4.17-rc1~148^2~379^2~3.
2018-05-06 15:34:41 +00:00
5c01869ce7 xlat: update SCTP_* constants
* xlat/socksctpoptions.in (SCTP_AUTH_DEACTIVATE_KEY): New constant,
introduced by Linux commit v4.17-rc1~148^2~191^2~2.
(SCTP_SENDMSG_CONNECT): New constant, introduced by Linux commit
v4.17-rc1~96^2~9.
2018-05-06 15:34:41 +00:00
083bc9d5b2 xlat: add SPARC ADI-related SIGSEGV codes
* xlat/sigsegv_codes.in (SEGV_ACCADI, SEGV_ADIDERR, SEGV_ADIPERR): New
constants, introduced by Linux commit v4.17-rc1~147^2~4^2~10.
2018-05-06 15:34:41 +00:00
c8115eb9cf xlat: add PROT_ADI
* xlat/mmap_prot.in (PROT_ADI): New constant, introduced by Linux commit
v4.17-rc1~147^2~4^2~1.
2018-05-06 15:34:41 +00:00
c9ace844ba build: rewrite libdw detection without pkg-config
pkg-config expected to be more convenient way to configure libdw,
but in practice it appeared to be less portable than good old
AC_CHECK_HEADERS and AC_CHECK_LIB.

* ci/install-dependencies.sh (common_packages): Remove pkg-config.
(STACKTRACE == "libdw"): Do not install libz-dev and liblzma-dev.
* debian/control (Build-Depends): Remove pkg-config.
* m4/st_libdw.m4 (st_ARG_LIBDW, st_LIBDW): Rewrite without pkg-config.
2018-05-05 14:38:38 +00:00
ee5d88c5b6 ci: add more variants of unwinder to test matrices
Check x86_64 builds with libdw, with libunwind, and without stacktrace.
As Travis CI doesn't provide a suitable libdw, do not test libdw there.

* ci/install-dependencies.sh (common_packages): Remove libdw-dev.
Install libdw-dev or libunwind8-dev depending on $STACKTRACE.
* ci/run-build-and-tests.sh: Specify --with-libdw=yes,
--with-libunwind=yes, or --without-stacktrace depending on $STACKTRACE.
* .gitlab-ci.yml (gcc-x86_64): Rename to gcc-x86_64-libdw,
add STACKTRACE=libdw.
(gcc-x86): Rename to gcc-x86-nounwind, add STACKTRACE=no.
(clang-x86_64): Rename to clang-x86_64-libdw, add STACKTRACE=libdw.
(clang-x86): Rename to clang-x86-nounwind, add STACKTRACE=no.
(gcc-x86_64-libunwind, gcc-x86_64-nounwind, gcc-x86-nounwind,
clang-x86_64-libunwind, clang-x86_64-nounwind, clang-x86-nounwind):
New test matrix entries.
* .travis.yml: Add STACKTRACE=libunwind to all x86_64 test matrix
entries except musl-gcc, add STACKTRACE=no to other matrix entries,
add test matrix entries with STACKTRACE=no variants on x86_64.
2018-05-04 23:13:45 +00:00
3a4bd6b9a7 xlat: update af_packet_types
* xlat/af_packet_types.in: Add values.
(PACKET_USER, PACKET_KERNEL): New constants, introduced by Linux commit
v3.14-rc1~94^2~349.
2018-05-04 17:16:05 +00:00
1296f7bba1 xlat: add values to adjtimex_state, adjtimex_status, advise xlats
* xlat/adjtimex_state.in: Add values.
* xlat/adjtimex_status.in: Likewise.
* xlat/advise.in: Likewise.
2018-05-04 17:15:22 +00:00
40e3734da4 xlat: update adjtimex_modes
* xlat/adjtimex_modes.in: Add values to constants.
(0): Remove.
(ADJ_OFFSET_SS_READ): Move to the first place.
(ADJ_OFFSET_SINGLESHOT): Move to the second place.
2018-05-04 17:12:48 +00:00
1d98b287a4 mmap_cache: do not activate unless requested
Do not call mmap_cache functions until mmap_cache_enable is invoked.
Change struct mmap_cache_t into a proxy structure, move all mmap_cache
data from struct tcb inside this new structure.

* Makefile.am (strace_SOURCES): Move mmap_cache.c and mmap_cache.h
to libstrace_a_SOURCES.
* defs.h (struct tcb): Remove mmap_cache_size and mmap_cache_generation
* fields.
* mmap_cache.h (struct mmap_cache_t): Rename
to struct mmap_cache_entry_t, create a new struct mmap_cache_t,
all users updated.
(mmap_cache_delete): Remove.
* mmap_cache.c (mmap_cache_delete): Rename to delete_mmap_cache,
add static qualifier.
(build_mmap_cache): Merge into mmap_cache_rebuild_if_invalid.
* strace.c (droptcb): Replace mmap_cache_delete invocation
with tcp->mmap_cache->free_fn.
2018-05-04 14:45:44 +00:00
a1ecb2a51c mmap_cache: remove mmap_cache_is_enabled
This function is no longer used and could be removed.

* mmap_cache.c (mmap_cache_is_enabled): Remove.
* mmap_cache.h: Likewise.
2018-05-03 23:43:38 +00:00
840bb0acb5 unwind-libdw: use the mmap_notify subsystem
The unwind subsystem uses the mmap_cache subsystem even it uses
unwind-libdw as backend. unwind-libdw doesn't need the full set of the
mmap_cache subsystem; libdw has a feature for caching a memory
mapping.

This commit does three things.

(1) Make the unwind subsystem not use the mmap_cache subsystem.
The unwind subsystem never concern the memory mapping of the target.
It becomes a thin layer.

(2) Make unwind-libunwind use the mmap_cache subsystem directly.

(3) Make unwind-libdw use the mmap_notify subsystem to know when it
should call dwfl_linux_proc_report/dwfl_report_end for updating the
cache.

Here is a subsystem structure that this patch
introduces:

	+-------------------------------------+
	|            unwind subsys            |
	+------------------+------------------+
	| unwind-libunwind |   unwind-libdw   |
	+------------------+------------------+
	|    mmap_cache    |                  |
	+------------------+                  |
	|               mmap_notify           |
	+-------------------------------------+
	|                syscall              |
	+-------------------------------------+
               mmap/munmap/mprotect/brk...

* unwind.c: Don't include "mmap_cache.h".
(unwind_init): Don't call mmap_cache_enable.
(unwind_tcb_print, unwind_tcb_capture): Don't call mmap_cache related
functions, just invoke unwinder.tcb_walk.
* unwind.h (struct unwind_unwinder_t): Remove tcb_flush_cache field.

* unwind-libdw.c: Include "mmap_notify.h" instead of "mmap_cache.h".
(struct ctx): Add last_proc_updating field to record the generation
of memory mapping that is cached by dwfl_linux_proc_report
and dwfl_report_end.
(mapping_generation): A variable counting how many times the memory
mapping of targets has been changed.
(updating_mapping_generation): New utility function for updating
mapping_generation.
(init): New function for registering updating_mapping_generation
in the mmap_notify subsystem as a callback function.
(tcb_init): Initialize ctx::last_proc_updating.
(tcb_flush_cache): Rename to flush_cache_maybe.  Rebuild the cache data
only if the data is stale.
(tcb_walk): Call flush_cache_maybe for avoiding referring staled cache data.
(unwinder): Set init function, remove tcb_flush_cache field.
* unwind-libunwind.c (init): Enable the mmap_cache subsystem.
(tcb_walk): Call mmap_cache_rebuild_if_invalid and unw_flush_cache for
updating the cache of the memory mapping before walking the stack.
(tcb_walk): Rename to walk.
(unwinder): Remove tcb_flush_cache field.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-05-03 22:01:30 +00:00
e09c6c88aa unwind-libdw: introduce indirect data structure for storing unwinding context
unwind-libdw uses Dwfl as the data structure for storing unwinding
context.  It is raw data that come from libdw.

This commit introduces "struct ctx" file local data type for allowing
unwind-libdw to attach strace side data to the unwinding context.

* unwind-libdw.c (struct ctx): New struct definition.
(tcb_init, tcb_fin, tcb_walk, tcb_flush_cache): Use struct ctx instead
of Dwfl directly.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-05-03 22:01:30 +00:00
ed16666f2f mmap_notify: rename the macro for tracking memory mapping
* sysent.h (STACKTRACE_INVALIDATE_CACHE): Rename to
MEMORY_MAPPING_CHANGE.  All users updated.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-05-03 22:01:30 +00:00
af7038665c mmap_cache: use the mmap_notify subsystem
* mmap_cache.c: Include mmap_notify.h.
(mmap_cache_enable): Call mmap_notify_register_client to use
the mmap_notify subsystem, mmap_cache_invalidate is specified
to handle the change of memory mapping.
(mmap_cache_invalidate): Add static qualifier.
* mmap_cache.h (mmap_cache_invalidate): Remove.
* syscall.c: Include mmap_notify.h instead of mmap_cache.h.
(syscall_exiting_decode): Call mmap_notify_report instead
of mmap_cache_invalidate.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-05-03 22:01:30 +00:00
f17f7e6305 mmap_notify: new subsystem for tracking the changes of memory mappings
This subsystem is a spin-off of the mmap_cache subsystem.

The mmap_cache subsystem had two features: (1) tracking the change
of memory mapping, and (2) maintaining the cache of memory mapping.

mmap_notify is a subsystem specialized to provide feature (2).
unwind-libdw itself has the feature (1).  It needs only (2).

* mmap_notify.h: New file.
* mmap_notify.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-05-03 22:01:30 +00:00
2bae5f919c btrfs: add missing braces
Reported by Coverity.

* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
BTRFS_IOC_TREE_SEARCH_V2>: Add missing braces.

Fixes: v4.22-76-gf766447 "btrfs: use PRINT_FIELD_*"
2018-05-03 00:09:53 +00:00
37935cca18 strace.c: check return code of never failing fcntl call
Because the kernel cannot be trusted.

* strace.c (set_cloexec_flag): Call perror_msg_and_die if fcntl(F_SETFD)
has failed.
2018-05-03 00:09:53 +00:00
55d3c559e4 sock: use error_func_msg for printing function name
* sock.c (decode_ifconf): Use error_func_msg instead of error_msg with
manual function name printing.
2018-05-03 00:09:53 +00:00
973687fd92 util.c: add len sanity checks to dumpstr
Reported by clang.

* util.c (dumpstr): Check that len is sane.
2018-05-03 00:09:53 +00:00
ee023f97ab mmap_cache: fool-proofing build_mmap_cache
Let's try to handle better the situation when build_mmap_cache is called
without mmap_cache/mmap_cache_size being reset prior to the call.

Reported by Coverity scan.

* mmap_cache.c (build_mmap_cache): Set cache_head to tcp->mmap_cache.
Reset tcp->mmap_cache_size to 0.
2018-05-03 00:09:53 +00:00
f08a679a1d error_prints: add missing va_end() calls
These missing va_end() calls are followed by die() calls that never
return, so the only practical effect of this change is appeasement
of code checking tools.

Reported by cppcheck.

* error_prints.c (error_msg_and_die, error_msg_and_help,
perror_msg_and_die): Add va_end().
2018-05-03 00:09:53 +00:00
4eb79a767d mem: handle potential error from sysconf(_SC_PAGESIZE)
Reported by Coverity scan.

* mem.c (get_pagesize): Handle the case when sysconf(_SC_PAGESIZE)
returns an error.
2018-05-03 00:09:53 +00:00
e1499151e9 xlat: merge fcntl64cmds into fcntlcmds
Since we don't have to workaround old F_[GS]ETOWN_EX == F_[SG]ETLK64
kernel bug any longer, there is a room for cleanup.

* xlat/fcntlcmds.in (F_GETLK64, F_SETLK64, F_SETLKW64): Add from
xlat/fcntl64cmds.in.
* xlat/fcntl64cmds.in: Remove.
* fcntl.c: Do not include "xlat/fcntl64cmds.h".
(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Do not use fcntl64cmds, call
printxval instead of printxvals.
2018-05-03 00:09:53 +00:00
3f6e47c7cc tests: check decoding of F_GETOWN_EX and F_SETOWN_EX fcntl commands
* tests/fcntl.c (TEST_F_OWNER_EX): New macro.
[TEST_F_OWNER_EX]: Include "f_owner_ex.h".
[TEST_F_OWNER_EX] (test_f_owner_ex_type_pid,
test_f_owner_ex_umove_or_printaddr, test_f_owner_ex): New functions.
(main) [TEST_F_OWNER_EX]: Use test_f_owner_ex.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-03 00:09:53 +00:00
f904486a28 Introduce f_owner_ex.h
Some headers define struct f_owner_ex, some struct __kernel_f_owner_ex,
we have to support both variants.

* configure.ac (AC_CHECK_TYPES): Check for "struct f_owner_ex"
and "struct __kernel_f_owner_ex" in <linux/fcntl.h>.
* f_owner_ex.h: New file.
* Makefile.am (strace_SOURCES): Add it.
2018-05-03 00:09:53 +00:00
bcff87c31c tests/ioctl_kvm_run.c: handle cpuid at the end of vcpu dentry
Since Linux 4.16, kernel appends the cpuid as suffix to the entry
for a kvm vcpu in /proc/$pid/fd like:

    anon_inode:kvm-vcpu:0

That was

    anon_inode:kvm-vcpu

This kernel change causes the test case failure on newer kernels.
Update the test to deal with the new name as well as the old one.

* tests/ioctl_kvm_run.c: Include unistd.h for using readlink(2).
(vcpu_dev_should_have_cpuid): New function for detecting whether
a proc entry for given fd has the cpuid suffix or not.
(main): Trim vcpu_dev to remove the cpuid suffix if needed.
(vcpu_dev): Remove const modifier.
2018-05-02 15:23:46 +00:00
f12aa97aab xlat: check that system definitions match fallback definitions
For each constant that is accompanied by a fallback definition,
generate a sanity check that the definition provided by system headers
matches the fallback definition.

* gcc_compat.h (DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE,
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE): New macros.
* xlat/gen.sh (cond_def): Generate a code that checks the system
definition against the default.
(gen_header): Generate a code that includes "gcc_compat.h" and
"static_assert.h".

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-04-29 21:59:55 +00:00
e36c1a7476 xlat: override values of F_SETOWN_EX and F_GETOWN_EX constants
Linux kernel commit v2.6.32-rc7~23 has changed values of F_SETOWN_EX
and F_GETOWN_EX constants introduced by commit v2.6.32-rc1~96 to fix
the conflict with F_GETLK64 and F_SETLK64 constants.

Looks like the best way to handle this situation is to pretend that
old values of F_SETOWN_EX and F_GETOWN_EX didn't exist.

* xlat/fcntlcmds.in (F_SETOWN_EX, F_GETOWN_EX): Undefine.
2018-04-29 21:59:55 +00:00
fa8f4866a4 xlat: fix F_* fallback definitions on alpha, hppa, mips, and sparc
* xlat/fcntlcmds.in (F_GETLK, F_SETLK, F_SETLKW, F_SETOWN, F_GETOWN,
F_SETSIG, F_GETSIG) [alpha || hppa || mips || sparc]: Fix definitions.
* xlat/fcntl64cmds.in (F_GETLK64, F_SETLK64, F_SETLKW64) [hppa || mips]:
Likewise.
2018-04-29 21:59:55 +00:00
16b7bcdccc xlat: fix SI_* fallback definitions on mips
* xlat/siginfo_codes.in [mips] (SI_ASYNCIO, SI_TIMER, SI_MESGQ): Define
to -2, -3, and -4, respectively.
2018-04-29 21:59:55 +00:00
548ee616e1 xlat: override values of KEY_RFKILL and KEY_BRIGHTNESS_MIN constants
KEY_RFKILL and KEY_NUMERIC_A constants were introduced by Linux kernel
commits v2.6.33~17^2~2 and v4.1-rc1~150^2~1^10~6, respectively.
Apparently, RHEL6 introduced an alternative KEY_RFKILL constant
with the same value as upstream KEY_NUMERIC_A.

KEY_BRIGHTNESS_MIN and KEY_BRIGHTNESS_MAX constants were introduced
by Linux kernel commit v3.16-rc1~30^2~6^2~1^2~7.
Apparently, RHEL7 introduced an alternative KEY_BRIGHTNESS_MIN constant
with the same value as upstream KEY_BRIGHTNESS_MAX.

Downstream vendors are *not* allowed to do this.
Ignore the system value of KEY_RFKILL and KEY_BRIGHTNESS_MIN.

* xlat/evdev_keycode.in (KEY_RFKILL, KEY_BRIGHTNESS_MIN): Undefine.
2018-04-29 21:59:55 +00:00
59e5ef1fc9 xlat: override the value of KEY_DATA constant
Linux kernel commit v4.9-rc8~12^2 has changed the value of KEY_DATA
constant introduced by commit v4.7-rc6~32^2~6^2 because the old value
was already used by KEY_FASTREVERSE.

Looks like the best way to handle this situation is to pretend that
the old value of KEY_DATA didn't exist.

* xlat/evdev_keycode.in (KEY_DATA): Undefine.
2018-04-29 21:59:55 +00:00
703cc7ce44 xlat: override the value of AUDIT_FEATURE_CHANGE constant
Linux kernel commit v3.15-rc1~18^2~1 has changed the value
of AUDIT_FEATURE_CHANGE constant introduced by commit v3.13-rc1~19^2~20
which is of course an ABI breakage that affected 3.13 and 3.14 kernel
releases as well as their LTS derivatives.

Linux kernel commit v3.15-rc1~18^2~1 also claims that the old value
of AUDIT_FEATURE_CHANGE was ignored by userspace because of the
established convention how netlink messages for the audit system
are divided into blocks.

Looks like the best way to handle this situation is to pretend that
the old value of AUDIT_FEATURE_CHANGE didn't exist.

* xlat/nl_audit_types.in (AUDIT_FEATURE_CHANGE): Undefine.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2018-04-29 21:59:55 +00:00
a6082255ac xlat: fix MCL_* fallback definitions on alpha, ppc, ppc64, and sparc
On these architectures, MCL_* constants are different.

* xlat/socketlayers.in [__alpha__ || __powerpc__ || __powerpc64__
|| __sparc__] (MCL_CURRENT, MCL_FUTURE, MCL_ONFAULT): Define to 0x2000,
0x4000, and 0x8000, respectively.
2018-04-29 21:59:55 +00:00
c23a79e5b9 xlat: fix SOL_SOCKET fallback definition on alpha, hppa, mips, and sparc
On these architectures, SOL_SOCKET is 0xffff and not 1.

* xlat/socketlayers.in [__alpha__ || __hppa__ || __mips__ || __sparc__]
(SOL_SOCKET): Define to 0xffff.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-28 23:54:57 +00:00
6dd265b961 tests: add more mount checks
* tests/gen_tests.in (mount, mount-Xabbrev, mount-Xraw, mount-Xverbose):
Add -a33 option.
* tests/mount.c: Check printing of flags and pointers.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-28 20:48:52 +00:00
8d5c37dbfd tests: use sprintrc in mount test
* tests/mount.c (main): Use sprintrc.
2018-04-28 20:48:52 +00:00
1f357a8f1a tests: add mount variants with different xlat verbosity levels
* tests/mount-Xabbrev.c: New file.
* tests/mount-Xraw.c: Likewise.
* tests/mount-Xverbose.c: Likewise.
* tests/mount.c: Add handling of XLAT_RAW and XLAT_VERBOSE macros.
* tests/pure_executables.list: Add mount-Xabbrev, mount-Xraw,
and mount-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (mount-Xabbrev, mount-Xraw, mount-Xverbose): New
tests.
2018-04-28 20:48:52 +00:00
42f1ccc867 tests: add old_mmap variants with different xlat verbosity levels
* tests/old_mmap-Xabbrev.c: New file.
* tests/old_mmap-Xraw.c: Likewise.
* tests/old_mmap-Xverbose.c: Likewise.
* tests/old_mmap.c (main): Add handling of XLAT_RAW and XLAT_VERBOSE
macros.
* tests/pure_executables.list: Add old_mmap-Xabbrev, old_mmap-Xraw,
and old_mmap-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (old_mmap-Xabbrev, old_mmap-Xraw,
old_mmap-Xverbose): New tests.
2018-04-28 20:48:52 +00:00
417ec2479d tests: add mmap/mmap64 variants different xlat verbosity levels
* tests/tests.h [!XLAT_RAW] (XLAT_RAW): Define.
[!XLAT_VERBOSE] (XLAT_VERBOSE): Likewise.
* tests/mmap-Xabbrev.c: New file.
* tests/mmap-Xraw.c: Likewise.
* tests/mmap-Xverbose.c: Likewise.
* tests/mmap64-Xabbrev.c: Likewise.
* tests/mmap64-Xraw.c: Likewise.
* tests/mmap64-Xverbose.c: Likewise.
* tests/mmap.c (main): Add handling of XLAT_RAW and XLAT_VERBOSE macros.
* tests/mmap.test: Add handling of optional test arguments that set
alignment and xlat verbosity options.
* tests/Makefile.am (mmap64_Xabbrev_CPPFLAGS, mmap64_Xraw_CPPFLAGS,
mmap64_Xverbose_CPPFLAGS): New variables, analogous to mmap64_CPPFLAGS.
* tests/pure_executables.list: Add mmap-Xabbrev, mmap-Xraw,
mmap-Xverbose, mmap64-Xabbrev, mmap64-Xraw, and mmap64-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (mmap-Xabbrev, mmap-Xraw, mmap-Xverbose,
mmap64-Xabbrev, mmap64-Xraw, mmap64-Xverbose): New tests.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-28 20:48:52 +00:00
a0f071a2e6 Fix fallback definition of MSG_ZEROCOPY
* xlat/msg_flags.in (MSG_ZEROCOPY): Set fallback definition to 0x4000000.

Fixes: v4.21~316 ("Update MSG_* constants")
2018-04-27 07:19:52 +00:00
bd9845770f build: try to use _Static_assert if static_assert is not available
* configure.ac: Check for _Static_assert if static_assert
is not available.
* static_assert.h [!HAVE_STATIC_ASSERT && HAVE__STATIC_ASSERT]
(static_assert): Define to _Static_assert.
2018-04-27 07:19:52 +00:00
96ebee2121 printmode: add xlat style support to print_symbolic_mode_t
* printmode.c (print_symbolic_mode_t): Set ifmt to an empty string,
print raw and decoded values based on current xlat_verbosity setting.
2018-04-27 00:56:25 +00:00
cc52da10c6 evdev: remove XT_NORMAL
It is no longer used.

* evdev.c (enum xlat_type) <XT_NORMAL>: Remove.
(printxval_dispatch) <case XT_NORMAL>: Remove.
2018-04-27 00:56:25 +00:00
86bfc08a92 Switch to use of value-indexed xlats for evdev constants
* xlat/evdev_abs.in: Add "#value_indexed" directive.
* xlat/evdev_autorepeat.in: Likewise.
* xlat/evdev_ff_status.in: Likewise.
* xlat/evdev_keycode.in: Likewise.
* xlat/evdev_leds.in: Likewise.
* xlat/evdev_misc.in: Likewise.
* xlat/evdev_prop.in: Likewise.
* xlat/evdev_relative_axes.in: Likewise.
* xlat/evdev_snd.in: Likewise.
* xlat/evdev_switch.in: Likewise.
* xlat/evdev_sync.in: Likewise.
* xlat/evdev_ff_types.in: Add a comment about sorting.
* evdev.c (keycode_ioctl, keycode_V2_ioctl): Use printxval_index
instead of printxval.
(bit_ioctl): Use XT_SORTED for evdev_ff_types, use XT_INDEXED
for other xlats.
(evdev_read_ioctl): Use XT_INDEXED for all xlats.
* ioctl.c (evdev_decode_number): Use printxval_indexn instead of
printxval for evdev_abs.
2018-04-27 00:56:25 +00:00
728e9167e2 evdev: support various types of xlats in decode_bitset
* evdev.c (enum xlat_type): New enumeration.
(printxval_dispatch): New function.
(decode_bitset_): Rename from decode_bitset, add decode_nr_size
and xt arguments, call printxval_dispatch instead of printxval.
(decode_bitset): Add a decode_bitset_ wrapper that derives
decode_nr_size from the ARRAY_SIZE of decode_nr.
(bit_ioctl, evdev_read_ioctl): Update decode_bitset calls.
2018-04-27 00:56:25 +00:00
ea61622226 Move xlat/evdev_abs.h inclusion from ioctl.c to evdev.c
Also introduce evdev_abs_size constant, which will be needed later.

* defs.h (evdev_abs_size): New declaration.
* ioctl.c: Move xlat/evdev_abs.h inclusion ...
* evdev.c: ... here.
(evdev_abs_size): New constant variable.
2018-04-27 00:56:25 +00:00
25d6ed1600 Add support for value-indexed xlats
There are quite a few xlats that start from 0 and not too sparse,
we can push the search time for them down to O(1).

* defs.h (printxval_indexn_ex): New declaration.
(printxval_indexn, printxval_index, printxval_index_ex): New macros.
* xlat.c (printxval_sized): Rename from printxval_searchn_ex,
add fn argument, call it instead of xlat_search.
(printxval_searchn_ex): Implement as a thin wrapper around
printxval_sized using xlat_search as a search function.
(xlat_idx): New function.
(printxval_indexn_ex): New function, a thin wrapper around
printxval_sized using xlat_idx as a search function.
* xlat/gen.sh: Add support for "#value_indexed" directive.
2018-04-27 00:56:25 +00:00
89955c53a4 socketcall: use printxval_d for printing call argument
* socketcall.c (SYS_FUNC(socketcall)): Use printxval_d instead of manual
call argument decoding.
2018-04-27 00:56:25 +00:00
604af7aca4 signal: use print_xlat_ex in print_sa_handler
* signal.c (print_sa_handler): Call print_xlat_ex instead of tprints
in order to respect current xlat style setting.
2018-04-27 00:56:25 +00:00
037802b576 s390: use printxvals_ex for command printing in s390_runtime_instr
* s390.c (SYS_FUNC(s390_runtime_instr)): Replace manual command argument
decoding with a printxvals_ex call.
2018-04-27 00:56:25 +00:00
a3e7aca688 printsiginfo: use print_xlat_ex in print_si_code
In order to respect current xlat style setting.

* printsiginfo.c (print_si_code): Use print_xlat_ex instead of manual
string/value printing.
2018-04-27 00:56:25 +00:00
bbb3015054 open: use print_xlat_ex for printing open modes
In order to respect xlat style setting.

* open.c (tprint_open_modes): Use print_xlat_ex instead of
tprint_open_modes.
2018-04-27 00:56:25 +00:00
6cf810b860 netlink: use print_xlat_ex in decode_nlmsg_type_netfilter
In order to respect current xlat style setting.

* netlink.c (decode_nlmsg_type_netfilter): Use print_xlat_ex
instead of tprints.
2018-04-27 00:56:25 +00:00
6fb0ffca75 net: use print_xlat_ex in tprint_sock_type
In order to respect current xlat style setting.

* next.c (tprint_sock_type): Use print_xlat_ex instead of tprints
for socket type printing.
2018-04-27 00:56:25 +00:00
942033a35e keyctl: use printxval_d for printing keyring serial number
* keyctl.c (print_keyring_serial_number): Use printxval_d instead of
looking up and printing xlat value manually.
* xlat/key_spec.in: Add "#val_type int" so the xlat values have sign
bit propagated.
2018-04-27 00:56:25 +00:00
f900ebd9a0 ipc: use printxval_u instead of manual xlat value printing
* ipc.c (SYS_FUNC(ipc)): Decode call argument using printxval_u.
2018-04-27 00:56:25 +00:00
ed799d5ecc ioprio: use sprintxval instead of xlookup and string/value printing
In order to respect current xlat style.

* ioprio.c (sprint_ioprio): Use sprintxval for producing string
representation of ioprio class, use the produced string representation
in resulting xsprintf.
2018-04-27 00:56:25 +00:00
69b958656e xlat: handle NULL str in print_xlat_ex
It allows to use the following code pattern:

	print_xlat_ex(val, xlookup(xlat, val), XLAT_STYLE_FMT_D);

* xlat.c (print_xlat_ex): Handle str being NULL: print val instead.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-27 00:56:25 +00:00
5120473370 strace.1.in: fix typo (Ronald -> Roland)
A very unfortunate one, though.
2018-04-26 15:26:22 +00:00
a660a091e3 NEWS: mention that -X option addresses Debian bug #692915 2018-04-26 15:26:22 +00:00
1778f71acb ioctl: do not include linux/input.h
All the ABS_* and EV_* values are now available internally,
there's no need to include the header.

* ioctl.c [HAVE_LINUX_INPUT_H]: Do not include linux/input.h.
2018-04-25 22:54:57 +00:00
3f22d9abae tests: add more evdev ioctl checks
tests/ioctl_evdev.c (TEST_NULL_ARG_EX): Rename from TEST_NULL_ARG, add
str argument, print it instead of #cmd.
(TEST_NULL_ARG): Implement as a TEST_NULL_ARG_EX wrapper.
(main): Add checks for EVIOCSABS and EVIOCGBIT ioctls.
2018-04-25 22:54:57 +00:00
2cc71623b9 evdev: decode EV_SW unconditionally
* evdev.c (bit_ioctl): Remove [EV_SW] check.
* tests/ioctl_evdev.c [!EV_SW] (EV_SW): Define.
(main): Remove [EV_SW] check.
2018-04-25 22:54:57 +00:00
3dbe33a872 xlat: provide fallback definitions for arch-independent evdev constants
* xlat/evdev_abs.in: Add constant values.
* xlat/evdev_autorepeat.in: Likewise.
* xlat/evdev_ev.in: Likewise.
* xlat/evdev_ff_status.in: Likewise.
* xlat/evdev_ff_types.in: Likewise.
* xlat/evdev_leds.in: Likewise.
* xlat/evdev_misc.in: Likewise.
* xlat/evdev_prop.in: Likewise.
* xlat/evdev_relative_axes.in: Likewise.
* xlat/evdev_snd.in: Likewise.
* xlat/evdev_switch.in: Likewise.
* xlat/evdev_sync.in: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-25 22:54:57 +00:00
123651345e xlat/evdev_switch.in: update
* xlat/evdev_switch.in (SW_RADIO): Remove, as it was renamed to
SW_RFKILL_ALL and marked as deprecated by Linux commit v2.6.26-rc5~32^2.
(SW_PEN_INSERTED): New constant, was added by Linux commit v4.7~11^2~7.
2018-04-25 22:54:57 +00:00
fbb12e77d5 util.c: make "Out of memory" messages a bit more informative
Since these are emitted in multiple places and are not expected during
any normal operation, it makes sense to report the caller name.

* util.c (print_quoted_string_ex, print_quoted_string_ex, dumpiov_upto,
dumpstr): Replace error_msg with error_func_msg.
2018-04-24 00:35:27 +00:00
300a5a39f1 ci: reorder travis jobs
Run coverage check first as it is the longest one.

* .travis.yml (matrix): Reorder.
2018-04-24 00:35:27 +00:00
38c9790ed1 xlat: add MS_SUBMOUNT constant
* xlat/mount_flags.in (MS_SUBMOUNT): New constant, introduced
by Linux commit v4.11-rc1~82^2~7.
2018-04-24 00:35:27 +00:00
39530d489a fcntl: replace combinations of xlookup and printxval with printxvals
After all, that's what printxvals for.

* fcntl.c (SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use printxvals for
printing value with multiple xlat tables as constant sources.
2018-04-24 00:35:27 +00:00
eaabf55ad2 Move xlat_verbose and xlat_format from xlat.c to defs.h
As it will be used elsewhere.

* xlat.c (xlat_verbose, xlat_format): Move...
* defs.h: ...here.
2018-04-24 00:35:27 +00:00
3dd9d5f34a btrfs: use printxval_u for error types printing
* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
BTRFS_IOC_GET_DEV_STATS>: Use printxval_u for error type printing.
* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl): Update expected output.
2018-04-20 12:39:05 +00:00
b85a824a5e btrfs: print device IDs using PRINT_FIELD_DEV
* btrfs.c (btrfs_print_balance_args): Print devid field using
PRINT_FIELD_DEV.
(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_DEV_INFO,
case BTRFS_IOC_GET_DEV_STATS, case BTRFS_IOC_SCRUB,
case BTRFS_IOC_SCRUB_PROGRESS>: Likewise.
(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_DEV_REPLACE>: Print
start.srcdevid field using PRINT_FIELD_DEV.
* tests/btrfs.c: Update expected output.
2018-04-20 12:39:05 +00:00
4276520135 btrfs: print cont_reading_from_srcdev_mode as xlat
* xlat/btrfs_cont_reading_from_srcdev_mode.in: New file.
* btrfs.c: Include "xlat/btrfs_cont_reading_from_srcdev_mode.h".
(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_DEV_REPLACE>: Print
named values for the
struct btrfs_ioctl_dev_replace_args.start.cont_reading_from_srcdev_mode
field.
* tests/btrfs.c: Include "xlat/btrfs_cont_reading_from_srcdev_mode.h".
(btrfs_test_dev_replace_ioctl): Update expected output.
2018-04-20 12:39:05 +00:00
f766447b18 btrfs: use PRINT_FIELD_*
* btrfs.c (btrfs_print_balance_args, btrfs_print_balance,
btrfs_print_features, btrfs_print_qgroup_limit,
btrfs_print_data_container_header,
print_btrfs_data_container_logical_ino, btrfs_print_qgroup_inherit,
btrfs_print_tree_search, print_btrfs_ioctl_space_info, btrfs_ioctl):
Use PRINT_FIELD_* macros for printing structure fields.
2018-04-20 12:39:05 +00:00
b4bd031872 btrfs: make BTRFS_IOC_GET_DEV_STATS error statistics output more structured
* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
BTRFS_IOC_GET_DEV_STATS>: Print array index in square brackets before
the value in order to avoid confusion.
* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl): Update expected output.
2018-04-20 12:39:05 +00:00
9f1a22244f ioctl: print ioctl number in accordance with xlat verbosity setting
* ioctl.c (SYS_FUNC(ioctl)): Print ioctl command name in accordance
with the current xlat_verbosity setting.
* tests/btrfs.c (sprint_xlat_): New function.
(ioc): New macro, a wrapper for sprint_xlat_.
Update expected output.
2018-04-20 12:39:05 +00:00
a2b07d60d7 file_ioctl: make abbreviated output more structured
* file_ioctl.c (file_ioctl): Print fm_extents field name only in case
of non-abbreviated output.
* tests/btrfs.c (btrfs_test_ino_path_ioctls): Update expected output.
2018-04-20 12:39:05 +00:00
8d6fd581fb btrfs: fix printing of struct btrfs_ioctl_quota_ctl_args
For some reason, he decoder of BTRFS_IOC_QUOTA_CTL command didn't print
opening curly brace and field name, only the closing curly brace.

* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_QUOTA_CTL>:
Print "{cmd=".
* tests/btrfs.c (btrfs_test_quota_ctl_ioctl): Update expected output.

Fixes: v4.12~100 "ioctl: add decoding support for btrfs ioctls"
2018-04-20 12:39:05 +00:00
114a710b73 btrfs: consistently use PRINT_FIELD_U64
* btrfs.c (print_u64, print_member_u64, print_key_value_internal,
print_key_value): Remove.
(btrfs_print_balance_args): Use PRINT_FIELD_U64 instead of
print_member_u64.
(btrfs_print_tree_search): Use PRINT_FIELD_U64 instead of
print_key_value.
(MPERS_PRINTER_DECL(btrfs_ioctl)): Use PRINT_FIELD_U64 instead of manual
UINT64_MAX printing.
* tests/btrfs.c: Update expected output in order to account fields that
are now affected by xlat_verbosity setting.
2018-04-20 12:39:05 +00:00
83e797d9dc btrfs: print {min,max}_{offset,transid} unconditionally
As it looks like there's no reason to skip their printing.

* btrfs.c (print_key_value_internal): Do not check value argument
for holding non-zero value.
* tests/btrfs.c (btrfs_print_search_key): Update expected output.
2018-04-20 12:39:05 +00:00
2b71146c3a tests/btrfs.c: accept possible failure of BTRFS_IOC_BALANCE_V2
BTRFS_IOC_BALANCE_V2 ioctl might fail sometimes (for example, if it
decides that it doesn't have enough free space).

* tests/btrfs.c (btrfs_test_balance_ioctls): Print expected output for
the BTRFS_IOC_BALANCE_V2 call based on its return code.
2018-04-20 12:39:05 +00:00
11df7cd070 tests/btrfs.c: support volumes with mixed data/metadata in BTRFS_IOC_BALANCE_V2
For these volumes, pend/vend should be the same for data and meta.

* tests/btrfs.c (btrfs_test_balance_ioctls): Set args.meta.pend and
args.meta.vend to the same values as args.data.pend and args.data.vend,
respectively.
2018-04-20 12:39:05 +00:00
e8f8904356 tests/btrfs.c: check BTRFS_IOC_SUBVOL_CREATE_V2 result
Otherwise the subsequent openat call fails with a cryptic message.

* tests/btrfs.c (btrfs_test_subvol_ioctls): Check return code of the
BTRFS_IOC_SUBVOL_CREATE_V2 ioctl call that is supposed to be successful.
2018-04-20 12:39:05 +00:00
8c8321ee9e tests/btrfs.c: add pid suffix to the created directory, remove it on exit
If multiple tests are running simultaneously in the same directory,
conflicts (and test failures) may happen.

* tests/btrfs.c (path, dir_name_fmt, dir_name): New variables.
(btrfs_test_ino_path_ioctls): Use dir_name for printing directory name.
(rm_test_dir): New function.
(main): Generate dir_name, use it instead of fixed name, add rm_test_dir
as an atexit handler.
2018-04-20 12:39:05 +00:00
fe73383f95 btrfs: duplicate printing of opening braces on entering/exiting
* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)): Print opening bracket
on entering and exiting separately.
2018-04-20 12:39:05 +00:00
941fe71851 btrfs: refactor timespec printing into print_btrfs_timespec
* btrfs.c (print_btrfs_timespec): New function.
(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_SET_RECEIVED_SUBVOL>:
Use print_btrfs_timespec for printing stime and rtime fields.
* tests/btrfs.c (btrfs_test_set_received_subvol_ioctl): Update expected
output.
2018-04-20 12:39:05 +00:00
85e7619e5b btrfs: print abbreviations and field names more consistently
* btrfs.c (btrfs_print_data_container_header): Do not print ", val=".
(btrfs_print_ino_path_container): Print val field name only in case
of non-abbreviated output.
(btrfs_print_qgroup_inherit): Print qgroups field name only in case
of non-abbreviated output.
(btrfs_print_tree_search): Print buf field name only in case
of non-abbreviated output.
(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_SEND>: Print
clone_sources field name only in case of non-abbreviated output.
(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_SPACE_INFO>: Print
spaces field name only in case of non-abbreviated output.
* tests/btrfs.c: Update expected output.
2018-04-20 12:39:05 +00:00
ced5b5aed4 btrfs: move printing of the field name inside btrfs_print_qgroup_limit
* btrfs.c (btrfs_print_qgroup_limit): Print ", lim=".
(btrfs_print_qgroup_inherit, MPERS_PRINTER_DECL(btrfs_ioctl)): Do not
print ", lim=" before btrfs_print_qgroup_limit call.
2018-04-20 12:39:05 +00:00
f4118d896c btrfs: convert btrfs_print_{objectid,key_type} to PRINT_FIELD_XVAL_U
* btrfs.c (btrfs_print_key_type, btrfs_print_objectid): Convert into
thin wrappers around PRINT_FIELD_XVAL_U.
(btrfs_print_data_container_header, btrfs_print_tree_search,
MPERS_PRINTER_DECL(btrfs_ioctl)): Update calls to btrfs_print_key_type
and btrfs_print_objectid in accordance with the new calling convention.
(print_objectid_callback): Use printxvals_ex directly instead of
btrfs_print_objectid call.
* tests/btrfs.c (btrfs_print_objectid, btrfs_print_key_type): Update
expected output.
2018-04-20 12:39:05 +00:00
321f9be806 tests: add btrfs tests with verbose xlat decoding
* tests/btrfs-X.test: New test.
* tests/btrfs-vX.test: Likewise.
* tests/btrfs-vwX.test: Likewise.
* tests/btrfs-wX.test: Likewise.
* tests/Makefile.am (DECODER_TESTS): Add them.
* tests/btrfs.c (verbose_xlat): New static variable.
(prfl_btrfs, prxval_btrfs): New function.
(btrfs_print_qgroup_inherit, btrfs_print_vol_args_v2,
btrfs_print_balance_args, btrfs_test_balance_ioctls,
btrfs_test_clone_ioctls, btrfs_test_defrag_ioctls,
btrfs_test_space_info_ioctl, btrfs_print_defrag_range_args,
btrfs_test_scrub_ioctls, btrfs_test_ino_path_ioctls,
btrfs_test_send_ioctl, btrfs_test_send_ioctl,
btrfs_test_quota_ctl_ioctl, btrfs_test_get_dev_stats_ioctl,
btrfs_test_get_dev_stats_ioctl, btrfs_test_dev_replace_ioctl,
btrfs_test_dev_replace_ioctl, btrfs_print_features): Use prfl_btrfs and
prxval_btrfs instead of printflags and printxval, respectively.
(btrfs_test_balance_ioctls, btrfs_test_ino_path_ioctls,
btrfs_test_quota_ctl_ioctl, btrfs_test_dev_replace_ioctl,
btrfs_test_dev_replace_ioctl): Update expected output based on
verbose_xlat setting.
(btrfs_print_defrag_range_args): Add compress_type_known arg, pass it
to prxval_btrfs.
(main): Handle -X option.
2018-04-20 12:39:05 +00:00
ad7a72cd06 tests: check -X option syntax
* tests/options-syntax.test: Add checks for -X option with invalid
arguments.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-20 12:39:05 +00:00
3cdaf39e3d Add user interface for configuring xlat output style
* strace.c (init): Handle -X option, set xlat_verbosity
according to -X argument.
* strace.1.in: Document -X option.
* NEWS: Mention it.

Closes: https://github.com/strace/strace/issues/27
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-20 12:39:05 +00:00
aa01b5368d bpf: print fields that interpreted as pointers using printaddr64
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_LOOKUP_ELEM),
BEGIN_BPF_CMD_DECODER(BPF_MAP_UPDATE_ELEM)): Print key and value
fields using PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_MAP_DELETE_ELEM)): Print key field using
PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_NEXT_KEY)): Print key and next_key
field using PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print insns and log_buf fields
using PRINT_FIELD_ADDR64.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_TEST_RUN)): Print data_in and data_out
fields using PRINT_FIELD_ADDR64.
* tests/bpf.c: Update expected output.
2018-04-20 12:39:05 +00:00
fc8294cbc2 build: make it even more reproducible
* Makefile.am (today): Consistently print the UTC date in C locale.
* configure.ac (RPM_CHANGELOGTIME, DEB_CHANGELOGTIME): Likewise.
* maint/update_copyright_years.sh: Likewise.
* copyright-year-gen: Likewise.  When $SOURCE_DATE_EPOCH is non-empty,
use it as fallback date before the current system date.

References: https://github.com/strace/strace/pull/68
2018-04-20 13:15:38 +00:00
2e5167cc4f unwind: move unwind_tcb_init invocation to after_successful_attach
There is no need to call unwind_tcb_init before the tracee is attached.

* strace.c (alloctcb) [ENABLE_STACKTRACE]: Move unwind_tcb_init
invocation ...
(after_successful_attach) [ENABLE_STACKTRACE]: ... here.
(init) [ENABLE_STACKTRACE]: Remove unwind_tcb_init invocation loop.
* unwind.c (unwind_tcb_fin): Skip if tcp->unwind_queue is NULL.
2018-04-19 18:03:58 +00:00
ca5ca349ee strace: move setting of post-attach flags inside after_successful_attach
* strace.c (after_successful_attach): Add "flags" argument.
Set TCB_ATTACHED, TCB_STARTUP, and "flags" in tcp->flags.
All users updated.
2018-04-19 18:03:58 +00:00
4069dcb912 strace: rename newoutf to after_successful_attach
This function is going to be used for other things that have to be done
right after a successful attach, hence the rename.

* strace.c (newoutf): Rename to after_successful_attach,
all users updated.
2018-04-19 18:03:58 +00:00
0635ea34a8 unwind: remove stray newline in error diagnostics
* unwind-libdw.c (tcb_init): Do not pass trailing "\n" to error_msg
as the latter prints newline itself.
2018-04-19 18:03:58 +00:00
31ce194d23 build: make it more reproducible
* file-date-gen: Consistently print the UTC date in C locale.
When $SOURCE_DATE_EPOCH is non-empty, use it as fallback date
before the current system date.

Reported-by: Chris Lamb <lamby@debian.org>
Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896016
Closes: https://github.com/strace/strace/pull/68
2018-04-19 18:03:58 +00:00
98d3356b04 unwind: initialize unwind context only if given tcb is initialized
With libdw based unwinder, following warnings are reported
when -p is passed before -k:

   $ ./strace -p 1 -k
   ...
   ./strace: dwfl_linux_proc_attach returned an error for process 0: No such file or directory
   ...

It seems that commit 54c7792b, "Fix libunwind segfault when -p is
passed before -k" doesn't fix the original issue.

* strace.c (init) [ENABLE_STACKTRACE]: Initialize unwind context only
if given tcb is initialized.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-04-19 18:03:58 +00:00
ee2c065dd4 bpf: harmonize length checks
The rest of the decoder uses offsetof to check the length.

* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_PIN),
BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID),
BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID),
BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)): Use offsetof instead
of offsetofend.
2018-04-12 23:00:29 +00:00
25a5961610 bpf: add support for map_name and map_ifindex fields in BPF_MAP_CREATE
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Decode map_name
and map_ifindex fields that were added in Linux commits
v4.15-rc1~84^2~605^2~3 and v4.16-rc1~123^2~145^2~5^2~8, respectively.
* bpf_attr.h (struct BPF_MAP_CREATE_struct): Add map_name
and map_ifindex fields.
* tests/bpf.c (init_BPF_MAP_CREATE_attr7): New function.
(BPF_MAP_CREATE_checks): Remove const qualifier, add two more checks.
2018-04-12 23:00:29 +00:00
b20f744662 bpf: improve handling of various sizes of BPF_MAP_CREATE attributes
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Skip printing
the rest of the structure if len is less than the offset of the end
of max_entries, map_flags, or inner_map_fd field.
* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.
2018-04-12 23:00:29 +00:00
b8ed708a54 tests: add checks for bpf BPF_MAP_CREATE arguments
* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.
2018-04-12 23:00:28 +00:00
79a79e7b9b bpf: print numa_node using xlat
As the value of -1 has a special meaning.  The issue is complicated
by the fact that this constant is not exported by UAPI.

* xlat/numa_node.in: New file.
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Print numa_node field
using printxvals_ex with a special xlat style.
2018-04-12 23:00:28 +00:00
7db513885a btrfs: use umove_or_printaddr_ignore_syserror instead of u_error mangling
* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
BTRFS_IOC_TREE_SEARCH_V2>: Use umove_or_printaddr_ignore_syserror
instead of tcp->u_error mangling around umove_or_printaddr call.
2018-04-12 23:00:28 +00:00
68869ae825 defs.h: introduce umove_or_printaddr{,64}_ignore_syserror wrappers
* defs.h (umove_or_printaddr64_ignore_syserror): New macro, a thin
wrapper around umoven_or_printaddr64_ignore_syserror.
(umove_or_printaddr_ignore_syserror): New macro, a thin wrapper around
umoven_or_printaddr_ignore_syserror.
2018-04-12 23:00:28 +00:00
fd3f73b1f4 print_fields.h: add PRINT_FIELD_XVAL_U for printing xlat in %u format
* print_fields.h (PRINT_FIELD_XVAL_U): New macro.
2018-04-12 23:00:28 +00:00
59819338ab print_fields.h: add PRINT_FIELD_U64 for printing u64 with UINT64_MAX handling
* print_fields.h (PRINT_FIELD_U64): New macro.
2018-04-12 23:00:28 +00:00
2342efed27 bpf_sock_filter: use print_xlat32
We can't simply use print_xlat here due to the way those SKF_*_OFF
constants are defined.

* bpf_sock_filter.c (print_sock_filter_k): Use print_xlat32 for printing
SKF_AD_OFF, SKF_NET_OFF, and SKF_LL_OFF named constants.
2018-04-12 23:00:28 +00:00
f21f7033f9 defs.h: add print_xlat32 macro
For those cases where inadvertent sign extension is possible.

* defs.h (print_xlat32): New macro, a wrapper for print_xlat_ex.
2018-04-12 23:00:28 +00:00
0ae5745181 open: use print_xlat_d in print_dirfd
* open.c (print_dirfd): Use print_xlat_d for printing AT_FDCWD named
constant.
2018-04-12 23:00:28 +00:00
966da001af fanotify: use print_xlat_d
* fanotify.c (SYS_FUNC(fanotify_mark)): Use print_xlat_d for printing
FAN_NOFD named constant.
2018-04-12 23:00:28 +00:00
bda859a94e Add print_xlat_u and print_xlat_d shorthands
Add variants of print_xlat with various value printing formats.

* defs.h (print_xlat_u, print_xlat_d): New macro, a wrapper for
print_xlat_ex.
2018-04-13 01:00:10 +02:00
78be7e9d8a xlat: introduce XLAT_STYLE_FMT_D
As there are some possible users for it, apparently.

* defs.h (XLAT_STYLE_FORMAT_MASK): Update the value in order to
accommodate XLAT_STYLE_FMT_D.
(enum xlat_style) <XLAT_STYLE_FMT_D>: New enumeration entity.
(printxval64_d, printxval_d): New function, a shorthand for
printxvals_ex with a single xlat and XLAT_STYLE_FMT_D xlat style.
* xlat.c (sprint_xlat_val): Handle XLAT_STYLE_FMT_D.
2018-04-13 01:00:10 +02:00
d451b0e283 defs.h: add shorthands for printing xval with XLAT_STYLE_FMT_U
* defs.h (printxval_u, printxval64_u): New function, a shorthand for
printxvals_ex with a single xlat and XLAT_STYLE_FMT_U as a style.
2018-04-13 01:00:10 +02:00
039717c2e6 Add support for various xlat formats
Since xlat printing routines now have a notion of "style" that should be
used for printing xlat values, we can also employ this argument for
passing information about number printing format (unsigned decimal
or hexadecimal, so far).

* defs.h (XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FORMAT_MASK): New macro
constant.
(enum xlat_style) <XLAT_STYLE_FMT_X, XLAT_STYLE_FMT_U>: New enumeration
entities.
* xlat.c (xlat_verbose, xlat_format): New macro for checking specific
aspect of style argument.
(get_xlat_style): Use xlat_verbose for checking xlat verbosity style.
(sprint_xlat_val, print_xlat_val): New function, for easing printing
raw constant number with respect to printing format style.
(printxvals_ex, sprintxval_ex, printxval_searchn_ex,
printxval_searchn_ex, sprintflags_ex, printflags_ex, print_xlat_ex):
Use xlat_verbose macro for xlat verbosity style checks. Use
print_xlat_val instead of direct raw xlat value printing.
2018-04-13 01:00:10 +02:00
21b5ba134f v4l2: use print_xlat in print_v4l2_queryctrl
* v4la.c (print_v4l2_queryctrl): Use print_xlat for printing
V4L2_CTRL_FLAG_NEXT_CTRL named constant.
2018-04-13 01:00:10 +02:00
e29b9270c7 prctl: use print_xlat_ex to print PR_SET_PTRACER_ANY
We cannot simply use print_xlat as PR_SET_PTRACER_ANY is defined
differently in kernel headers.

* prctl.c (SYS_FUNC(prctl)) <case PR_SET_PTRACER>: Use print_xlat_ex
for printing PR_SET_PTRACER_ANY named constant.
2018-04-13 01:00:10 +02:00
1e00c76862 nlattr: use print_xlat
* nlattr.c (print_nlattr): Use print_xlat for printing NLA_F_NESTED and
NLA_F_NET_BYTEORDER named constants.
2018-04-13 01:00:10 +02:00
37db70c027 ipc_defs.h: use print_xlat
* ipc_defs.h (PRINTCTL): Use print_xlat for printing IPC_64 named
constant.
2018-04-13 01:00:09 +02:00
83c129f51c futex: use print_xlat
* futex.c [!FUTEX_OP_OPARG_SHIFT] (FUTEX_OP_OPARG_SHIFT): New macro
constant.
(SYS_FUNC(futex)): Use print_xlat for printing FUTEX_OP_OPARG_SHIFT
named constant.
2018-04-13 01:00:09 +02:00
a465477fc7 ipc: use printxval for printing key
Convert explicit constant printing logic into a printxval call in order
to account for xlat style setting.

* defs.h (ipc_private): New xlat array declaration.
* ipc_msg.c (SYS_FUNC(msgget)): Use printxval for printing IPC_PRIVATE.
* ipc_sem.c (SYS_FUNC(semtimedop)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* xlat/ipc_private.in: New file.
2018-04-13 01:00:09 +02:00
b416f61c3e mount: use print_xlat for printing MS_MGC_VAL
* mount.c (SYS_FUNC(mount)): Use print_xlat for printing MS_MGC_VAL
named constant.
2018-04-13 00:25:13 +02:00
6ece6574d2 Introduce print_xlat and print_xlat_ex
print_xlat_ex prints a named constant in accordance with xlat style
provided, print_xlat is a thin wrapper around print_xlat_ex that passes
stringified constant name as a string and XLAT_STYLE_DEFAULT as a style.

* defs.h (print_xlat_ex): New function prototype.
(print_xlat): New macro, a thin wrapper around print_xlat_ex.
* xlat.c (print_xlat_ex): New function.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-13 00:25:13 +02:00
b9fcbe6112 Introduce XLAT_STYLE_DEFAULT
This will be needed later, with the introduction of user-configurable
xlat style setting (stored in xlat_verbosity variable).

* defs.h (XLAT_STYLE_VERBOSITY_MASK): New macro constant.
(enum xlat_style) <XLAT_STYLE_DEFAULT>: New enumeration entity.
(xlat_verbosity): New external declaration.
(printxvals, printxval_searchn, printxval_search_ex, sprintxval,
sprintflags, printflags64): Use XLAT_STYLE_DEFAULT instead of
XLAT_STYLE_ABBREV.
* strace.c (xlat_verbosity): New variable.
* xlat.c (get_xlat_style): New function.
(printxvals_ex, sprintxval_ex, printxval_searchn_ex, sprintflags_ex,
printflags_ex): Use it.
2018-04-13 00:25:13 +02:00
e8c3f34edd Introduce xlat verbosity styles
* defs.h (printxvals_ex): Rename from printxvals, add style argument.
(enum xlat_style): New enumeration.
(printxvals): New macro, a wrapper for printxvals_ex.
(printxval_searchn_ex): Rename from printxval_searchn, add style
argument.
(printxval_searchn): New macro, a wrapper for printxval_searchn_ex.
(printxval_search_ex): New macro, a wrapper for printxval_searchn_ex.
(sprintxval_ex): Rename from sprintxval, add style argument.
(sprintxval): New macro, a wrapper for sprintxval_ex.
(printflags_ex): Add style argument.
(sprintflags_ex): Rename from sprintflags, add style argument.
(sprintflags): New macro, a wrapper for sprintflags_ex.
(printflags64): Pass XLAT_STYLE_ABBREV as a style in printflags_ex call.
* netlink.c (decode_nlmsg_flags): Pass XLAT_STYLE_ABBREV as a style in
printflags_ex call.
* xlat.c (printxvals_ex): Rename from printxvals, add style argument,
handle it.
(sprintxval_ex): Rename from sprintxval, add style argument, handle it.
(printxval_searchn_ex): Rename from printxval_searchn, add style
argument, handle it.
(sprintflags_ex): Rename from sprintflags, add style argument,
handle it.
(printflags_ex): Add style argument, handle it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
References: https://github.com/strace/strace/issues/27
2018-04-13 00:25:13 +02:00
34c7794cc1 tests: robustify signal delivery test against kernel bugs
Recent kernel siginfo changes, namely, v4.14-rc1~60^2^2~1,
v4.16-rc1~159^2~37, and v4.16-rc1~159^2~39, introduced ABI regressions
that render the whole siginfo interface unreliable.

Looks like the kernel side is not eager to fix the breakage,
so here is a workaround.

* tests/signal_receive.c (s_sig, s_code, s_pid, s_uid): New volatile
variables.
(handler): Add siginfo_t parameter, save siginfo_t fields.
(sig_print): Remove.
(main): Rewrite.  Use variables saved by handler to print expected
siginfo output. Print diagnostics in case of siginfo mismatch.
* strace.spec.in (%check): Extract the diagnostics.

Closes: https://github.com/strace/strace/issues/21
2018-04-11 22:01:37 +00:00
ecf5284f7d Lift experimental status from stack tracing feature
* strace.1.in (.SH OPTIONS) <.B \-k>: Remove " (experimental)".
* strace.c (usage) [ENABLE_STACKTRACE]: Likewise.
2018-04-11 22:01:37 +00:00
dfd58df4a7 Enable stack tracing in packages on all architectures
The stack tracing feature used to be enabled in packages on x86_64 only.
This change enables -k option on all architectures.

* debian/control (Build-Depends) [!amd64]: Add pkg-config, libdw-dev,
and libiberty-dev.
* strace.spec.in (BuildRequires) [!x86_64]: Add
%buildrequires_stacktrace.
2018-04-11 22:01:37 +00:00
9165da9f68 Use libdw-based unwinder in ci and packages
* ci/install-dependencies.sh (common_packages): Add pkg-config,
replace libunwind8-dev with libdw-dev.
* debian/control (Build-Depends) [amd64]: Add pkg-config,
replace libunwind-dev with libdw-dev.
* debian/rules (build-udeb/Makefile): Replace --without-libunwind
with --without-stacktrace.
* strace.spec.in (buildrequires_libunwind_devel): Rename
to buildrequires_stacktrace, replace libunwind-devel with
either elfutils-devel or libdw-devel.
2018-04-11 22:01:37 +00:00
fd4a485828 tests: skip -k tests on unsupported architectures
* tests/strace-k.test: When actual strace -k output doesn't match the
expected output because of limited architecture support, skip the test
on architectures that are not currently supported by libdw.
2018-04-11 22:01:37 +00:00
ddb5a4ba73 unwind: add libdw as an unwinder
Implement alternative libdw-based unwinder for stack tracing.
Add --with-libdw configure option to control whether libdw can be used
as an unwinder.

* m4/st_libdw.m4: New file.
* m4/st_stacktrace.m4 (st_STACKTRACE): Invoke st_ARG_LIBDW and st_LIBDW,
check for mutually exclusive configure options,
(AM_CONDITIONAL): Add USE_LIBDW.
* unwind-libdw.c: New file.
* Makefile.am [USE_LIBDW] (strace_SOURCES): Append unwind-libdw.c.
[USE_LIBDW] (strace_CPPFLAGS): Append $(libdw_CPPFLAGS).
[USE_LIBDW] (strace_CFLAGS): Append $(libdw_CFLAGS).
[USE_LIBDW] (strace_LDFLAGS): Append $(libdw_LDFLAGS).
[USE_LIBDW] (strace_LDADD): Append $(libdw_LIBS).
* NEWS: Mention this improvement.

Closes: https://github.com/strace/strace/issues/12
Closes: https://github.com/strace/strace/issues/13
Co-Authored-by: Mark Wielaard <mjw@redhat.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2018-04-11 22:01:37 +00:00
c78af2c9cf tests: check corner cases of udev_monitor_netlink_header decoding
* tests/netlink_kobject_uevent.c (test_nlmsg_type_kernel): Create
a tail-allocated udev_monitor_netlink_header object and pass it
to sys_send.
(test_nlmsg_type_udev): Likewise.  Check decoding of
udev_monitor_netlink_header object that ends in unmapped memory region.
2018-04-11 22:01:37 +00:00
968a545ab7 tests: check decoding of udev_monitor_netlink_header
* tests/netlink_kobject_uevent.c: Include <string.h>, <arpa/inet.h>,
and "netlink_kobject_uevent.h".
(test_nlmsg_type_udev, test_nlmsg_type_kernel): New functions.
(main): Use them.
2018-04-11 22:01:37 +00:00
c9694f85ed netlink: decode libudev netlink header
* defs.h (decode_netlink_kobject_uevent): New prototype.
* netlink.c (decode_netlink): Decode family kobject_uevent.
* netlink_kobject_uevent.h: New file.
* netlink_kobject_uevent.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
2018-04-11 22:01:37 +00:00
d94871775a tests: check basic decoding of PTP_* ioctl commands
* tests/ioctl_ptp.c: New file.
* tests/gen_tests.in (ioctl_ptp): New entry.
* tests/pure_executables.list: Add ioctl_ptp.
* tests/.gitignore: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-11 15:41:40 +00:00
39f61ef513 bpf: decode BPF_PROG_QUERY command
BPF_PROG_QUERY was introduced in Linux commit v4.15-rc1~84^2~558^2~6.

* xlat/bpf_commands.in (BPF_PROG_QUERY): New constant.
* xlat/bpf_query_flags.in: New file.
* bpf.c: Include it.
(DECL_BPF_CMD_DECODER): Add priv argument for passing tcb private data.
(BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): New function.
(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Add BPF_PROG_QUERY entry.
(SYS_FUNC(bpf)): Fetch buf on entering and exiting, pass buf on exiting,
retrieve private data on exiting, pass it to decoder as well, explicitly
rework rc handling logic for size argument printing.
* bpf_attr.h (struct BPF_PROG_QUERY_struct): New structure declaration.
(BPF_PROG_QUERY_struct_size, expected_BPF_PROG_QUERY_struct_size): New
macro.
* tests/bpf.c: Add checks for BPF_PROG_QUERY command.
2018-04-10 03:38:10 +00:00
459ea39686 Make print_uint64 from btrfs.c globally available
And rename it to print_uint64_array_member to make the name sensible
without additional context.

* defs.h (print_uint64_array_member): New function prototype.
* btrfs.c (print_uint64): Move...
* util.c (print_uint64_array_member): ...here, drop "static" qualifier.
2018-04-10 03:38:10 +00:00
1aee6198c7 Introduce umoven_or_printaddr64* functions
Counterparts for umoven_or_printaddr/umoven_or_printaddr_ignore_syserror
that always print 64 bits of addr (as this is needed in bpf and btrfs
decoders).

* util.c (umoven_or_printaddr64): Rename from umoven_or_printaddr,
change addr argument type to uint64_t, call printaddr64 instead of
printaddr.
(umoven_or_printaddr64_ignore_syserror): Rename from
umoven_or_printaddr_ignore_syserror, change addr argument type to
uint64_t, call printaddr64 instead of printaddr.
* defs.h (umoven_or_printaddr64): Rename from umoven_or_printaddr,
change addr argument type to uint64_t.
(umoven_or_printaddr64_ignore_syserror): Rename from
umoven_or_printaddr_ignore_syserror, change addr argument type to
uint64_t.
(umove_or_printaddr64): New macro, a wrapper for umoven_or_printaddr64.
(umoven_or_printaddr): New function, a wrapper for
umoven_or_printaddr64.
(umoven_or_printaddr_ignore_syserror): New function, a wrapper for
umoven_or_printaddr64_ignore_syserror.
2018-04-10 03:38:10 +00:00
94ea427a31 bpf_filter.c: add support for decoding eBPF instruction codes
* bpf_filter.c (print_bpf_filter_code): Add extended argument, remove
static qualifier.  Add support for decoding eBPF instruction code.
* defs.h (print_bpf_filter_code): New declaration.
* xlat/ebpf_class.in: New file.
* xlat/ebpf_mode.in: Likewise.
* xlat/ebpf_op_alu.in: Likewise.
* xlat/ebpf_op_jmp.in: Likewise.
* xlat/ebpf_size.in: Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-10 03:38:10 +00:00
2713444cb7 unwind: prepare configure subsystem for alternative unwinders
Introduce --enable-stacktrace configure option to control whether
-k option support is compiled in, --with-libunwind option remains
available to control whether libunwind can be used as an unwinder.

* m4/st_demangle.m4: New file.
* m4/st_libunwind.m4: Likewise.
* m4/st_stacktrace.m4: Likewise.
* configure.ac: Replace all libunwind and libiberty checks
with a single st_STACKTRACE invocation.
* Makefile.am: Conditionalize checks for USE_LIBUNWIND and USE_DEMANGLE
on ENABLE_STACKTRACE.
[ENABLE_STACKTRACE] (strace_SOURCES): Append unwind.c and unwind.h.
* strace.1.in: Replace libunwind with an unwinder-agnostic wording.
* defs.h: Replace USE_LIBUNWIND with ENABLE_STACKTRACE.
* strace.c: Likewise.
(print_version): Print stack-trace instead of stack-unwind.
* syscall.c: Replace USE_LIBUNWIND with ENABLE_STACKTRACE.
* tests/Makefile.am: Likewise.  Replace LIBUNWIND_TESTS
with STACKTRACE_TESTS.
* tests/strace-V.test: Update expected output.
2018-04-08 22:01:12 +00:00
cbaa5db24d bpf: implement decoding of prog_name and prog_ifindex fields
* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Add support for decoding
of prog_name (introduced in Linux commit v4.15-rc1~84^2~605^2~4) and
prog_ifindex (introduced as prog_target_ifindex in v4.15-rc1~84^2~127^2~13,
renamed in v4.15-rc1~15^2~5^2~3^2~7).
* bpf_attr.h [!BPF_OBJ_NAME_LEN] (BPF_OBJ_NAME_LEN): New macro constant.
[BPF_OBJ_NAME_LEN]: Check that BPF_OBJ_NAME_LEN is equal to 16.
(struct BPF_PROG_LOAD_struct): Add prog_name and prog_ifindex fields.
(BPF_PROG_LOAD_struct_size, expected_BPF_PROG_LOAD_struct_size): Update.
* tests/bpf.c (init_BPF_PROG_LOAD_attr): Rename
to init_BPF_PROG_LOAD_attr3.
(print_BPF_PROG_LOAD_attr): Rename to print_BPF_PROG_LOAD_attr3.
(init_BPF_PROG_LOAD_attr4, print_BPF_PROG_LOAD_attr4): New functions.
(BPF_PROG_LOAD_checks): Check new decoding features.
2018-04-08 22:01:12 +00:00
a3509bac24 bpf: add support for array fields
* gen_bpf_attr_check.sh: Ignore field array size definition.
* m4/gen_bpf_attr_m4.sh (filter_entries): Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-04-08 22:01:12 +00:00
958cb40a6e tests: robustify strace -k tests
Allow __getpid as an alternative name for getpid,
allow __kernel_vsyscall after getpid.

* tests/strace-k.expected: New file.
* tests/strace-k-demangle.expected: Likewise.
* tests/Makefile.am (EXTRA_DIST): Add them.
* tests/strace-k-demangle.test (expected): Remove.
* tests/strace-k.test: Likewise.  Use grep to check the output.
2018-04-07 23:35:45 +00:00
9574a6e231 ipc_msg: sign extend msgtyp in m32 personality
msgtyp has to be treated as a signed type all the way from fetching
to printing.

* ipc_msg.c (fetch_msgrcv_args): Sign extend msgtyp when fetching.
2018-04-07 02:39:09 +00:00
535a07503e strace.spec.in: update Source URL
* strace.spec.in (Source): Change to https://strace.io/files/.
2018-04-05 19:35:58 +00:00
2dad13a0bd debian: enable mpers support for ppc64el and s390x
* debian/control (Build-Depends) [ppc64el, s390x]: Add gcc-multilib.
2018-04-05 19:35:58 +00:00
3154e6de55 Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.22-1.
* strace.spec.in: Likewise.
2018-04-05 12:13:14 +00:00
492 changed files with 13910 additions and 4184 deletions

View File

@ -8,30 +8,66 @@ variables:
SLEEP_A_BIT: "sleep 0.2"
VERBOSE: "1"
gcc-x86_64:
gcc-x86_64-libdw:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "gcc"
TARGET: "x86_64"
STACKTRACE: "libdw"
gcc-x86:
gcc-x86_64-libunwind:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "gcc"
TARGET: "x86_64"
STACKTRACE: "libunwind"
gcc-x86_64-nounwind:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "gcc"
TARGET: "x86_64"
STACKTRACE: "no"
gcc-x86-nounwind:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "gcc"
TARGET: "x86"
STACKTRACE: "no"
clang-x86_64:
clang-x86_64-libdw:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "clang"
TARGET: "x86_64"
STACKTRACE: "libdw"
clang-x86:
clang-x86_64-libunwind:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "clang"
TARGET: "x86_64"
STACKTRACE: "libunwind"
clang-x86_64-nounwind:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "clang"
TARGET: "x86_64"
STACKTRACE: "no"
clang-x86-nounwind:
stage: test
script: ci/run-build-and-tests.sh
variables:
CC: "clang"
TARGET: "x86"
STACKTRACE: "no"

View File

@ -21,35 +21,50 @@ matrix:
- compiler: gcc
env:
- TARGET=x86_64
- compiler: gcc
env:
- TARGET=x32
- compiler: gcc
env:
- TARGET=x86
- compiler: clang
env:
- TARGET=x86_64
- compiler: musl-gcc
env:
- TARGET=x86_64
- compiler: clang
env:
- TARGET=x86
- compiler: musl-gcc
env:
- TARGET=x86
- compiler: gcc-7
env:
- TARGET=x86_64
- compiler: gcc-7
env:
- TARGET=x32
- compiler: gcc-7
env:
- TARGET=x86
- compiler: gcc
env:
- TARGET=x86_64
- STACKTRACE=libunwind
- CHECK=coverage
- KHEADERS=torvalds/linux
- compiler: gcc
env:
- TARGET=x86_64
- STACKTRACE=libunwind
- compiler: gcc
env:
- TARGET=x32
- STACKTRACE=no
- compiler: gcc
env:
- TARGET=x86
- STACKTRACE=no
- compiler: clang
env:
- TARGET=x86_64
- STACKTRACE=libunwind
- compiler: musl-gcc
env:
- TARGET=x86_64
- STACKTRACE=no
- compiler: clang
env:
- TARGET=x86
- STACKTRACE=no
- compiler: musl-gcc
env:
- TARGET=x86
- STACKTRACE=no
- compiler: gcc-8
env:
- TARGET=x86_64
- STACKTRACE=libunwind
- compiler: gcc-8
env:
- TARGET=x32
- STACKTRACE=no
- compiler: gcc-8
env:
- TARGET=x86
- STACKTRACE=no
- compiler: gcc
env:
- TARGET=x86_64
- STACKTRACE=no

View File

@ -75,6 +75,8 @@ libstrace_a_SOURCES = \
fstatfs64.c \
getpagesize.c \
ipc.c \
mmap_cache.c \
mmap_cache.h \
sigreturn.c \
socketcall.c \
statfs.c \
@ -128,6 +130,7 @@ strace_SOURCES = \
evdev_mpers.c \
eventfd.c \
execve.c \
f_owner_ex.h \
fadvise.c \
fallocate.c \
fanotify.c \
@ -157,6 +160,7 @@ strace_SOURCES = \
hdio.c \
hostname.c \
inotify.c \
inotify_ioctl.c \
io.c \
ioctl.c \
ioperm.c \
@ -178,6 +182,7 @@ strace_SOURCES = \
ldt.c \
link.c \
linux/asm_stat.h \
linux/linux/signal.h \
linux/x32/asm_stat.h \
linux/x86_64/asm_stat.h \
listen.c \
@ -189,8 +194,8 @@ strace_SOURCES = \
membarrier.c \
memfd_create.c \
mknod.c \
mmap_cache.c \
mmap_cache.h \
mmap_notify.c \
mmap_notify.h \
mmsghdr.c \
mount.c \
mpers_type.h \
@ -204,6 +209,8 @@ strace_SOURCES = \
netlink.c \
netlink.h \
netlink_crypto.c \
netlink_kobject_uevent.c \
netlink_kobject_uevent.h \
netlink_sock_diag.h \
netlink_inet_diag.c \
netlink_netfilter.c \
@ -229,14 +236,17 @@ strace_SOURCES = \
pathtrace.c \
perf.c \
perf_event_struct.h \
perf_ioctl.c \
personality.c \
pkeys.c \
poll.c \
prctl.c \
print_aio_sigset.c \
print_dev_t.c \
print_group_req.c \
print_fields.h \
print_ifindex.c \
print_mac.c \
print_mq_attr.c \
print_msgbuf.c \
print_sg_req_info.c \
@ -349,11 +359,21 @@ strace_SOURCES = \
strace_SOURCES_check = bpf_attr_check.c
if ENABLE_STACKTRACE
strace_SOURCES += unwind.c unwind.h
if USE_LIBDW
strace_SOURCES += unwind-libdw.c
strace_CPPFLAGS += $(libdw_CPPFLAGS)
strace_CFLAGS += $(libdw_CFLAGS)
strace_LDFLAGS += $(libdw_LDFLAGS)
strace_LDADD += $(libdw_LIBS)
endif
if USE_LIBUNWIND
strace_SOURCES += unwind.c unwind.h unwind-libunwind.c
strace_SOURCES += unwind-libunwind.c
strace_CPPFLAGS += $(libunwind_CPPFLAGS)
strace_LDFLAGS += $(libunwind_LDFLAGS)
strace_LDADD += $(libunwind_LIBS)
endif
if USE_DEMANGLE
strace_CPPFLAGS += $(libiberty_CPPFLAGS)
strace_LDFLAGS += $(libiberty_LDFLAGS)
@ -411,7 +431,6 @@ EXTRA_DIST = \
linux/aarch64/arch_regs.h \
linux/aarch64/arch_rt_sigframe.c \
linux/aarch64/arch_sigreturn.c \
linux/aarch64/errnoent1.h \
linux/aarch64/get_error.c \
linux/aarch64/get_scno.c \
linux/aarch64/get_syscall_args.c \
@ -424,7 +443,6 @@ EXTRA_DIST = \
linux/aarch64/set_error.c \
linux/aarch64/set_scno.c \
linux/aarch64/shuffle_scno.c \
linux/aarch64/signalent1.h \
linux/aarch64/syscallent.h \
linux/aarch64/syscallent1.h \
linux/alpha/arch_defs_.h \
@ -682,7 +700,6 @@ EXTRA_DIST = \
linux/powerpc64/arch_rt_sigframe.c \
linux/powerpc64/arch_sigreturn.c \
linux/powerpc64/errnoent.h \
linux/powerpc64/errnoent1.h \
linux/powerpc64/get_error.c \
linux/powerpc64/get_scno.c \
linux/powerpc64/get_syscall_args.c \
@ -696,7 +713,6 @@ EXTRA_DIST = \
linux/powerpc64/rt_sigframe.h \
linux/powerpc64/set_error.c \
linux/powerpc64/set_scno.c \
linux/powerpc64/signalent1.h \
linux/powerpc64/syscallent.h \
linux/powerpc64/syscallent1.h \
linux/powerpc64/userent.h \
@ -705,7 +721,6 @@ EXTRA_DIST = \
linux/riscv/arch_regs.c \
linux/riscv/arch_regs.h \
linux/riscv/arch_rt_sigframe.c \
linux/riscv/errnoent1.h \
linux/riscv/get_error.c \
linux/riscv/get_scno.c \
linux/riscv/get_syscall_args.c \
@ -716,7 +731,6 @@ EXTRA_DIST = \
linux/riscv/raw_syscall.h \
linux/riscv/set_error.c \
linux/riscv/set_scno.c \
linux/riscv/signalent1.h \
linux/riscv/syscallent.h \
linux/riscv/syscallent1.h \
linux/rt_sigframe.h \
@ -743,7 +757,6 @@ EXTRA_DIST = \
linux/s390x/arch_regs.h \
linux/s390x/arch_rt_sigframe.c \
linux/s390x/arch_sigreturn.c \
linux/s390x/errnoent1.h \
linux/s390x/get_error.c \
linux/s390x/get_scno.c \
linux/s390x/get_syscall_args.c \
@ -755,7 +768,6 @@ EXTRA_DIST = \
linux/s390x/rt_sigframe.h \
linux/s390x/set_error.c \
linux/s390x/set_scno.c \
linux/s390x/signalent1.h \
linux/s390x/syscallent.h \
linux/s390x/syscallent1.h \
linux/s390x/userent.h \
@ -821,7 +833,6 @@ EXTRA_DIST = \
linux/sparc64/arch_rt_sigframe.c \
linux/sparc64/arch_sigreturn.c \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
linux/sparc64/get_error.c \
linux/sparc64/get_scno.c \
linux/sparc64/get_syscall_args.c \
@ -834,7 +845,6 @@ EXTRA_DIST = \
linux/sparc64/set_error.c \
linux/sparc64/set_scno.c \
linux/sparc64/signalent.h \
linux/sparc64/signalent1.h \
linux/sparc64/syscallent.h \
linux/sparc64/syscallent1.h \
linux/sparc64/userent.h \
@ -845,7 +855,6 @@ EXTRA_DIST = \
linux/tile/arch_regs.h \
linux/tile/arch_rt_sigframe.c \
linux/tile/arch_sigreturn.c \
linux/tile/errnoent1.h \
linux/tile/get_error.c \
linux/tile/get_scno.c \
linux/tile/get_syscall_args.c \
@ -857,7 +866,6 @@ EXTRA_DIST = \
linux/tile/rt_sigframe.h \
linux/tile/set_error.c \
linux/tile/set_scno.c \
linux/tile/signalent1.h \
linux/tile/syscallent.h \
linux/tile/syscallent1.h \
linux/tile/userent.h \
@ -870,7 +878,6 @@ EXTRA_DIST = \
linux/x32/arch_regs.h \
linux/x32/arch_rt_sigframe.c \
linux/x32/arch_sigreturn.c \
linux/x32/errnoent1.h \
linux/x32/get_error.c \
linux/x32/get_scno.c \
linux/x32/get_syscall_args.c \
@ -883,7 +890,6 @@ EXTRA_DIST = \
linux/x32/set_error.c \
linux/x32/set_scno.c \
linux/x32/shuffle_scno.c \
linux/x32/signalent1.h \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
@ -893,8 +899,6 @@ EXTRA_DIST = \
linux/x86_64/arch_regs.h \
linux/x86_64/arch_rt_sigframe.c \
linux/x86_64/arch_sigreturn.c \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
linux/x86_64/get_error.c \
linux/x86_64/get_scno.c \
linux/x86_64/get_syscall_args.c \
@ -911,8 +915,6 @@ EXTRA_DIST = \
linux/x86_64/set_error.c \
linux/x86_64/set_scno.c \
linux/x86_64/shuffle_scno.c \
linux/x86_64/signalent1.h \
linux/x86_64/signalent2.h \
linux/x86_64/syscallent.h \
linux/x86_64/syscallent1.h \
linux/x86_64/syscallent2.h \
@ -980,7 +982,7 @@ dist-hook:
${AM_V_GEN}echo $(COPYRIGHT_YEAR) > $(distdir)/.year
${AM_V_GEN}echo $(MANPAGE_DATE) > $(distdir)/.strace.1.in.date
today = $(shell date +%Y-%m-%d)
today = $(shell LC_TIME=C date -u +%Y-%m-%d)
version_regexp = $(subst .,\.,$(VERSION))
news_check_regexp = 'Noteworthy changes in release $(version_regexp) ($(today))'

53
NEWS
View File

@ -1,3 +1,56 @@
Noteworthy changes in release 4.23 (2018-06-14)
===============================================
* Changes in behaviour
* On x32 personality, 64-bit syscalls (such as readv) are now shown with "#64"
suffix instead of "64:" prefix. Unlike the old names, these new names
can be used in syscall qualification expressions.
* Changed error number output format: error numbers are consistently
printed as "-1 ECONST (Error description)"
for known errors and as "-1 (errno 123)" for unknown errors,
regardless of -e raw qualification settings. One can specify
-X raw for displaying raw error numbers unconditionally.
* Unfetchable addresses inside arrays are now printed as comments.
* Obsolete IA-32 mode syscall names are no longer printed on ia64.
* Improvements
* Implemented libdw backend for -k option, configured at build time
using --with-libdw option.
Whether -k option is compiled is now configured at build time
using --enable-stacktrace option.
* Added -X option for configuring xlat output formatting (addresses
Debian bug #692915).
* Added support for personality designation ("64", "32", or "x32") to syscall
qualifications in -e trace expressions.
* Implemented injection of syscalls with no side effects as an alternative
to injection of an invalid syscall (-e inject=SET:syscall= expression).
* Improved support for reproducible builds (addresses Debian bug #896016).
* Implemented decoding of BPF_PROG_QUERY and BPF_RAW_TRACEPOINT_OPEN bpf
syscall commands.
* Implemented decoding of INOTIFY_IOC_SETNEXTWD and PERF_EVENT_IOC_* ioctl
commands.
* Implemented decoding of PR_GET_SPECULATION_CTRL and PR_SET_SPECULATION_CTRL
prctl syscall options.
* Enhanced decoding of bpf, getsockopt, setsockopt, and socket syscalls.
* Enhanced decoding of NETLINK_KOBJECT_UEVENT and NETLINK_ROUTE protocols.
* Enhanced decoding of *_DIAG_MEMINFO netlink attributes.
* Enhanced decoding of BTRFS_*, FS_IOC_*, SIOCGIFHWADDR, and SIOCSIFHWADDR
ioctl commands.
* Enhanced decoding of AF_BLUETOOTH socket addresses.
* Implemented decoding of io_pgetevent syscall.
* Wired up rseq syscall.
* Updated lists of ADJ_*, BPF_*, BPF_F_*, BPF_PROG_TYPE_*, ETH_P_*, FPE_*,
IFF_*, IPPROTO_*, MAP_*, MS_*, MSG_*, NETLINK_*, PACKET_*, PROT_*, SCTP_*,
SECCOMP_FILTER_FLAG_*, SEGV_*, SEM_*, SHM_*, SW_*, V4L2_CID_*,
V4L2_CTRL_CLASS_*, and V4L2_PIX_FMT_* constants.
* Updated lists of ioctl commands from Linux 4.17.
* Bug fixes
* Fixed decoding of msgtyp argument of msgrcv syscall.
* Fixed fallback definitions for F_*, MCL_*, MSG_ZEROCOPY, SI_*,
and SOL_SOCKET constants.
* Fixed -e trace=%pure expression on mips.
Noteworthy changes in release 4.22 (2018-04-05)
===============================================

25
aio.c
View File

@ -3,7 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* Copyright (c) 1999-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -196,7 +196,7 @@ SYS_FUNC(io_submit)
printaddr(addr);
else
print_array(tcp, addr, nr, &iocbp, current_wordsize,
umoven_or_printaddr, print_iocbp, 0);
tfetch_mem, print_iocbp, 0);
return RVAL_DECODED;
}
@ -238,7 +238,8 @@ SYS_FUNC(io_cancel)
return 0;
}
SYS_FUNC(io_getevents)
static int
print_io_getevents(struct tcb *tcp, bool has_usig)
{
if (entering(tcp)) {
printaddr(tcp->u_arg[0]);
@ -248,16 +249,30 @@ SYS_FUNC(io_getevents)
} else {
struct io_event buf;
print_array(tcp, tcp->u_arg[3], tcp->u_rval, &buf, sizeof(buf),
umoven_or_printaddr, print_io_event, 0);
tfetch_mem, print_io_event, 0);
tprints(", ");
/*
* Since the timeout parameter is read by the kernel
* Since the timeout and usig parameters are read by the kernel
* on entering syscall, it has to be decoded the same way
* whether the syscall has failed or not.
*/
temporarily_clear_syserror(tcp);
print_timespec(tcp, tcp->u_arg[4]);
if (has_usig) {
tprints(", ");
print_aio_sigset(tcp, tcp->u_arg[5]);
}
restore_cleared_syserror(tcp);
}
return 0;
}
SYS_FUNC(io_getevents)
{
return print_io_getevents(tcp, false);
}
SYS_FUNC(io_pgetevents)
{
return print_io_getevents(tcp, true);
}

View File

@ -27,25 +27,82 @@
*/
#include "defs.h"
#include "number_set.h"
#include "filter.h"
#include <regex.h>
#include "filter.h"
#include "number_set.h"
#include "xstring.h"
/**
* Checks whether a @-separated personality specification suffix is present.
* Personality suffix is a one of strings stored in personality_designators
* array.
*
* @param[in] s Specification string to check.
* @param[out] p Where to store personality number if it is found.
* @return If personality is found, the provided string is copied without
* suffix and returned as a result (callee should de-alllocate it
* with free() after use), and personality number is written to p.
* Otherwise, NULL is returned and p is untouched.
*/
static char *
qualify_syscall_separate_personality(const char *s, unsigned int *p)
{
char *pos = strchr(s, '@');
if (!pos)
return NULL;
for (unsigned int i = 0; i < SUPPORTED_PERSONALITIES; i++) {
if (!strcmp(pos + 1, personality_designators[i])) {
*p = i;
return xstrndup(s, pos - s);
}
}
error_msg_and_help("incorrect personality designator '%s'"
" in qualification '%s'", pos + 1, s);
}
static bool
qualify_syscall_number_personality(int n, unsigned int p,
struct number_set *set)
{
if ((unsigned int) n >= nsyscall_vec[p])
return false;
add_number_to_set_array(n, set, p);
return true;
}
static bool
qualify_syscall_number(const char *s, struct number_set *set)
{
int n = string_to_uint(s);
unsigned int p;
char *num_str = qualify_syscall_separate_personality(s, &p);
int n;
if (num_str) {
n = string_to_uint(num_str);
free(num_str);
if (n < 0)
return false;
return qualify_syscall_number_personality(n, p, set);
}
n = string_to_uint(s);
if (n < 0)
return false;
bool done = false;
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
if ((unsigned) n >= nsyscall_vec[p])
continue;
add_number_to_set_array(n, set, p);
done = true;
}
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p)
done |= qualify_syscall_number_personality(n, p, set);
return done;
}
@ -75,12 +132,26 @@ qualify_syscall_regex(const char *s, struct number_set *set)
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name)
continue;
rc = regexec(&preg, sysent_vec[p][i].sys_name,
0, NULL, 0);
if (rc == REG_NOMATCH) {
char name_buf[128];
char *pos = stpcpy(name_buf,
sysent_vec[p][i].sys_name);
(void) xappendstr(name_buf, pos, "@%s",
personality_designators[p]);
rc = regexec(&preg, name_buf, 0, NULL, 0);
}
if (rc == REG_NOMATCH)
continue;
else if (rc)
regerror_msg_and_die(rc, &preg, "regexec", s);
add_number_to_set_array(i, set, p);
found = true;
}
@ -164,22 +235,40 @@ scno_by_name(const char *s, unsigned int p, kernel_long_t start)
}
static bool
qualify_syscall_name(const char *s, struct number_set *set)
qualify_syscall_name_personality(const char *s, unsigned int p,
struct number_set *set)
{
bool found = false;
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
for (kernel_long_t scno = 0;
(scno = scno_by_name(s, p, scno)) >= 0;
++scno) {
add_number_to_set_array(scno, set, p);
found = true;
}
for (kernel_long_t scno = 0; (scno = scno_by_name(s, p, scno)) >= 0;
++scno) {
add_number_to_set_array(scno, set, p);
found = true;
}
return found;
}
static bool
qualify_syscall_name(const char *s, struct number_set *set)
{
unsigned int p;
char *name_str = qualify_syscall_separate_personality(s, &p);
bool found = false;
if (name_str) {
found = qualify_syscall_name_personality(name_str, p, set);
free(name_str);
return found;
}
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p)
found |= qualify_syscall_name_personality(s, p, set);
return found;
}
static bool
qualify_syscall(const char *token, struct number_set *set)
{

511
bpf.c
View File

@ -33,6 +33,7 @@
#ifdef HAVE_LINUX_BPF_H
# include <linux/bpf.h>
#endif
#include <linux/filter.h>
#include "bpf_attr.h"
@ -45,6 +46,9 @@
#include "xlat/bpf_map_update_elem_flags.h"
#include "xlat/bpf_attach_type.h"
#include "xlat/bpf_attach_flags.h"
#include "xlat/bpf_query_flags.h"
#include "xlat/ebpf_regs.h"
#include "xlat/numa_node.h"
#define DECL_BPF_CMD_DECODER(bpf_cmd_decoder) \
int \
@ -117,59 +121,160 @@ decode_attr_extra_data(struct tcb *const tcp,
return 0;
}
struct ebpf_insn {
uint8_t code;
uint8_t dst_reg:4;
uint8_t src_reg:4;
int16_t off;
int32_t imm;
};
struct ebpf_insns_data {
unsigned int count;
};
static bool
print_ebpf_insn(struct tcb * const tcp, void * const elem_buf,
const size_t elem_size, void * const data)
{
struct ebpf_insns_data *eid = data;
struct ebpf_insn *insn = elem_buf;
if (eid->count++ >= BPF_MAXINSNS) {
tprints("...");
return false;
}
tprints("{code=");
print_bpf_filter_code(insn->code, true);
/* We can't use PRINT_FIELD_XVAL on bit fields */
tprints(", dst_reg=");
printxval_index(ebpf_regs, insn->dst_reg, "BPF_REG_???");
tprints(", src_reg=");
printxval_index(ebpf_regs, insn->src_reg, "BPF_REG_???");
PRINT_FIELD_D(", ", *insn, off);
PRINT_FIELD_X(", ", *insn, imm);
tprints("}");
return true;
}
static void
print_ebpf_prog(struct tcb *const tcp, const uint64_t addr, const uint32_t len)
{
print_big_u64_addr(addr);
if (abbrev(tcp)) {
printaddr(addr);
} else {
struct ebpf_insns_data eid = {};
struct ebpf_insn insn;
print_array(tcp, addr, len, &insn, sizeof(insn),
tfetch_mem, print_ebpf_insn, &eid);
}
}
BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)
{
PRINT_FIELD_XVAL("{", attr, map_type, bpf_map_types,
"BPF_MAP_TYPE_???");
PRINT_FIELD_XVAL_INDEX("{", attr, map_type, bpf_map_types,
"BPF_MAP_TYPE_???");
PRINT_FIELD_U(", ", attr, key_size);
PRINT_FIELD_U(", ", attr, value_size);
PRINT_FIELD_U(", ", attr, max_entries);
/* map_flags field was added in Linux commit v4.6-rc1~91^2~108^2~6. */
if (len <= offsetof(struct BPF_MAP_CREATE_struct, map_flags))
break;
PRINT_FIELD_FLAGS(", ", attr, map_flags, bpf_map_flags, "BPF_F_???");
/*
* inner_map_fd field was added in Linux commit
* v4.12-rc1~64^3~373^2~2.
*/
if (len <= offsetof(struct BPF_MAP_CREATE_struct, inner_map_fd))
break;
PRINT_FIELD_FD(", ", attr, inner_map_fd, tcp);
if (attr.map_flags & BPF_F_NUMA_NODE)
PRINT_FIELD_U(", ", attr, numa_node);
/* numa_node field was added in Linux commit v4.14-rc1~130^2~196^2~1. */
if (len <= offsetof(struct BPF_MAP_CREATE_struct, numa_node))
break;
if (attr.map_flags & BPF_F_NUMA_NODE) {
/*
* Kernel uses the value of -1 as a designation for "no NUMA
* node specified", and even uses NUMA_NO_NODE constant;
* however, the constant definition is not a part of UAPI
* headers, thus we can't simply print this named constant
* instead of the value. Let's force verbose xlat style instead
* in order to provide the information for the user while
* not hampering the availability to derive the actual value
* without the access to the kernel headers.
*/
tprints(", numa_node=");
printxvals_ex(attr.numa_node, NULL,
XLAT_STYLE_FMT_U | XLAT_STYLE_VERBOSE,
numa_node, NULL);
}
/* map_name field was added in Linux commit v4.15-rc1~84^2~605^2~3. */
if (len <= offsetof(struct BPF_MAP_CREATE_struct, map_name))
break;
PRINT_FIELD_CSTRING_SZ(", ", attr, map_name,
MIN(sizeof(attr.map_name),
len - offsetof(struct BPF_MAP_CREATE_struct,
map_name)));
/*
* map_ifindex field was added in Linux commit
* v4.16-rc1~123^2~145^2~5^2~8.
*/
if (len <= offsetof(struct BPF_MAP_CREATE_struct, map_ifindex))
break;
PRINT_FIELD_IFINDEX(", ", attr, map_ifindex);
}
END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD)
BEGIN_BPF_CMD_DECODER(BPF_MAP_LOOKUP_ELEM)
{
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
PRINT_FIELD_X(", ", attr, value);
PRINT_FIELD_ADDR64(", ", attr, key);
PRINT_FIELD_ADDR64(", ", attr, value);
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_MAP_UPDATE_ELEM)
{
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
PRINT_FIELD_X(", ", attr, value);
PRINT_FIELD_XVAL(", ", attr, flags, bpf_map_update_elem_flags,
"BPF_???");
PRINT_FIELD_ADDR64(", ", attr, key);
PRINT_FIELD_ADDR64(", ", attr, value);
PRINT_FIELD_XVAL_INDEX(", ", attr, flags, bpf_map_update_elem_flags,
"BPF_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_MAP_DELETE_ELEM)
{
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
PRINT_FIELD_ADDR64(", ", attr, key);
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_NEXT_KEY)
{
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
PRINT_FIELD_X(", ", attr, next_key);
PRINT_FIELD_ADDR64(", ", attr, key);
PRINT_FIELD_ADDR64(", ", attr, next_key);
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)
{
PRINT_FIELD_XVAL("{", attr, prog_type, bpf_prog_types,
"BPF_PROG_TYPE_???");
PRINT_FIELD_XVAL_INDEX("{", attr, prog_type, bpf_prog_types,
"BPF_PROG_TYPE_???");
PRINT_FIELD_U(", ", attr, insn_cnt);
PRINT_FIELD_X(", ", attr, insns);
tprints(", insns=");
print_ebpf_prog(tcp, attr.insns, attr.insn_cnt);
tprintf(", license=");
print_big_u64_addr(attr.license);
@ -180,7 +285,9 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)
break;
PRINT_FIELD_U(", ", attr, log_level);
PRINT_FIELD_U(", ", attr, log_size);
PRINT_FIELD_X(", ", attr, log_buf);
tprintf(", log_buf=");
print_big_u64_addr(attr.log_buf);
printstr_ex(tcp, attr.log_buf, attr.log_size, QUOTE_0_TERMINATED);
/* kern_version field was added in Linux commit v4.1-rc1~84^2~50. */
if (len <= offsetof(struct BPF_PROG_LOAD_struct, kern_version))
@ -194,6 +301,32 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)
if (len <= offsetof(struct BPF_PROG_LOAD_struct, prog_flags))
break;
PRINT_FIELD_FLAGS(", ", attr, prog_flags, bpf_prog_flags, "BPF_F_???");
/* prog_name field was added in Linux commit v4.15-rc1~84^2~605^2~4. */
if (len <= offsetof(struct BPF_PROG_LOAD_struct, prog_name))
break;
PRINT_FIELD_CSTRING_SZ(", ", attr, prog_name,
MIN(sizeof(attr.prog_name),
len - offsetof(struct BPF_PROG_LOAD_struct,
prog_name)));
/*
* prog_ifindex field was added as prog_target_ifindex in Linux commit
* v4.15-rc1~84^2~127^2~13 and renamed to its current name in
* v4.15-rc1~15^2~5^2~3^2~7.
*/
if (len <= offsetof(struct BPF_PROG_LOAD_struct, prog_ifindex))
break;
PRINT_FIELD_IFINDEX(", ", attr, prog_ifindex);
/*
* expected_attach_type was added in Linux commit
* v4.17-rc1~148^2~19^2^2~8.
*/
if (len <= offsetof(struct BPF_PROG_LOAD_struct, expected_attach_type))
break;
PRINT_FIELD_XVAL(", ", attr, expected_attach_type, bpf_attach_type,
"BPF_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD)
@ -204,10 +337,10 @@ BEGIN_BPF_CMD_DECODER(BPF_OBJ_PIN)
printpath(tcp, attr.pathname);
PRINT_FIELD_FD(", ", attr, bpf_fd, tcp);
if (len <= offsetofend(struct BPF_OBJ_PIN_struct, bpf_fd))
break;
/* file_flags field was added in Linux v4.15-rc1~84^2~384^2~4 */
if (len <= offsetof(struct BPF_OBJ_PIN_struct, file_flags))
break;
PRINT_FIELD_FLAGS(", ", attr, file_flags, bpf_file_mode_flags,
"BPF_F_???");
}
@ -219,7 +352,8 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_ATTACH)
{
PRINT_FIELD_FD("{", attr, target_fd, tcp);
PRINT_FIELD_FD(", ", attr, attach_bpf_fd, tcp);
PRINT_FIELD_XVAL(", ", attr, attach_type, bpf_attach_type, "BPF_???");
PRINT_FIELD_XVAL_INDEX(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
PRINT_FIELD_FLAGS(", ", attr, attach_flags, bpf_attach_flags,
"BPF_F_???");
}
@ -228,7 +362,8 @@ END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_PROG_DETACH)
{
PRINT_FIELD_FD("{", attr, target_fd, tcp);
PRINT_FIELD_XVAL(", ", attr, attach_type, bpf_attach_type, "BPF_???");
PRINT_FIELD_XVAL_INDEX(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
@ -238,8 +373,8 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_TEST_RUN)
PRINT_FIELD_U(", ", attr, retval);
PRINT_FIELD_U(", ", attr, data_size_in);
PRINT_FIELD_U(", ", attr, data_size_out);
PRINT_FIELD_X(", ", attr, data_in);
PRINT_FIELD_X(", ", attr, data_out);
PRINT_FIELD_ADDR64(", ", attr, data_in);
PRINT_FIELD_ADDR64(", ", attr, data_out);
PRINT_FIELD_U(", ", attr, repeat);
PRINT_FIELD_U(", ", attr, duration);
tprints("}");
@ -250,10 +385,10 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID)
{
PRINT_FIELD_U("{", attr, start_id);
PRINT_FIELD_U(", ", attr, next_id);
if (len <= offsetofend(struct BPF_PROG_GET_NEXT_ID_struct, next_id))
break;
/* open_flags field has been added in Linux v4.15-rc1~84^2~384^2~4 */
if (len <= offsetof(struct BPF_PROG_GET_NEXT_ID_struct, open_flags))
break;
PRINT_FIELD_FLAGS(", ", attr, open_flags, bpf_file_mode_flags,
"BPF_F_???");
}
@ -265,10 +400,10 @@ BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID)
{
PRINT_FIELD_U("{", attr, prog_id);
PRINT_FIELD_U(", ", attr, next_id);
if (len <= offsetofend(struct BPF_PROG_GET_FD_BY_ID_struct, next_id))
break;
/* open_flags field has been added in Linux v4.15-rc1~84^2~384^2~4 */
if (len <= offsetof(struct BPF_PROG_GET_FD_BY_ID_struct, open_flags))
break;
PRINT_FIELD_FLAGS(", ", attr, open_flags, bpf_file_mode_flags,
"BPF_F_???");
}
@ -278,23 +413,299 @@ BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)
{
PRINT_FIELD_U("{", attr, map_id);
PRINT_FIELD_U(", ", attr, next_id);
if (len <= offsetofend(struct BPF_MAP_GET_FD_BY_ID_struct, next_id))
break;
/* open_flags field has been added in Linux v4.15-rc1~84^2~384^2~4 */
if (len <= offsetof(struct BPF_MAP_GET_FD_BY_ID_struct, open_flags))
break;
PRINT_FIELD_FLAGS(", ", attr, open_flags, bpf_file_mode_flags,
"BPF_F_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)
struct obj_get_info_saved;
typedef void (*print_bpf_obj_info_fn)(struct tcb *,
uint32_t bpf_fd,
const char *info_buf,
uint32_t size,
struct obj_get_info_saved *saved);
struct obj_get_info_saved {
print_bpf_obj_info_fn print_fn;
uint32_t info_len;
uint32_t jited_prog_len;
uint32_t xlated_prog_len;
uint32_t nr_map_ids;
};
static void
print_bpf_map_info(struct tcb * const tcp, uint32_t bpf_fd,
const char *info_buf, uint32_t size,
struct obj_get_info_saved *saved)
{
PRINT_FIELD_FD("{info={", attr, bpf_fd, tcp);
PRINT_FIELD_U(", ", attr, info_len);
PRINT_FIELD_X(", ", attr, info);
if (entering(tcp))
return;
struct bpf_map_info_struct info = { 0 };
const unsigned int len = MIN(size, bpf_map_info_struct_size);
memcpy(&info, info_buf, len);
PRINT_FIELD_XVAL("{", info, type, bpf_map_types, "BPF_MAP_TYPE_???");
PRINT_FIELD_U(", ", info, id);
PRINT_FIELD_U(", ", info, key_size);
PRINT_FIELD_U(", ", info, value_size);
PRINT_FIELD_U(", ", info, max_entries);
PRINT_FIELD_FLAGS(", ", info, map_flags, bpf_map_flags, "BPF_F_???");
/*
* "name" field was introduced by Linux commit v4.15-rc1~84^2~605^2~3.
*/
if (len <= offsetof(struct bpf_map_info_struct, name))
goto print_bpf_map_info_end;
PRINT_FIELD_CSTRING(", ", info, name);
/*
* ifindex, netns_dev, and netns_ino fields were introduced
* by Linux commit v4.16-rc1~123^2~109^2~5^2~4.
*/
if (len <= offsetof(struct bpf_map_info_struct, ifindex))
goto print_bpf_map_info_end;
PRINT_FIELD_IFINDEX(", ", info, ifindex);
PRINT_FIELD_DEV(", ", info, netns_dev);
PRINT_FIELD_U(", ", info, netns_ino);
decode_attr_extra_data(tcp, info_buf, size, bpf_map_info_struct_size);
print_bpf_map_info_end:
tprints("}");
}
END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD)
static void
print_bpf_prog_info(struct tcb * const tcp, uint32_t bpf_fd,
const char *info_buf, uint32_t size,
struct obj_get_info_saved *saved)
{
struct bpf_prog_info_struct info = { 0 };
const unsigned int len = MIN(size, bpf_prog_info_struct_size);
uint64_t map_id_buf;
memcpy(&info, info_buf, len);
if (entering(tcp)) {
saved->jited_prog_len = info.jited_prog_len;
saved->xlated_prog_len = info.xlated_prog_len;
saved->nr_map_ids = info.nr_map_ids;
return;
}
PRINT_FIELD_XVAL("{", info, type, bpf_prog_types, "BPF_PROG_TYPE_???");
PRINT_FIELD_U(", ", info, id);
PRINT_FIELD_HEX_ARRAY(", ", info, tag);
tprints(", jited_prog_len=");
if (saved->jited_prog_len != info.jited_prog_len)
tprintf("%" PRIu32 " => ", saved->jited_prog_len);
tprintf("%" PRIu32, info.jited_prog_len);
tprints(", jited_prog_insns=");
print_big_u64_addr(info.jited_prog_insns);
printstr_ex(tcp, info.jited_prog_insns, info.jited_prog_len,
QUOTE_FORCE_HEX);
tprints(", xlated_prog_len=");
if (saved->xlated_prog_len != info.xlated_prog_len)
tprintf("%" PRIu32 " => ", saved->xlated_prog_len);
tprintf("%" PRIu32, info.xlated_prog_len);
tprints(", xlated_prog_insns=");
print_ebpf_prog(tcp, info.xlated_prog_insns,
MIN(saved->xlated_prog_len, info.xlated_prog_len) / 8);
/*
* load_time, created_by_uid, nr_map_ids, map_ids, and name fields
* were introduced by Linux commit v4.15-rc1~84^2~605^2~4.
*/
if (len <= offsetof(struct bpf_prog_info_struct, load_time))
goto print_bpf_prog_info_end;
PRINT_FIELD_U(", ", info, load_time);
PRINT_FIELD_UID(", ", info, created_by_uid);
tprints(", nr_map_ids=");
if (saved->nr_map_ids != info.nr_map_ids)
tprintf("%" PRIu32 " => ", saved->nr_map_ids);
tprintf("%" PRIu32, info.nr_map_ids);
tprints(", map_ids=");
print_big_u64_addr(info.map_ids);
print_array(tcp, info.map_ids, MIN(saved->nr_map_ids, info.nr_map_ids),
&map_id_buf, sizeof(map_id_buf),
tfetch_mem, print_uint32_array_member, 0);
PRINT_FIELD_CSTRING(", ", info, name);
/*
* ifindex, netns_dev, and netns_ino fields were introduced
* by Linux commit v4.16-rc1~123^2~227^2~5^2~2.
*/
if (len <= offsetof(struct bpf_prog_info_struct, ifindex))
goto print_bpf_prog_info_end;
PRINT_FIELD_IFINDEX(", ", info, ifindex);
PRINT_FIELD_DEV(", ", info, netns_dev);
PRINT_FIELD_U(", ", info, netns_ino);
decode_attr_extra_data(tcp, info_buf, size, bpf_prog_info_struct_size);
print_bpf_prog_info_end:
tprints("}");
}
static const char *
fetch_bpf_obj_info(struct tcb * const tcp, uint64_t info, uint32_t size)
{
static char *info_buf;
if (!info_buf)
info_buf = xmalloc(get_pagesize());
memset(info_buf, 0, get_pagesize());
if (size > 0 && size <= get_pagesize()
&& !umoven(tcp, info, size, info_buf))
return info_buf;
return NULL;
}
static void
print_bpf_obj_info_addr(struct tcb * const tcp, uint64_t addr)
{
if (exiting(tcp))
printaddr64(addr);
}
static void
print_bpf_obj_info(struct tcb * const tcp, uint32_t bpf_fd, uint64_t info,
uint32_t size, struct obj_get_info_saved *saved)
{
if (abbrev(tcp)) {
print_bpf_obj_info_addr(tcp, info);
return;
}
static struct {
const char *id;
print_bpf_obj_info_fn print_fn;
} obj_printers[] = {
{ "anon_inode:bpf-map", print_bpf_map_info },
{ "anon_inode:bpf-prog", print_bpf_prog_info }
};
if (entering(tcp)) {
char path[PATH_MAX + 1];
if (getfdpath(tcp, bpf_fd, path, sizeof(path)) > 0) {
for (size_t i = 0; i < ARRAY_SIZE(obj_printers); ++i) {
if (!strcmp(path, obj_printers[i].id)) {
saved->print_fn =
obj_printers[i].print_fn;
break;
}
}
}
}
if (!saved || !saved->print_fn) {
print_bpf_obj_info_addr(tcp, info);
return;
}
const char *info_buf = fetch_bpf_obj_info(tcp, info, size);
if (info_buf)
saved->print_fn(tcp, bpf_fd, info_buf, size, saved);
else
print_bpf_obj_info_addr(tcp, info);
}
BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)
{
struct obj_get_info_saved *saved;
if (entering(tcp)) {
saved = xcalloc(1, sizeof(*saved));
saved->info_len = attr.info_len;
set_tcb_priv_data(tcp, saved, free);
PRINT_FIELD_FD("{info={", attr, bpf_fd, tcp);
PRINT_FIELD_U(", ", attr, info_len);
} else {
saved = get_tcb_priv_data(tcp);
if (saved && (saved->info_len != attr.info_len))
tprintf(" => %u", attr.info_len);
tprintf(", info=");
}
print_bpf_obj_info(tcp, attr.bpf_fd, attr.info, attr.info_len, saved);
if (entering(tcp))
return 0;
tprints("}");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)
{
uint32_t prog_id_buf;
if (entering(tcp)) {
PRINT_FIELD_FD("{query={", attr, target_fd, tcp);
PRINT_FIELD_XVAL_INDEX(", ", attr, attach_type, bpf_attach_type,
"BPF_???");
PRINT_FIELD_FLAGS(", ", attr, query_flags, bpf_query_flags,
"BPF_F_QUERY_???");
PRINT_FIELD_FLAGS(", ", attr, attach_flags, bpf_attach_flags,
"BPF_F_???");
tprints(", prog_ids=");
set_tcb_priv_ulong(tcp, attr.prog_cnt);
return 0;
}
print_big_u64_addr(attr.prog_ids);
print_array(tcp, attr.prog_ids, attr.prog_cnt, &prog_id_buf,
sizeof(prog_id_buf), tfetch_mem,
print_uint32_array_member, 0);
tprints(", prog_cnt=");
const uint32_t prog_cnt_entering = get_tcb_priv_ulong(tcp);
if (prog_cnt_entering != attr.prog_cnt)
tprintf("%" PRIu32 " => ", prog_cnt_entering);
tprintf("%" PRIu32, attr.prog_cnt);
tprints("}");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
BEGIN_BPF_CMD_DECODER(BPF_RAW_TRACEPOINT_OPEN)
{
enum { TP_NAME_SIZE = 128 };
tprintf("{raw_tracepoint={name=");
print_big_u64_addr(attr.name);
printstr_ex(tcp, attr.name, TP_NAME_SIZE, QUOTE_0_TERMINATED);
PRINT_FIELD_FD(", ", attr, prog_fd, tcp);
tprints("}");
}
END_BPF_CMD_DECODER(RVAL_DECODED)
SYS_FUNC(bpf)
{
@ -315,38 +726,36 @@ SYS_FUNC(bpf)
BPF_CMD_ENTRY(BPF_PROG_GET_FD_BY_ID),
BPF_CMD_ENTRY(BPF_MAP_GET_FD_BY_ID),
BPF_CMD_ENTRY(BPF_OBJ_GET_INFO_BY_FD),
BPF_CMD_ENTRY(BPF_PROG_QUERY),
BPF_CMD_ENTRY(BPF_RAW_TRACEPOINT_OPEN),
};
const unsigned int cmd = tcp->u_arg[0];
const kernel_ulong_t addr = tcp->u_arg[1];
const unsigned int size = tcp->u_arg[2];
int rc;
int rc = RVAL_DECODED;
if (entering(tcp)) {
printxval_index(bpf_commands, cmd, "BPF_???");
tprints(", ");
}
if (size > 0
&& size <= get_pagesize()
&& cmd < ARRAY_SIZE(bpf_cmd_decoders)
&& bpf_cmd_decoders[cmd]) {
static char *buf;
if (!buf)
buf = xmalloc(get_pagesize());
printxval(bpf_commands, cmd, "BPF_???");
tprints(", ");
if (size > 0
&& size <= get_pagesize()
&& cmd < ARRAY_SIZE(bpf_cmd_decoders)
&& bpf_cmd_decoders[cmd]) {
rc = umoven_or_printaddr(tcp, addr, size, buf)
? RVAL_DECODED
: bpf_cmd_decoders[cmd](tcp, addr, size, buf);
} else {
printaddr(addr);
rc = RVAL_DECODED;
}
if (!umoven_or_printaddr_ignore_syserror(tcp, addr, size, buf))
rc = bpf_cmd_decoders[cmd](tcp, addr, size, buf);
} else {
rc = bpf_cmd_decoders[cmd](tcp, addr, size, NULL) | RVAL_DECODED;
printaddr(addr);
}
if (rc & RVAL_DECODED)
if (exiting(tcp) || (rc & RVAL_DECODED))
tprintf(", %u", size);
return rc;

View File

@ -28,6 +28,33 @@
#ifndef STRACE_BPF_ATTR_H
#define STRACE_BPF_ATTR_H
/*
* The policy is that all fields of type uint64_t in this header file
* must have ATTRIBUTE_ALIGNED(8).
*
* This should not cause any contradictions with <linux/bpf.h>
* unless the latter is buggy.
*
* By word "buggy" I mean containing such changes as Linux kernel commit
* v4.16-rc1~123^2~109^2~5^2~4.
*/
#ifndef BPF_OBJ_NAME_LEN
# define BPF_OBJ_NAME_LEN 16U
#else
# if BPF_OBJ_NAME_LEN != 16U
# error "Unexpected value of BPF_OBJ_NAME_LEN"
# endif
#endif
#ifndef BPF_TAG_SIZE
# define BPF_TAG_SIZE 8
#else
# if BPF_TAG_SIZE != 8
# error "Unexpected value of BPF_TAG_SIZE"
# endif
#endif
struct BPF_MAP_CREATE_struct {
uint32_t map_type;
uint32_t key_size;
@ -36,11 +63,13 @@ struct BPF_MAP_CREATE_struct {
uint32_t map_flags;
uint32_t inner_map_fd;
uint32_t numa_node;
char map_name[BPF_OBJ_NAME_LEN];
uint32_t map_ifindex;
};
#define BPF_MAP_CREATE_struct_size \
sizeof(struct BPF_MAP_CREATE_struct)
#define expected_BPF_MAP_CREATE_struct_size 28
#define expected_BPF_MAP_CREATE_struct_size 48
struct BPF_MAP_LOOKUP_ELEM_struct {
uint32_t map_fd;
@ -56,7 +85,7 @@ struct BPF_MAP_UPDATE_ELEM_struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
uint64_t ATTRIBUTE_ALIGNED(8) value;
uint64_t flags;
uint64_t ATTRIBUTE_ALIGNED(8) flags;
};
#define BPF_MAP_UPDATE_ELEM_struct_size \
@ -92,11 +121,14 @@ struct BPF_PROG_LOAD_struct {
uint64_t ATTRIBUTE_ALIGNED(8) log_buf;
uint32_t kern_version;
uint32_t prog_flags;
char prog_name[BPF_OBJ_NAME_LEN];
uint32_t prog_ifindex;
uint32_t expected_attach_type;
};
#define BPF_PROG_LOAD_struct_size \
sizeof(struct BPF_PROG_LOAD_struct)
#define expected_BPF_PROG_LOAD_struct_size 48
offsetofend(struct BPF_PROG_LOAD_struct, expected_attach_type)
#define expected_BPF_PROG_LOAD_struct_size 72
struct BPF_OBJ_PIN_struct {
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
@ -190,4 +222,73 @@ struct BPF_OBJ_GET_INFO_BY_FD_struct /* info */ {
sizeof(struct BPF_OBJ_GET_INFO_BY_FD_struct)
#define expected_BPF_OBJ_GET_INFO_BY_FD_struct_size 16
struct BPF_PROG_QUERY_struct /* query */ {
uint32_t target_fd;
uint32_t attach_type;
uint32_t query_flags;
uint32_t attach_flags;
uint64_t ATTRIBUTE_ALIGNED(8) prog_ids;
uint32_t prog_cnt;
};
#define BPF_PROG_QUERY_struct_size \
offsetofend(struct BPF_PROG_QUERY_struct, prog_cnt)
#define expected_BPF_PROG_QUERY_struct_size 28
struct BPF_RAW_TRACEPOINT_OPEN_struct /* raw_tracepoint */ {
uint64_t ATTRIBUTE_ALIGNED(8) name;
uint32_t prog_fd;
};
#define BPF_RAW_TRACEPOINT_OPEN_struct_size \
offsetofend(struct BPF_RAW_TRACEPOINT_OPEN_struct, prog_fd)
#define expected_BPF_RAW_TRACEPOINT_OPEN_struct_size 12
struct bpf_map_info_struct {
uint32_t type;
uint32_t id;
uint32_t key_size;
uint32_t value_size;
uint32_t max_entries;
uint32_t map_flags;
char name[BPF_OBJ_NAME_LEN];
uint32_t ifindex;
/*
* The kernel UAPI is broken by Linux commit
* v4.16-rc1~123^2~109^2~5^2~4 .
*/
uint64_t ATTRIBUTE_ALIGNED(8) netns_dev; /* skip check */
uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */
};
#define bpf_map_info_struct_size \
sizeof(struct bpf_map_info_struct)
#define expected_bpf_map_info_struct_size 64
struct bpf_prog_info_struct {
uint32_t type;
uint32_t id;
uint8_t tag[BPF_TAG_SIZE];
uint32_t jited_prog_len;
uint32_t xlated_prog_len;
uint64_t ATTRIBUTE_ALIGNED(8) jited_prog_insns;
uint64_t ATTRIBUTE_ALIGNED(8) xlated_prog_insns;
uint64_t ATTRIBUTE_ALIGNED(8) load_time;
uint32_t created_by_uid;
uint32_t nr_map_ids;
uint64_t ATTRIBUTE_ALIGNED(8) map_ids;
char name[BPF_OBJ_NAME_LEN];
uint32_t ifindex;
/*
* The kernel UAPI is broken by Linux commit
* v4.16-rc1~123^2~227^2~5^2~2 .
*/
uint64_t ATTRIBUTE_ALIGNED(8) netns_dev; /* skip check */
uint64_t ATTRIBUTE_ALIGNED(8) netns_ino; /* skip check */
};
#define bpf_prog_info_struct_size \
sizeof(struct bpf_prog_info_struct)
#define expected_bpf_prog_info_struct_size 104
#endif /* !STRACE_BPF_ATTR_H */

View File

@ -34,6 +34,7 @@
#include "bpf_fprog.h"
#include <linux/filter.h>
#include "xlat/bpf_class.h"
#include "xlat/bpf_miscop.h"
#include "xlat/bpf_mode.h"
@ -43,56 +44,85 @@
#include "xlat/bpf_size.h"
#include "xlat/bpf_src.h"
static void
print_bpf_filter_code(const uint16_t code)
#include "xlat/ebpf_class.h"
#include "xlat/ebpf_mode.h"
#include "xlat/ebpf_op_alu.h"
#include "xlat/ebpf_op_jmp.h"
#include "xlat/ebpf_size.h"
void
print_bpf_filter_code(const uint16_t code, bool extended)
{
const struct xlat *mode = extended ? ebpf_mode : bpf_mode;
uint16_t i = code & ~BPF_CLASS(code);
printxval(bpf_class, BPF_CLASS(code), "BPF_???");
if (extended)
printxval_index(ebpf_class, BPF_CLASS(code), "BPF_???");
else
printxval_index(bpf_class, BPF_CLASS(code), "BPF_???");
switch (BPF_CLASS(code)) {
case BPF_ST:
case BPF_STX:
if (!extended) {
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
}
break;
}
ATTRIBUTE_FALLTHROUGH; /* extended == true */
case BPF_LD:
case BPF_LDX:
tprints("|");
printxval(bpf_size, BPF_SIZE(code), "BPF_???");
printxvals(BPF_SIZE(code), "BPF_???",
bpf_size, extended ? ebpf_size : NULL, NULL);
tprints("|");
printxval(bpf_mode, BPF_MODE(code), "BPF_???");
printxval(mode, BPF_MODE(code), "BPF_???");
break;
case BPF_ST:
case BPF_STX:
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
case BPF_MISC: /* BPF_ALU64 in eBPF */
if (!extended) {
tprints("|");
printxval(bpf_miscop, BPF_MISCOP(code), "BPF_???");
i &= ~BPF_MISCOP(code);
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
}
break;
}
break;
ATTRIBUTE_FALLTHROUGH; /* extended == true */
case BPF_ALU:
tprints("|");
printxval(bpf_src, BPF_SRC(code), "BPF_???");
tprints("|");
printxval(bpf_op_alu, BPF_OP(code), "BPF_???");
printxvals(BPF_OP(code), "BPF_???",
bpf_op_alu,
extended ? ebpf_op_alu : NULL, NULL);
break;
case BPF_JMP:
tprints("|");
printxval(bpf_src, BPF_SRC(code), "BPF_???");
tprints("|");
printxval(bpf_op_jmp, BPF_OP(code), "BPF_???");
printxvals(BPF_OP(code), "BPF_???",
bpf_op_jmp, extended ? ebpf_op_jmp : NULL, NULL);
break;
case BPF_RET:
tprints("|");
printxval(bpf_rval, BPF_RVAL(code), "BPF_???");
i &= ~BPF_RVAL(code);
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
}
break;
case BPF_MISC:
tprints("|");
printxval(bpf_miscop, BPF_MISCOP(code), "BPF_???");
i &= ~BPF_MISCOP(code);
case BPF_RET: /* Reserved in eBPF */
if (!extended) {
tprints("|");
printxval(bpf_rval, BPF_RVAL(code), "BPF_???");
i &= ~BPF_RVAL(code);
}
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
}
break;
}
}
@ -102,7 +132,7 @@ print_bpf_filter_stmt(const struct bpf_filter_block *const filter,
const print_bpf_filter_fn print_k)
{
tprints("BPF_STMT(");
print_bpf_filter_code(filter->code);
print_bpf_filter_code(filter->code, false);
tprints(", ");
if (!print_k || !print_k(filter))
tprintf("%#x", filter->k);
@ -113,7 +143,7 @@ static void
print_bpf_filter_jump(const struct bpf_filter_block *const filter)
{
tprints("BPF_JUMP(");
print_bpf_filter_code(filter->code);
print_bpf_filter_code(filter->code, false);
tprintf(", %#x, %#x, %#x)", filter->k, filter->jt, filter->jf);
}
@ -153,7 +183,7 @@ print_bpf_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
struct bpf_filter_block filter;
print_array(tcp, addr, len, &filter, sizeof(filter),
umoven_or_printaddr, print_bpf_filter_block, &fbd);
tfetch_mem, print_bpf_filter_block, &fbd);
}
}

View File

@ -2,6 +2,7 @@
* Decoder of socket filter programs.
*
* Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2017-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,23 +34,25 @@
#include <linux/filter.h>
#include "xlat/skf_ad.h"
#include "xlat/skf_off.h"
static bool
print_sock_filter_k(const struct bpf_filter_block *const fp)
{
if (BPF_CLASS(fp->code) == BPF_LD && BPF_MODE(fp->code) == BPF_ABS) {
if (fp->k >= (unsigned int) SKF_AD_OFF) {
tprints("SKF_AD_OFF+");
print_xlat32(SKF_AD_OFF);
tprints("+");
printxval(skf_ad, fp->k - (unsigned int) SKF_AD_OFF,
"SKF_AD_???");
return true;
} else if (fp->k >= (unsigned int) SKF_NET_OFF) {
tprintf("%s+%u", "SKF_NET_OFF",
fp->k - (unsigned int) SKF_NET_OFF);
print_xlat32(SKF_NET_OFF);
tprintf("+%u", fp->k - (unsigned int) SKF_NET_OFF);
return true;
} else if (fp->k >= (unsigned int) SKF_LL_OFF) {
tprintf("%s+%u", "SKF_LL_OFF",
fp->k - (unsigned int) SKF_LL_OFF);
print_xlat32(SKF_LL_OFF);
tprintf("+%u", fp->k - (unsigned int) SKF_LL_OFF);
return true;
}
}

574
btrfs.c
View File

@ -84,10 +84,6 @@ struct btrfs_ioctl_defrag_range_args {
# define BTRFS_LABEL_SIZE 256
#endif
#ifndef BTRFS_FIRST_FREE_OBJECTID
# define BTRFS_FIRST_FREE_OBJECTID 256ULL
#endif
#ifndef BTRFS_IOC_QUOTA_RESCAN
struct btrfs_ioctl_quota_rescan_args {
uint64_t flags, progress, reserved[6];
@ -128,6 +124,7 @@ struct btrfs_ioctl_search_args_v2 {
#include "xlat/btrfs_balance_flags.h"
#include "xlat/btrfs_balance_state.h"
#include "xlat/btrfs_compress_types.h"
#include "xlat/btrfs_cont_reading_from_srcdev_mode.h"
#include "xlat/btrfs_defrag_flags.h"
#include "xlat/btrfs_dev_replace_cmds.h"
#include "xlat/btrfs_dev_replace_results.h"
@ -178,31 +175,21 @@ btrfs_unparse_uuid(unsigned char *uuid, char *out)
return ret;
}
static void
print_u64(const char *name, uint64_t value)
{
tprintf(", %s=%" PRIu64, name, value);
if (value == UINT64_MAX)
tprints_comment("UINT64_MAX");
}
#define print_member_u64(obj, name) print_u64(#name, obj->name)
static void
btrfs_print_balance_args(const char *name, const struct btrfs_balance_args *bba)
{
tprintf(", %s={profiles=", name);
printflags64(btrfs_space_info_flags, bba->profiles,
"BTRFS_BLOCK_GROUP_???");
print_member_u64(bba, usage);
print_member_u64(bba, devid);
print_member_u64(bba, pstart);
print_member_u64(bba, pend);
print_member_u64(bba, vstart);
print_member_u64(bba, vend);
print_member_u64(bba, target);
tprints(", flags=");
printflags64(btrfs_balance_args, bba->flags, "BTRFS_BALANCE_ARGS_???");
tprintf(", %s=", name);
PRINT_FIELD_FLAGS("{", *bba, profiles, btrfs_space_info_flags,
"BTRFS_BLOCK_GROUP_???");
PRINT_FIELD_U64(", ", *bba, usage);
PRINT_FIELD_DEV(", ", *bba, devid);
PRINT_FIELD_U64(", ", *bba, pstart);
PRINT_FIELD_U64(", ", *bba, pend);
PRINT_FIELD_U64(", ", *bba, vstart);
PRINT_FIELD_U64(", ", *bba, vend);
PRINT_FIELD_U64(", ", *bba, target);
PRINT_FIELD_FLAGS(", ", *bba, flags, btrfs_balance_args,
"BTRFS_BALANCE_ARGS_???");
tprints("}");
}
@ -214,14 +201,12 @@ btrfs_print_balance(struct tcb *const tcp, const kernel_ulong_t arg, bool out)
if (umove_or_printaddr(tcp, arg, &balance_args))
return;
tprints("{flags=");
printflags64(btrfs_balance_flags, balance_args.flags,
"BTRFS_BALANCE_???");
if (out) {
tprints(", state=");
printflags64(btrfs_balance_state, balance_args.state,
"BTRFS_BALANCE_STATE_???");
}
PRINT_FIELD_FLAGS("{", balance_args, flags, btrfs_balance_flags,
"BTRFS_BALANCE_???");
if (out)
PRINT_FIELD_FLAGS(", ", balance_args, state,
btrfs_balance_state,
"BTRFS_BALANCE_STATE_???");
if (balance_args.flags & BTRFS_BALANCE_DATA)
btrfs_print_balance_args("data", &balance_args.data);
@ -235,53 +220,41 @@ btrfs_print_balance(struct tcb *const tcp, const kernel_ulong_t arg, bool out)
static void
btrfs_print_features(const struct btrfs_ioctl_feature_flags *flags)
{
tprints("{compat_flags=");
printflags64(btrfs_features_compat, flags->compat_flags,
"BTRFS_FEATURE_COMPAT_???");
tprints(", compat_ro_flags=");
printflags64(btrfs_features_compat_ro, flags->compat_ro_flags,
"BTRFS_FEATURE_COMPAT_RO_???");
tprints(", incompat_flags=");
printflags64(btrfs_features_incompat, flags->incompat_flags,
"BTRFS_FEATURE_INCOMPAT_???");
PRINT_FIELD_FLAGS("{", *flags, compat_flags, btrfs_features_compat,
"BTRFS_FEATURE_COMPAT_???");
PRINT_FIELD_FLAGS(", ", *flags, compat_ro_flags,
btrfs_features_compat_ro,
"BTRFS_FEATURE_COMPAT_RO_???");
PRINT_FIELD_FLAGS(", ", *flags, incompat_flags, btrfs_features_incompat,
"BTRFS_FEATURE_INCOMPAT_???");
tprints("}");
}
static void
btrfs_print_qgroup_limit(const struct btrfs_qgroup_limit *lim)
{
tprints("{flags=");
printflags64(btrfs_qgroup_limit_flags, lim->flags,
"BTRFS_QGROUP_LIMIT_???");
tprintf(", max_rfer=%" PRI__u64 ", max_excl=%" PRI__u64
", rsv_rfer=%" PRI__u64 ", rsv_excl=%" PRI__u64 "}",
lim->max_rfer, lim->max_excl,
lim->rsv_rfer, lim->rsv_excl);
PRINT_FIELD_FLAGS(", lim={", *lim, flags, btrfs_qgroup_limit_flags,
"BTRFS_QGROUP_LIMIT_???");
PRINT_FIELD_U(", ", *lim, max_rfer);
PRINT_FIELD_U(", ", *lim, max_excl);
PRINT_FIELD_U(", ", *lim, rsv_rfer);
PRINT_FIELD_U(", ", *lim, rsv_excl);
tprints("}");
}
static void
btrfs_print_key_type(uint32_t type)
{
tprintf("%u", type);
tprints_comment(xlookup(btrfs_key_types, type));
}
static void
btrfs_print_objectid(uint64_t objectid)
{
tprintf("%" PRIu64, objectid);
tprints_comment(xlookup(btrfs_tree_objectids, objectid));
}
#define btrfs_print_key_type(prefix_, where_, field_) \
PRINT_FIELD_XVAL_U((prefix_), (where_), field_, btrfs_key_types, NULL)
#define btrfs_print_objectid(prefix_, where_, field_) \
PRINT_FIELD_XVAL_U((prefix_), (where_), field_, btrfs_tree_objectids, \
NULL)
static void
btrfs_print_data_container_header(const struct btrfs_data_container *container)
{
tprintf("{bytes_left=%u, bytes_missing=%u"
", elem_cnt=%u, elem_missed=%u, val=",
container->bytes_left, container->bytes_missing,
container->elem_cnt, container->elem_missed);
PRINT_FIELD_U("{", *container, bytes_left);
PRINT_FIELD_U(", ", *container, bytes_missing);
PRINT_FIELD_U(", ", *container, elem_cnt);
PRINT_FIELD_U(", ", *container, elem_missed);
}
static void
@ -294,10 +267,16 @@ static bool
print_btrfs_data_container_logical_ino(struct tcb *tcp, void *elem_buf,
size_t elem_size, void *data)
{
const uint64_t *const record = elem_buf;
const struct {
uint64_t inum;
uint64_t offset;
uint64_t root;
} *const record = elem_buf;
tprintf("{inum=%" PRIu64 ", offset=%" PRIu64 ", root=%" PRIu64 "}",
record[0], record[1], record[2]);
PRINT_FIELD_U("{", *record, inum);
PRINT_FIELD_U(", ", *record, offset);
PRINT_FIELD_U(", ", *record, root);
tprints("}");
return true;
}
@ -314,14 +293,15 @@ btrfs_print_logical_ino_container(struct tcb *tcp,
btrfs_print_data_container_header(&container);
if (abbrev(tcp)) {
tprints("...");
tprints(", ...");
} else {
const uint64_t val_addr =
inodes_addr + offsetof(typeof(container), val);
uint64_t record[3];
tprints(", val=");
print_array(tcp, val_addr, container.elem_cnt / 3,
record, sizeof(record),
umoven_or_printaddr,
tfetch_mem,
print_btrfs_data_container_logical_ino, 0);
}
@ -352,28 +332,21 @@ btrfs_print_ino_path_container(struct tcb *tcp,
btrfs_print_data_container_header(&container);
if (abbrev(tcp)) {
tprints("...");
tprints(", ...");
} else {
uint64_t val_addr =
fspath_addr + offsetof(typeof(container), val);
uint64_t offset;
tprints(", val=");
print_array(tcp, val_addr, container.elem_cnt,
&offset, sizeof(offset),
umoven_or_printaddr,
tfetch_mem,
print_btrfs_data_container_ino_path, &val_addr);
}
btrfs_print_data_container_footer();
}
static bool
print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
tprintf("%" PRIu64, *(uint64_t *) elem_buf);
return true;
}
static void
btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr)
{
@ -382,101 +355,84 @@ btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr)
if (umove_or_printaddr(tcp, qgi_addr, &inherit))
return;
tprints("{flags=");
printflags64(btrfs_qgroup_inherit_flags, inherit.flags,
"BTRFS_QGROUP_INHERIT_???");
tprintf(", num_qgroups=%" PRI__u64 ", num_ref_copies=%" PRI__u64
", num_excl_copies=%" PRI__u64 ", lim=",
inherit.num_qgroups, inherit.num_ref_copies,
inherit.num_excl_copies);
PRINT_FIELD_FLAGS("{", inherit, flags, btrfs_qgroup_inherit_flags,
"BTRFS_QGROUP_INHERIT_???");
PRINT_FIELD_U(", ", inherit, num_qgroups);
PRINT_FIELD_U(", ", inherit, num_ref_copies);
PRINT_FIELD_U(", ", inherit, num_excl_copies);
btrfs_print_qgroup_limit(&inherit.lim);
tprints(", qgroups=");
if (abbrev(tcp)) {
tprints("...");
tprints(", ...");
} else {
uint64_t record;
tprints(", qgroups=");
print_array(tcp, qgi_addr + offsetof(typeof(inherit), qgroups),
inherit.num_qgroups, &record, sizeof(record),
umoven_or_printaddr, print_uint64, 0);
tfetch_mem, print_uint64_array_member, 0);
}
tprints("}");
}
static void
print_key_value_internal(struct tcb *tcp, const char *name, uint64_t value)
{
if (value) {
tprintf(", %s=%" PRIu64, name, value);
if (value == UINT64_MAX)
tprints_comment("UINT64_MAX");
}
}
#define print_key_value(tcp, key, name) \
print_key_value_internal((tcp), #name, (key)->name)
static void
btrfs_print_tree_search(struct tcb *tcp, struct btrfs_ioctl_search_key *key,
uint64_t buf_addr, uint64_t buf_size, bool print_size)
{
if (entering(tcp)) {
tprints("{key={tree_id=");
btrfs_print_objectid(key->tree_id);
btrfs_print_objectid("{key={", *key, tree_id);
if (key->min_objectid != BTRFS_FIRST_FREE_OBJECTID ||
!abbrev(tcp)) {
tprints(", min_objectid=");
btrfs_print_objectid(key->min_objectid);
}
!abbrev(tcp))
btrfs_print_objectid(", ", *key, min_objectid);
if (key->max_objectid != BTRFS_LAST_FREE_OBJECTID ||
!abbrev(tcp)) {
tprints(", max_objectid=");
btrfs_print_objectid(key->max_objectid);
}
!abbrev(tcp))
btrfs_print_objectid(", ", *key, max_objectid);
print_key_value(tcp, key, min_offset);
print_key_value(tcp, key, max_offset);
print_key_value(tcp, key, min_transid);
print_key_value(tcp, key, max_transid);
PRINT_FIELD_U64(", ", *key, min_offset);
PRINT_FIELD_U64(", ", *key, max_offset);
PRINT_FIELD_U64(", ", *key, min_transid);
PRINT_FIELD_U64(", ", *key, max_transid);
tprints(", min_type=");
btrfs_print_key_type(key->min_type);
tprints(", max_type=");
btrfs_print_key_type(key->max_type);
tprintf(", nr_items=%u}", key->nr_items);
btrfs_print_key_type(", ", *key, min_type);
btrfs_print_key_type(", ", *key, max_type);
PRINT_FIELD_U(", ", *key, nr_items);
tprints("}");
if (print_size)
tprintf(", buf_size=%" PRIu64, buf_size);
tprints("}");
} else {
tprintf("{key={nr_items=%u}", key->nr_items);
PRINT_FIELD_U("{key={", *key, nr_items);
tprints("}");
if (print_size)
tprintf(", buf_size=%" PRIu64, buf_size);
tprints(", buf=");
if (abbrev(tcp))
tprints("...");
else {
if (abbrev(tcp)) {
tprints(", ...");
} else {
uint64_t i;
uint64_t off = 0;
tprints("[");
tprints(", buf=[");
for (i = 0; i < key->nr_items; i++) {
struct btrfs_ioctl_search_header sh;
uint64_t addr = buf_addr + off;
if (i)
tprints(", ");
if (i > max_strlen ||
umove(tcp, addr, &sh)) {
if (i > max_strlen) {
tprints("...");
break;
}
tprintf("{transid=%" PRI__u64 ", objectid=",
sh.transid);
btrfs_print_objectid(sh.objectid);
tprintf(", offset=%" PRI__u64 ", type=", sh.offset);
btrfs_print_key_type(sh.type);
tprintf(", len=%u}", sh.len);
if (umove(tcp, addr, &sh)) {
tprints("...");
printaddr_comment(addr);
break;
}
PRINT_FIELD_U("{", sh, transid);
btrfs_print_objectid(", ", sh, objectid);
PRINT_FIELD_U(", ", sh, offset);
btrfs_print_key_type(", ", sh, type);
PRINT_FIELD_U(", ", sh, len);
tprints("}");
off += sizeof(sh) + sh.len;
}
@ -490,7 +446,8 @@ static bool
print_objectid_callback(struct tcb *tcp, void *elem_buf,
size_t elem_size, void *data)
{
btrfs_print_objectid(*(uint64_t *) elem_buf);
printxvals_ex(*(uint64_t *) elem_buf, NULL, XLAT_STYLE_FMT_U,
btrfs_tree_objectids, NULL);
return true;
}
@ -501,15 +458,22 @@ print_btrfs_ioctl_space_info(struct tcb *tcp, void *elem_buf,
{
const struct btrfs_ioctl_space_info *info = elem_buf;
tprints("{flags=");
printflags64(btrfs_space_info_flags, info->flags,
"BTRFS_SPACE_INFO_???");
tprintf(", total_bytes=%" PRI__u64 ", used_bytes=%" PRI__u64 "}",
info->total_bytes, info->used_bytes);
PRINT_FIELD_FLAGS("{", *info, flags, btrfs_space_info_flags,
"BTRFS_SPACE_INFO_???");
PRINT_FIELD_U(", ", *info, total_bytes);
PRINT_FIELD_U(", ", *info, used_bytes);
tprints("}");
return true;
}
static void
print_btrfs_timespec(const char *prefix, uint64_t sec, uint32_t nsec)
{
tprintf("%s{sec=%" PRIu64 ", nsec=%u}", prefix, sec, nsec);
tprints_comment(sprinttime_nsec(sec, nsec));
}
MPERS_PRINTER_DECL(int, btrfs_ioctl,
struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
@ -605,19 +569,14 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprintf("{start=%" PRIu64 ", len=", (uint64_t)args.start);
PRINT_FIELD_U("{", args, start);
PRINT_FIELD_U64(", ", args, len);
tprintf("%" PRIu64, (uint64_t) args.len);
if (args.len == UINT64_MAX)
tprints_comment("UINT64_MAX");
tprints(", flags=");
printflags64(btrfs_defrag_flags, args.flags,
"BTRFS_DEFRAG_RANGE_???");
tprintf(", extent_thresh=%u, compress_type=",
args.extent_thresh);
printxval(btrfs_compress_types, args.compress_type,
"BTRFS_COMPRESS_???");
PRINT_FIELD_FLAGS(", ", args, flags, btrfs_defrag_flags,
"BTRFS_DEFRAG_RANGE_???");
PRINT_FIELD_U(", ", args, extent_thresh);
PRINT_FIELD_XVAL(", ", args, compress_type,
btrfs_compress_types, "BTRFS_COMPRESS_???");
tprints("}");
break;
}
@ -635,23 +594,25 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints(" => ");
if (umove_or_printaddr(tcp, arg, &args))
break;
tprints("{");
valid = btrfs_unparse_uuid(args.uuid, uuid);
if (entering(tcp)) {
tprintf("devid=%" PRI__u64, args.devid);
PRINT_FIELD_DEV("{", args, devid);
if (valid)
tprintf(", uuid=%s", uuid);
tprints("}");
return 0;
}
tprints("{");
if (valid)
tprintf("uuid=%s, ", uuid);
tprintf("bytes_used=%" PRI__u64
", total_bytes=%" PRI__u64,
args.bytes_used, args.total_bytes);
PRINT_FIELD_U("", args, bytes_used);
PRINT_FIELD_U(", ", args, total_bytes);
PRINT_FIELD_CSTRING(", ", args, path);
tprints("}");
break;
}
@ -669,24 +630,20 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
break;
if (entering(tcp)) {
tprints("{cmd=");
printxval64(btrfs_dev_replace_cmds, args.cmd,
"BTRFS_IOCTL_DEV_REPLACE_CMD_???");
PRINT_FIELD_XVAL("{", args, cmd, btrfs_dev_replace_cmds,
"BTRFS_IOCTL_DEV_REPLACE_CMD_???");
if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_START) {
const char *str;
tprintf(", start={srcdevid=%" PRIu64
", cont_reading_from_srcdev_mode=%" PRIu64
", srcdev_name=",
(uint64_t) args.start.srcdevid,
(uint64_t) args.start.cont_reading_from_srcdev_mode);
str = (const char *) args.start.srcdev_name;
print_quoted_cstring(str,
sizeof(args.start.srcdev_name));
tprints(", tgtdev_name=");
str = (const char *) args.start.tgtdev_name;
print_quoted_cstring(str,
sizeof(args.start.tgtdev_name));
PRINT_FIELD_DEV(", start={", args.start,
srcdevid);
PRINT_FIELD_XVAL(", ", args.start,
cont_reading_from_srcdev_mode,
btrfs_cont_reading_from_srcdev_mode,
"BTRFS_IOCTL_DEV_REPLACE_CONT_READING"
"_FROM_SRCDEV_MODE_???");
PRINT_FIELD_CSTRING(", ", args.start,
srcdev_name);
PRINT_FIELD_CSTRING(", ", args.start,
tgtdev_name);
tprints("}");
}
@ -694,34 +651,28 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
return 0;
}
tprints("{result=");
printxval64(btrfs_dev_replace_results, args.result,
"BTRFS_IOCTL_DEV_REPLACE_RESULT_???");
PRINT_FIELD_XVAL("{", args, result, btrfs_dev_replace_results,
"BTRFS_IOCTL_DEV_REPLACE_RESULT_???");
if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) {
tprints(", ");
printxval64(btrfs_dev_replace_state,
args.status.replace_state,
"BTRFS_IOCTL_DEV_REPLACE_STATE_???");
tprintf(", progress_1000=%" PRIu64,
(uint64_t) args.status.progress_1000);
PRINT_FIELD_XVAL(", status={", args.status,
replace_state, btrfs_dev_replace_state,
"BTRFS_IOCTL_DEV_REPLACE_STATE_???");
PRINT_FIELD_U(", ", args.status, progress_1000);
if (args.status.progress_1000 <= 1000)
tprintf_comment("%u.%u%%",
(unsigned) args.status.progress_1000 / 10,
(unsigned) args.status.progress_1000 % 10);
tprintf(", time_started=%" PRIu64,
(uint64_t) args.status.time_started);
PRINT_FIELD_U(", ", args.status, time_started);
tprints_comment(sprinttime(args.status.time_started));
tprintf(", time_stopped=%" PRIu64,
(uint64_t) args.status.time_stopped);
PRINT_FIELD_U(", ", args.status, time_stopped);
tprints_comment(sprinttime(args.status.time_stopped));
tprintf(", num_write_errors=%" PRIu64
", num_uncorrectable_read_errors=%" PRIu64,
(uint64_t) args.status.num_write_errors,
(uint64_t) args.status.num_uncorrectable_read_errors);
PRINT_FIELD_U(", ", args.status, num_write_errors);
PRINT_FIELD_U(", ", args.status,
num_uncorrectable_read_errors);
}
tprints("}");
break;
@ -810,12 +761,11 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
#endif
btrfs_unparse_uuid(args.fsid, uuid);
tprints("{");
tprintf("max_id=%" PRI__u64 ", num_devices=%" PRI__u64
", fsid=%s, nodesize=%u, sectorsize=%u"
PRINT_FIELD_U("{", args, max_id);
PRINT_FIELD_U(", ", args, num_devices);
tprintf(", fsid=%s, nodesize=%u, sectorsize=%u"
", clone_alignment=%u",
args.max_id, args.num_devices, uuid,
nodesize, sectorsize, clone_alignment);
uuid, nodesize, sectorsize, clone_alignment);
tprints("}");
break;
}
@ -835,12 +785,14 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("{");
if (entering(tcp))
tprintf("devid=%" PRI__u64 ", ", args.devid);
if (entering(tcp)) {
PRINT_FIELD_DEV("", args, devid);
tprints(", ");
}
tprintf("nr_items=%" PRI__u64 ", flags=", args.nr_items);
printflags64(btrfs_dev_stats_flags, args.flags,
"BTRFS_DEV_STATS_???");
PRINT_FIELD_U("", args, nr_items);
PRINT_FIELD_FLAGS(", ", args, flags, btrfs_dev_stats_flags,
"BTRFS_DEV_STATS_???");
if (entering(tcp)) {
tprints("}");
@ -860,8 +812,10 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("...");
break;
}
tprintf("%" PRI__u64, args.values[i]);
tprints_comment(xlookup(btrfs_dev_stats_values, i));
tprints("[");
printxval_u(btrfs_dev_stats_values, i, NULL);
tprintf("] = %" PRI__u64, args.values[i]);
}
tprints("]}");
break;
@ -885,18 +839,15 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (args.treeid == 0)
set_tcb_priv_ulong(tcp, 1);
tprints("{treeid=");
btrfs_print_objectid(args.treeid);
tprints(", objectid=");
btrfs_print_objectid(args.objectid);
btrfs_print_objectid("{", args, treeid);
btrfs_print_objectid(", ", args, objectid);
tprints("}");
return 0;
}
tprints("{");
if (get_tcb_priv_ulong(tcp)) {
tprints("treeid=");
btrfs_print_objectid(args.treeid);
btrfs_print_objectid("", args, treeid);
tprints(", ");
}
@ -918,18 +869,15 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprints("{");
if (entering(tcp)) {
tprintf("inum=%" PRI__u64 ", size=%" PRI__u64,
args.inum, args.size);
tprints(", fspath=");
printaddr64(args.fspath);
PRINT_FIELD_U("{", args, inum);
PRINT_FIELD_U(", ", args, size);
PRINT_FIELD_ADDR64(", ", args, fspath);
tprints("}");
return 0;
}
tprints("fspath=");
tprints("{fspath=");
btrfs_print_ino_path_container(tcp, args.fspath);
tprints("}");
@ -949,11 +897,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprints("{");
if (entering(tcp)) {
tprintf("logical=%" PRI__u64 ", size=%" PRI__u64,
args.logical, args.size);
PRINT_FIELD_U("{", args, logical);
PRINT_FIELD_U(", ", args, size);
if (!IS_ARRAY_ZERO(args.reserved)) {
tprints(", reserved=[");
@ -972,13 +918,12 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
args.reserved[3]
#endif
, "BTRFS_LOGICAL_INO_ARGS_???");
tprints(", inodes=");
printaddr64(args.inodes);
PRINT_FIELD_ADDR64(", ", args, inodes);
tprints("}");
return 0;
}
tprints("inodes=");
tprints("{inodes=");
btrfs_print_logical_ino_container(tcp, args.inodes);
tprints("}");
@ -992,9 +937,10 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprintf("{assign=%" PRI__u64 ", src=%" PRI__u64
", dst=%" PRI__u64 "}",
args.assign, args.src, args.dst);
PRINT_FIELD_U("{", args, assign);
PRINT_FIELD_U(", ", args, src);
PRINT_FIELD_U(", ", args, dst);
tprints("}");
break;
}
@ -1005,8 +951,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprintf("{create=%" PRI__u64 ", qgroupid=%" PRI__u64 "}",
args.create, args.qgroupid);
PRINT_FIELD_U("{", args, create);
PRINT_FIELD_U(", ", args, qgroupid);
tprints("}");
break;
}
@ -1020,7 +967,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprintf("{qgroupid=%" PRI__u64 ", lim=", args.qgroupid);
PRINT_FIELD_U("{", args, qgroupid);
btrfs_print_qgroup_limit(&args.lim);
tprints("}");
break;
@ -1033,8 +980,8 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
printxval64(btrfs_qgroup_ctl_cmds, args.cmd,
"BTRFS_QUOTA_CTL_???");
PRINT_FIELD_XVAL("{", args, cmd, btrfs_qgroup_ctl_cmds,
"BTRFS_QUOTA_CTL_???");
tprints("}");
break;
@ -1047,7 +994,8 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprintf("{flags=%" PRIu64 "}", (uint64_t) args.flags);
PRINT_FIELD_U("{", args, flags);
tprints("}");
break;
}
@ -1061,8 +1009,8 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprintf("{flags=%" PRIu64 ", progress=", (uint64_t) args.flags);
btrfs_print_objectid(args.progress);
PRINT_FIELD_U("{", args, flags);
btrfs_print_objectid(", ", args, progress);
tprints("}");
break;
}
@ -1083,16 +1031,18 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (entering(tcp)) {
btrfs_unparse_uuid((unsigned char *)args.uuid, uuid);
tprintf("{uuid=%s, stransid=%" PRIu64
", stime=%" PRIu64 ".%u, flags=%" PRIu64
"}", uuid, (uint64_t) args.stransid,
(uint64_t) args.stime.sec, args.stime.nsec,
(uint64_t) args.flags);
tprintf("{uuid=%s", uuid);
PRINT_FIELD_U(", ", args, stransid);
print_btrfs_timespec(", stime=",
args.stime.sec, args.stime.nsec);
PRINT_FIELD_U(", ", args, flags);
tprints("}");
return 0;
}
tprintf("{rtransid=%" PRIu64 ", rtime=%" PRIu64 ".%u}",
(uint64_t) args.rtransid, (uint64_t) args.rtime.sec,
args.rtime.nsec);
PRINT_FIELD_U("{", args, rtransid);
print_btrfs_timespec(", rtime=",
args.rtime.sec, args.rtime.nsec);
tprints("}");
break;
}
@ -1111,50 +1061,34 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
break;
if (entering(tcp)) {
tprintf("{devid=%" PRI__u64, args.devid);
PRINT_FIELD_DEV("{", args, devid);
if (code == BTRFS_IOC_SCRUB) {
tprintf(", start=%" PRI__u64 ", end=",
args.start);
tprintf("%" PRI__u64, args.end);
if (args.end == UINT64_MAX)
tprints_comment("UINT64_MAX");
tprints(", flags=");
printflags64(btrfs_scrub_flags, args.flags,
"BTRFS_SCRUB_???");
PRINT_FIELD_U(", ", args, start);
PRINT_FIELD_U64(", ", args, end);
PRINT_FIELD_FLAGS(", ", args, flags,
btrfs_scrub_flags,
"BTRFS_SCRUB_???");
}
tprints("}");
return 0;
}
tprintf("{data_extents_scrubbed=%" PRI__u64
", tree_extents_scrubbed=%" PRI__u64
", data_bytes_scrubbed=%" PRI__u64
", tree_bytes_scrubbed=%" PRI__u64
", read_errors=%" PRI__u64
", csum_errors=%" PRI__u64
", verify_errors=%" PRI__u64
", no_csum=%" PRI__u64
", csum_discards=%" PRI__u64
", super_errors=%" PRI__u64
", malloc_errors=%" PRI__u64
", uncorrectable_errors=%" PRI__u64
", corrected_errors=%" PRI__u64
", last_physical=%" PRI__u64
", unverified_errors=%" PRI__u64 "}",
args.progress.data_extents_scrubbed,
args.progress.tree_extents_scrubbed,
args.progress.data_bytes_scrubbed,
args.progress.tree_bytes_scrubbed,
args.progress.read_errors,
args.progress.csum_errors,
args.progress.verify_errors,
args.progress.no_csum,
args.progress.csum_discards,
args.progress.super_errors,
args.progress.malloc_errors,
args.progress.uncorrectable_errors,
args.progress.corrected_errors,
args.progress.last_physical,
args.progress.unverified_errors);
PRINT_FIELD_U("{progress={", args.progress,
data_extents_scrubbed);
PRINT_FIELD_U(", ", args.progress, tree_extents_scrubbed);
PRINT_FIELD_U(", ", args.progress, data_bytes_scrubbed);
PRINT_FIELD_U(", ", args.progress, tree_bytes_scrubbed);
PRINT_FIELD_U(", ", args.progress, read_errors);
PRINT_FIELD_U(", ", args.progress, csum_errors);
PRINT_FIELD_U(", ", args.progress, verify_errors);
PRINT_FIELD_U(", ", args.progress, no_csum);
PRINT_FIELD_U(", ", args.progress, csum_discards);
PRINT_FIELD_U(", ", args.progress, super_errors);
PRINT_FIELD_U(", ", args.progress, malloc_errors);
PRINT_FIELD_U(", ", args.progress, uncorrectable_errors);
PRINT_FIELD_U(", ", args.progress, corrected_errors);
PRINT_FIELD_U(", ", args.progress, last_physical);
PRINT_FIELD_U(", ", args.progress, unverified_errors);
tprints("}}");
break;
}
@ -1189,11 +1123,11 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
else if (syserror(tcp)) {
if (tcp->u_error == EOVERFLOW) {
tprints(" => ");
tcp->u_error = 0;
if (!umove_or_printaddr(tcp, arg, &args))
tprintf("{buf_size=%" PRIu64 "}",
(uint64_t)args.buf_size);
tcp->u_error = EOVERFLOW;
if (!umove_or_printaddr_ignore_syserror(tcp,
arg, &args)) {
PRINT_FIELD_U("{", args, buf_size);
tprints("}");
}
}
break;
} else
@ -1217,26 +1151,23 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprints("{send_fd=");
printfd(tcp, args.send_fd);
tprintf(", clone_sources_count=%" PRIu64 ", clone_sources=",
(uint64_t) args.clone_sources_count);
PRINT_FIELD_FD("{", args, send_fd, tcp);
PRINT_FIELD_U(", ", args, clone_sources_count);
tprints(", clone_sources=");
if (abbrev(tcp))
tprints("...");
printaddr((uintptr_t) args.clone_sources);
else {
uint64_t record;
print_array(tcp, ptr_to_kulong(args.clone_sources),
args.clone_sources_count,
&record, sizeof(record),
umoven_or_printaddr,
tfetch_mem,
print_objectid_callback, 0);
}
tprints(", parent_root=");
btrfs_print_objectid(args.parent_root);
tprints(", flags=");
printflags64(btrfs_send_flags, args.flags,
"BTRFS_SEND_FLAGS_???");
btrfs_print_objectid(", ", args, parent_root);
PRINT_FIELD_FLAGS(", ", args, flags, btrfs_send_flags,
"BTRFS_SEND_FLAGS_???");
tprints("}");
break;
}
@ -1254,28 +1185,27 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprints("{");
if (entering(tcp)) {
tprintf("space_slots=%" PRI__u64 "}", args.space_slots);
PRINT_FIELD_U("{", args, space_slots);
tprints("}");
return 0;
}
tprintf("total_spaces=%" PRI__u64, args.total_spaces);
PRINT_FIELD_U("{", args, total_spaces);
if (args.space_slots == 0 && args.total_spaces) {
tprints("}");
break;
}
tprints(", spaces=");
if (abbrev(tcp))
tprints("...");
else {
if (abbrev(tcp)) {
tprints(", ...");
} else {
struct btrfs_ioctl_space_info info;
tprints(", spaces=");
print_array(tcp, arg + offsetof(typeof(args), spaces),
args.total_spaces,
&info, sizeof(info), umoven_or_printaddr,
&info, sizeof(info), tfetch_mem,
print_btrfs_ioctl_space_info, 0);
}
tprints("}");
@ -1296,8 +1226,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (umove_or_printaddr(tcp, arg, &args))
break;
tprints("{fd=");
printfd(tcp, args.fd);
PRINT_FIELD_FD("{", args, fd, tcp);
PRINT_FIELD_CSTRING(", ", args, name);
tprints("}");
break;
@ -1318,15 +1247,13 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
break;
if (entering(tcp)) {
tprints("{fd=");
printfd(tcp, args.fd);
tprints(", flags=");
printflags64(btrfs_snap_flags_v2, args.flags,
"BTRFS_SUBVOL_???");
PRINT_FIELD_FD("{", args, fd, tcp);
PRINT_FIELD_FLAGS(", ", args, flags,
btrfs_snap_flags_v2,
"BTRFS_SUBVOL_???");
if (args.flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
tprintf(", size=%" PRIu64 ", qgroup_inherit=",
(uint64_t) args.size);
PRINT_FIELD_U(", ", args, size);
tprints(", qgroup_inherit=");
btrfs_print_qgroup_inherit(tcp,
ptr_to_kulong(args.qgroup_inherit));
}
@ -1334,7 +1261,8 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("}");
return 0;
}
tprintf("{transid=%" PRIu64 "}", (uint64_t) args.transid);
PRINT_FIELD_U("{", args, transid);
tprints("}");
break;
}

View File

@ -1,7 +1,7 @@
#!/bin/sh -ex
type sudo >/dev/null 2>&1 && sudo=sudo || sudo=
common_packages='autoconf automake faketime file gawk gcc-multilib git gzip libunwind8-dev make xz-utils'
common_packages='autoconf automake faketime file gawk gcc-multilib git gzip libbluetooth-dev make xz-utils'
updated=
apt_get_install()
@ -17,9 +17,10 @@ apt_get_install()
git_installed=
clone_repo()
{
local src dst
local src dst branch
src="$1"; shift
dst="$1"; shift
branch="${1-}"
[ -n "$git_installed" ] || {
apt_get_install git ca-certificates
@ -35,12 +36,12 @@ clone_repo()
;;
esac
git clone --depth=1 "$src" "$dst"
git clone --depth=1 ${branch:+--branch $branch} "$src" "$dst"
}
case "$KHEADERS" in
*/*)
clone_repo https://github.com/"$KHEADERS" kernel
clone_repo https://github.com/"$KHEADERS" kernel ${KBRANCH-}
apt_get_install $common_packages
$sudo make -C kernel headers_install INSTALL_HDR_PATH=/opt/kernel
$sudo rm -rf kernel
@ -90,6 +91,15 @@ case "$CC" in
;;
esac
case "${STACKTRACE-}" in
libdw)
apt_get_install libdw-dev
;;
libunwind)
apt_get_install libunwind8-dev
;;
esac
case "${CHECK-}" in
coverage)
apt_get_install lcov

View File

@ -24,6 +24,15 @@ case "${TARGET-}" in
;;
esac
case "${STACKTRACE-}" in
libdw|libunwind)
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-$STACKTRACE"
;;
no)
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --disable-stacktrace"
;;
esac
case "$KHEADERS" in
*/*)
CPPFLAGS='-isystem /opt/kernel/include'

View File

@ -46,9 +46,9 @@ AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests 1.13])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
RPM_CHANGELOGTIME="$(LC_TIME=C date '+%a %b %d %Y')"
RPM_CHANGELOGTIME="$(LC_TIME=C date -u '+%a %b %d %Y')"
AC_SUBST(RPM_CHANGELOGTIME)
DEB_CHANGELOGTIME="$(LC_TIME=C date -R)"
DEB_CHANGELOGTIME="$(LC_TIME=C date -u -R)"
AC_SUBST(DEB_CHANGELOGTIME)
AC_PROG_CC
@ -322,7 +322,9 @@ AC_CHECK_TYPES(m4_normalize([
struct flock,
struct flock64,
struct __kernel_flock,
struct __kernel_flock64
struct __kernel_flock64,
struct f_owner_ex,
struct __kernel_f_owner_ex
]),,,
[#include <sys/types.h>
#include <linux/fcntl.h>])
@ -382,7 +384,6 @@ AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/guarded_storage.h
asm/sysmips.h
bluetooth/bluetooth.h
elf.h
iconv.h
inttypes.h
@ -465,10 +466,20 @@ AC_CHECK_HEADERS([linux/input.h], [
])
AC_CHECK_HEADERS([linux/bpf.h], [
AC_CHECK_TYPES([struct bpf_insn],,, [#include <linux/bpf.h>])
AC_CHECK_TYPES(m4_normalize([
struct bpf_insn,
struct bpf_map_info,
struct bpf_prog_info
]),,, [#include <linux/bpf.h>])
st_BPF_ATTR
])
AC_CHECK_HEADERS([bluetooth/bluetooth.h], [
AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,,
[#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>])
])
AC_CHECK_TYPES(m4_normalize([
struct br_mdb_entry,
struct br_port_msg
@ -485,7 +496,8 @@ AC_CHECK_TYPES([struct netconfmsg],,, [#include <linux/netconf.h>])
AC_CHECK_TYPES(m4_normalize([
struct rta_mfc_stats,
struct rtvia
]),,, [#include <linux/rtnetlink.h>])
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_MEMBERS([struct ndt_stats.ndts_table_fulls],,, [#include <linux/neighbour.h>])
AC_CHECK_TYPES(m4_normalize([
@ -495,13 +507,23 @@ AC_CHECK_TYPES(m4_normalize([
AC_CHECK_TYPES(m4_normalize([
struct ifla_bridge_id,
struct ifla_cacheinfo,
struct ifla_port_vsi,
struct rtnl_link_stats64
]),,, [#include <linux/if_link.h>])
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct rtnl_link_stats.rx_nohandler,
struct rtnl_link_stats64.rx_nohandler
]),,, [#include <linux/if_link.h>])
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_DECLS(m4_normalize([
IFLA_PORT_SELF,
IFLA_PROTINFO,
IFLA_AF_SPEC,
IFLA_XDP
]),,, [#include <sys/socket.h>
#include <linux/rtnetlink.h>])
AC_CHECK_TYPES(m4_normalize([
struct gnet_stats_basic,
@ -510,9 +532,15 @@ AC_CHECK_TYPES(m4_normalize([
struct gnet_stats_rate_est64
]),,, [#include <linux/gen_stats.h>])
AC_CHECK_TYPES([struct tc_sizespec],,, [#include <linux/pkt_sched.h>])
AC_CHECK_TYPES([struct tc_sizespec],,, [#include <linux/types.h>
#include <linux/pkt_sched.h>])
AC_CHECK_DECLS([TCA_STAB_DATA],,, [#include <linux/types.h>
#include <linux/pkt_sched.h>])
AC_CHECK_TYPES([struct fib_rule_uid_range],,, [#include <linux/fib_rules.h>])
AC_CHECK_TYPES(m4_normalize([
struct fib_rule_uid_range,
struct fib_rule_port_range
]),,, [#include <linux/fib_rules.h>])
AC_CHECK_TYPES([struct statfs], [
AC_CHECK_MEMBERS(m4_normalize([
@ -552,6 +580,11 @@ AC_CHECK_TYPES(m4_normalize([
struct kvm_userspace_memory_region
]),,, [#include <linux/kvm.h>])
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$srcdir/linux"
AC_CHECK_TYPES([struct __aio_sigset],,, [#include <linux/aio_abi.h>])
CPPFLAGS="$saved_CPPFLAGS"
AC_CHECK_HEADERS([linux/btrfs.h], [
AC_CHECK_MEMBERS(m4_normalize([
struct btrfs_ioctl_feature_flags.compat_flags,
@ -797,13 +830,31 @@ fi
AC_CACHE_CHECK([for static_assert], [st_cv_have_static_assert],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <assert.h>]],
[[static_assert(1,"")]])],
[[static_assert(1,"")]]
)
],
[st_cv_have_static_assert=yes],
[st_cv_have_static_assert=no])])
if test "x$st_cv_have_static_assert" = xyes; then
AC_DEFINE([HAVE_STATIC_ASSERT], [1],
[Define to 1 if the system provides static_assert])
fi
[AC_LINK_IFELSE([AC_LANG_PROGRAM([],
[[_Static_assert(1,"")]]
)
],
[st_cv_have_static_assert=_Static_assert],
[st_cv_have_static_assert=no]
)
]
)
]
)
case "x$st_cv_have_static_assert" in
xyes)
AC_DEFINE([HAVE_STATIC_ASSERT], [1],
[Define to 1 if the system provides static_assert])
;;
x_Static_assert)
AC_DEFINE([HAVE__STATIC_ASSERT], [1],
[Define to 1 if the system provides _Static_assert])
;;
esac
AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
if test "x$ac_cv_lib_dl_dladdr" = xyes; then
@ -844,148 +895,7 @@ AC_PATH_PROG([PERL], [perl])
AC_CHECK_TOOL([READELF], [readelf])
dnl stack trace with libunwind
libunwind_CPPFLAGS=
libunwind_LDFLAGS=
libunwind_LIBS=
AC_ARG_WITH([libunwind],
[AS_HELP_STRING([--with-libunwind],
[use libunwind to implement stack tracing support])],
[case "${withval}" in
yes|no|check) ;;
*) with_libunwind=yes
libunwind_CPPFLAGS="-I${withval}/include"
libunwind_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libunwind=check]
)
use_libunwind=no
AS_IF([test "x$with_libunwind" != xno],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
AC_CHECK_HEADERS([libunwind-ptrace.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
AC_CHECK_LIB([unwind], [backtrace],
[libunwind_LIBS="-lunwind $libunwind_LIBS"
AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
saved_LIBS="$LIBS"
LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
[[return !unw_create_addr_space(0, 0)]])
],
[AC_MSG_RESULT([yes])
libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
[libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
use_libunwind=yes
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
fi
],
[$libunwind_LIBS]
)
],
[AC_MSG_RESULT([no])
if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
fi
]
)
LIBS="$saved_LIBS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind])
fi
],
[$libunwind_LIBS]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
dnl enable libunwind
AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
if test "x$use_libunwind" = xyes; then
AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
AC_SUBST(libunwind_LIBS)
AC_SUBST(libunwind_LDFLAGS)
AC_SUBST(libunwind_CPPFLAGS)
fi
AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
AC_MSG_RESULT([$use_libunwind])
dnl demangling symbols in the stack trace
libiberty_CPPFLAGS=
libiberty_LDFLAGS=
libiberty_LIBS=
AC_ARG_WITH([libiberty],
[AS_HELP_STRING([--with-libiberty],
[use libiberty to demangle symbols in stack trace])],
[case "${withval}" in
yes|no|check) ;;
*) with_libiberty=yes
libiberty_CPPFLAGS="-I${withval}/include"
libiberty_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libiberty=check]
)
use_libiberty=no
AS_IF([test "x$use_libunwind" = xyes && test "x$with_libiberty" != xno],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS"
AC_CHECK_HEADERS([demangle.h libiberty/demangle.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libiberty_LDFLAGS"
AC_CHECK_LIB([iberty],[cplus_demangle],
[libiberty_LIBS="-liberty"
use_libiberty=yes
],
[if test "x$with_libiberty" != xcheck; then
AC_MSG_FAILURE([failed to find cplus_demangle in libiberty])
fi
]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libiberty" != xcheck; then
AC_MSG_FAILURE([failed to find demangle.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
dnl enable libiberty
AC_MSG_CHECKING([whether to enable demangling symbols in stack trace])
if test "x$use_libiberty" = xyes; then
AC_DEFINE([USE_DEMANGLE], 1, [Do demangling symbols in stack trace])
AC_SUBST(libiberty_LIBS)
AC_SUBST(libiberty_LDFLAGS)
AC_SUBST(libiberty_CPPFLAGS)
fi
AM_CONDITIONAL([USE_DEMANGLE], [test "x$use_libiberty" = xyes])
AC_MSG_RESULT([$use_libiberty])
st_STACKTRACE
if test "$arch" = mips && test "$no_create" != yes; then
mkdir -p linux/mips

View File

@ -2,6 +2,7 @@
: ${YEAR_FILE:=$1}
: ${DEFAULT_YEAR:=$2}
LC_TIME=C; export LC_TIME
year=
@ -13,11 +14,17 @@ year=
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
[ -n "${year}" ] ||
year="$(date +%Y -d "$(git show --format=format:%cD --no-patch)")"
year="$(date -u +%Y -d "$(git show --format=format:%cD --no-patch)")"
[ -n "${year}" ] || year="${DEFAULT_YEAR}"
[ -n "${year}" ] ||
year="${DEFAULT_YEAR}"
[ -n "${year}" ] || year="$(date "+%Y")"
[ -n "${year}" ] ||
[ -z "${SOURCE_DATE_EPOCH-}" ] ||
year="$(date -u +%Y -d "@${SOURCE_DATE_EPOCH}")"
[ -n "${year}" ] ||
year="$(date -u +%Y)"
[ -n "${year}" ] || {
echo >&2 'Undefined year.'

6
debian/changelog.in vendored
View File

@ -4,6 +4,12 @@ strace (@PACKAGE_VERSION@-1) experimental; urgency=low
-- Strace <@PACKAGE_BUGREPORT@> @DEB_CHANGELOGTIME@
strace (4.22-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Thu, 05 Apr 2018 04:05:06 +0000
strace (4.21-1) unstable; urgency=medium
* New upstream version.

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: strace
Maintainer: Steve McIntyre <93sam@debian.org>
Section: utils
Priority: optional
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 s390 sparc sparc64 x32], debhelper (>= 7.0.0), gawk, libunwind-dev [amd64], libiberty-dev [amd64], libbluetooth-dev
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [amd64 i386 powerpc ppc64 ppc64el s390 s390x sparc sparc64 x32], debhelper (>= 7.0.0), gawk, libdw-dev, libiberty-dev, libbluetooth-dev
Standards-Version: 4.1.3
Homepage: https://strace.io
Vcs-Git: https://salsa.debian.org/debian/strace.git

2
debian/rules vendored
View File

@ -61,7 +61,7 @@ build/Makefile: configure
build-udeb/Makefile: configure
mkdir -p $(@D)
cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \
--without-libunwind --without-libiberty $(CONFIG_OPTS)
--without-stacktrace --without-libiberty $(CONFIG_OPTS)
build64/Makefile: configure
mkdir -p $(@D)

487
defs.h
View File

@ -166,6 +166,12 @@ extern char *stpcpy(char *dst, const char *src);
# define HAVE_PERSONALITY_2_MPERS 0
#endif
#ifdef WORDS_BIGENDIAN
# define is_bigendian true
#else
# define is_bigendian false
#endif
typedef struct ioctlent {
const char *symbol;
unsigned int code;
@ -176,12 +182,22 @@ typedef struct ioctlent {
#define INJECT_F_RETVAL 0x04
#define INJECT_F_DELAY_ENTER 0x08
#define INJECT_F_DELAY_EXIT 0x10
#define INJECT_F_SYSCALL 0x20
#define INJECT_ACTION_FLAGS \
(INJECT_F_SIGNAL \
|INJECT_F_ERROR \
|INJECT_F_RETVAL \
|INJECT_F_DELAY_ENTER \
|INJECT_F_DELAY_EXIT \
)
struct inject_data {
uint8_t flags; /* 5 of 8 flags are used so far */
uint8_t flags; /* 6 of 8 flags are used so far */
uint8_t signo; /* NSIG <= 128 */
uint16_t rval_idx; /* index in retval_vec */
uint16_t delay_idx; /* index in delay_data_vec */
uint16_t scno; /* syscall to be injected instead of -1 */
};
struct inject_opts {
@ -219,10 +235,8 @@ struct tcb {
struct timespec delay_expiration_time; /* When does the delay end */
struct mmap_cache_t *mmap_cache;
unsigned int mmap_cache_size;
unsigned int mmap_cache_generation;
#ifdef USE_LIBUNWIND
#ifdef ENABLE_STACKTRACE
void *unwind_ctx;
struct unwind_queue_t *unwind_queue;
#endif
@ -257,6 +271,8 @@ struct tcb {
#define TCB_INJECT_DELAY_EXIT 0x800 /* Current syscall needs to be delayed
on exit */
#define TCB_DELAYED 0x1000 /* Current syscall has been delayed */
#define TCB_TAMPERED_NO_FAIL 0x2000 /* We tamper tcb with syscall
that should not fail. */
/* qualifier flags */
#define QUAL_TRACE 0x001 /* this system call should be traced */
@ -281,24 +297,38 @@ struct tcb {
#define recovering(tcp) ((tcp)->flags & TCB_RECOVERING)
#define inject_delay_exit(tcp) ((tcp)->flags & TCB_INJECT_DELAY_EXIT)
#define syscall_delayed(tcp) ((tcp)->flags & TCB_DELAYED)
#define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL)
#include "xlat.h"
extern const struct xlat addrfams[];
/** Protocol hardware identifiers array, sorted, defined in sockaddr.c. */
extern const struct xlat arp_hardware_types[];
/** Protocol hardware identifiers array size without terminating record. */
extern const size_t arp_hardware_types_size;
extern const struct xlat at_flags[];
extern const struct xlat clocknames[];
extern const struct xlat dirent_types[];
/** Ethernet protocols list, sorted and unterminated, defined in sockaddr.c. */
/** Ethernet protocols list, sorted, defined in sockaddr.c. */
extern const struct xlat ethernet_protocols[];
/** Ethernet protocols array size without terminating record. */
extern const size_t ethernet_protocols_size;
extern const struct xlat evdev_abs[];
extern const struct xlat iffflags[];
/** IP protocols list, sorted, defined in net.c. */
extern const struct xlat inet_protocols[];
/** IP protocols array size without terminating record. */
extern const size_t inet_protocols_size;
extern const struct xlat evdev_abs[];
/** Number of elements in evdev_abs array without the terminating record. */
extern const size_t evdev_abs_size;
extern const struct xlat iffflags[];
extern const struct xlat ip_type_of_services[];
extern const struct xlat ipc_private[];
extern const struct xlat msg_flags[];
extern const struct xlat netlink_protocols[];
extern const struct xlat nl_netfilter_msg_types[];
@ -377,7 +407,7 @@ extern struct path_set {
#define tracing_paths (global_path_set.num_selected != 0)
extern unsigned xflag;
extern unsigned followfork;
#ifdef USE_LIBUNWIND
#ifdef ENABLE_STACKTRACE
/* if this is true do the stack trace for every system call */
extern bool stack_trace_enabled;
#endif
@ -456,43 +486,90 @@ static inline int set_tcb_priv_ulong(struct tcb *tcp, unsigned long val)
return set_tcb_priv_data(tcp, (void *) val, 0);
}
/**
* @return 0 on success, -1 on error.
*/
extern int
umoven(struct tcb *, kernel_ulong_t addr, unsigned int len, void *laddr);
#define umove(pid, addr, objp) \
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
/**
* @return true on success, false on error.
*/
extern bool
tfetch_mem64(struct tcb *, uint64_t addr, unsigned int len, void *laddr);
static inline bool
tfetch_mem(struct tcb *tcp, const kernel_ulong_t addr,
unsigned int len, void *laddr)
{
return tfetch_mem64(tcp, addr, len, laddr);
}
#define tfetch_obj(pid, addr, objp) \
tfetch_mem((pid), (addr), sizeof(*(objp)), (void *) (objp))
/**
* @return true on success, false on error.
*/
extern bool
tfetch_mem64_ignore_syserror(struct tcb *, uint64_t addr,
unsigned int len, void *laddr);
static inline bool
tfetch_mem_ignore_syserror(struct tcb *tcp, const kernel_ulong_t addr,
unsigned int len, void *laddr)
{
return tfetch_mem64_ignore_syserror(tcp, addr, len, laddr);
}
/**
* @return 0 on success, -1 on error (and print addr).
*/
extern int
umoven_or_printaddr(struct tcb *, kernel_ulong_t addr,
unsigned int len, void *laddr);
umoven_or_printaddr64(struct tcb *, uint64_t addr,
unsigned int len, void *laddr);
#define umove_or_printaddr64(pid, addr, objp) \
umoven_or_printaddr64((pid), (addr), sizeof(*(objp)), (void *) (objp))
static inline int
umoven_or_printaddr(struct tcb *tcp, const kernel_ulong_t addr,
unsigned int len, void *laddr)
{
return umoven_or_printaddr64(tcp, addr, len, laddr);
}
#define umove_or_printaddr(pid, addr, objp) \
umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp))
/**
* @return 0 on success, -1 on error (and print addr).
*/
extern int
umoven_or_printaddr_ignore_syserror(struct tcb *, kernel_ulong_t addr,
unsigned int len, void *laddr);
umoven_or_printaddr64_ignore_syserror(struct tcb *, uint64_t addr,
unsigned int len, void *laddr);
#define umove_or_printaddr64_ignore_syserror(pid, addr, objp) \
umoven_or_printaddr64_ignore_syserror((pid), (addr), sizeof(*(objp)), \
(void *) (objp))
static inline int
umoven_or_printaddr_ignore_syserror(struct tcb *tcp, const kernel_ulong_t addr,
unsigned int len, void *laddr)
{
return umoven_or_printaddr64_ignore_syserror(tcp, addr, len, laddr);
}
#define umove_or_printaddr_ignore_syserror(pid, addr, objp) \
umoven_or_printaddr_ignore_syserror((pid), (addr), sizeof(*(objp)), \
(void *) (objp))
/**
* @return strlen + 1 on success, 0 on success and no NUL seen, -1 on error.
*/
extern int
umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr);
extern int upeek(struct tcb *tcp, unsigned long, kernel_ulong_t *);
extern int upoke(struct tcb *tcp, unsigned long, kernel_ulong_t);
extern bool
print_array(struct tcb *,
kernel_ulong_t start_addr,
size_t nmemb,
void *elem_buf,
size_t elem_size,
int (*umoven_func)(struct tcb *,
kernel_ulong_t,
unsigned int,
void *),
bool (*print_func)(struct tcb *,
void *elem_buf,
size_t elem_size,
void *opaque_data),
void *opaque_data);
#if HAVE_ARCH_GETRVAL2
extern long getrval2(struct tcb *);
#endif
@ -500,16 +577,26 @@ extern long getrval2(struct tcb *);
extern const char *signame(const int);
extern void pathtrace_select_set(const char *, struct path_set *);
extern bool pathtrace_match_set(struct tcb *, struct path_set *);
#define pathtrace_select(tcp) \
pathtrace_select_set(tcp, &global_path_set)
#define pathtrace_match(tcp) \
pathtrace_match_set(tcp, &global_path_set)
static inline void
pathtrace_select(const char *path)
{
return pathtrace_select_set(path, &global_path_set);
}
static inline bool
pathtrace_match(struct tcb *tcp)
{
return pathtrace_match_set(tcp, &global_path_set);
}
extern int getfdpath(struct tcb *, int, char *, unsigned);
extern unsigned long getfdinode(struct tcb *, int);
extern enum sock_proto getfdproto(struct tcb *, int);
extern const char *xlookup(const struct xlat *, const uint64_t);
extern const char *xlat_search(const struct xlat *, const size_t, const uint64_t);
extern const char *xlat_idx(const struct xlat *xlat, size_t nmemb, uint64_t val);
struct dyxlat;
struct dyxlat *dyxlat_alloc(size_t nmemb);
@ -564,11 +651,36 @@ extern int printllval(struct tcb *, const char *, int)
ATTRIBUTE_FORMAT((printf, 2, 0));
extern void printaddr64(uint64_t addr);
extern void printaddr(kernel_ulong_t addr);
extern int printxvals(const uint64_t, const char *, const struct xlat *, ...)
static inline void
printaddr(const kernel_ulong_t addr)
{
printaddr64(addr);
}
#define xlat_verbose(style_) ((style_) & XLAT_STYLE_VERBOSITY_MASK)
#define xlat_format(style_) ((style_) & XLAT_STYLE_FORMAT_MASK)
extern enum xlat_style xlat_verbosity;
extern int printxvals_ex(uint64_t val, const char *dflt,
enum xlat_style, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
extern int printxval_searchn(const struct xlat *xlat, size_t xlat_size,
uint64_t val, const char *dflt);
#define printxvals(val_, dflt_, ...) \
printxvals_ex((val_), (dflt_), XLAT_STYLE_DEFAULT, __VA_ARGS__)
extern int printxval_searchn_ex(const struct xlat *, size_t xlat_size,
uint64_t val, const char *dflt,
enum xlat_style);
static inline int
printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
const char *dflt)
{
return printxval_searchn_ex(xlat, xlat_size, val, dflt,
XLAT_STYLE_DEFAULT);
}
/**
* Wrapper around printxval_searchn that passes ARRAY_SIZE - 1
* as the array size, as all arrays are XLAT_END-terminated and
@ -576,24 +688,148 @@ extern int printxval_searchn(const struct xlat *xlat, size_t xlat_size,
*/
#define printxval_search(xlat__, val__, dflt__) \
printxval_searchn(xlat__, ARRAY_SIZE(xlat__) - 1, val__, dflt__)
extern int sprintxval(char *buf, size_t size, const struct xlat *,
unsigned int val, const char *dflt);
#define printxval_search_ex(xlat__, val__, dflt__) \
printxval_searchn_ex((xlat__), ARRAY_SIZE(xlat__) - 1, (val__), \
(dflt__), XLAT_STYLE_DEFAULT)
extern int printxval_indexn_ex(const struct xlat *, size_t xlat_size,
uint64_t val, const char *dflt, enum xlat_style);
static inline int
printxval_indexn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
const char *dflt)
{
return printxval_indexn_ex(xlat, xlat_size, val, dflt,
XLAT_STYLE_DEFAULT);
}
#define printxval_index(xlat__, val__, dflt__) \
printxval_indexn(xlat__, ARRAY_SIZE(xlat__) - 1, val__, dflt__)
#define printxval_index_ex(xlat__, val__, dflt__) \
printxval_indexn_ex((xlat__), ARRAY_SIZE(xlat__) - 1, (val__), \
(dflt__), XLAT_STYLE_DEFAULT)
extern int sprintxval_ex(char *buf, size_t size, const struct xlat *,
unsigned int val, const char *dflt, enum xlat_style);
static inline int
sprintxval(char *buf, size_t size, const struct xlat *xlat, unsigned int val,
const char *dflt)
{
return sprintxval_ex(buf, size, xlat, val, dflt, XLAT_STYLE_DEFAULT);
}
extern void printxval_dispatch_ex(const struct xlat *, size_t xlat_size,
uint64_t val, const char *dflt,
enum xlat_type, enum xlat_style);
static inline void
printxval_dispatch(const struct xlat *xlat, size_t xlat_size, uint64_t val,
const char *dflt, enum xlat_type xt)
{
return printxval_dispatch_ex(xlat, xlat_size, val, dflt, xt,
XLAT_STYLE_DEFAULT);
}
/** Print a value in accordance with xlat formatting settings. */
extern void print_xlat_ex(uint64_t val, const char *str, enum xlat_style style);
#define print_xlat(val_) \
print_xlat_ex((val_), #val_, XLAT_STYLE_DEFAULT)
#define print_xlat32(val_) \
print_xlat_ex((uint32_t) (val_), #val_, XLAT_STYLE_DEFAULT)
#define print_xlat_u(val_) \
print_xlat_ex((val_), #val_, XLAT_STYLE_FMT_U)
#define print_xlat_d(val_) \
print_xlat_ex((val_), #val_, XLAT_STYLE_FMT_D)
extern int printargs(struct tcb *);
extern int printargs_u(struct tcb *);
extern int printargs_d(struct tcb *);
extern int printflags_ex(uint64_t, const char *, const struct xlat *, ...)
extern int printflags_ex(uint64_t flags, const char *dflt,
enum xlat_style, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
extern const char *sprintflags(const char *, const struct xlat *, uint64_t);
extern const char *sprintflags_ex(const char *prefix, const struct xlat *,
uint64_t flags, enum xlat_style);
static inline const char *
sprintflags(const char *prefix, const struct xlat *xlat, uint64_t flags)
{
return sprintflags_ex(prefix, xlat, flags, XLAT_STYLE_DEFAULT);
}
extern const char *sprinttime(long long sec);
extern const char *sprinttime_nsec(long long sec, unsigned long long nsec);
extern const char *sprinttime_usec(long long sec, unsigned long long usec);
extern const char *sprint_mac_addr(const uint8_t addr[], size_t size);
extern void print_symbolic_mode_t(unsigned int);
extern void print_numeric_umode_t(unsigned short);
extern void print_numeric_long_umask(unsigned long);
extern void print_dev_t(unsigned long long dev);
extern void print_abnormal_hi(kernel_ulong_t);
extern bool print_int32_array_member(struct tcb *, void *elem_buf,
size_t elem_size, void *data);
extern bool print_uint32_array_member(struct tcb *, void *elem_buf,
size_t elem_size, void *data);
extern bool print_uint64_array_member(struct tcb *, void *elem_buf,
size_t elem_size, void *data);
typedef bool (*tfetch_mem_fn)(struct tcb *, kernel_ulong_t addr,
unsigned int size, void *dest);
typedef bool (*print_fn)(struct tcb *, void *elem_buf,
size_t elem_size, void *opaque_data);
enum print_array_flag_bits {
PAF_PRINT_INDICES_BIT = XLAT_STYLE_SPEC_BITS + 1,
PAF_INDEX_XLAT_SORTED_BIT,
PAF_INDEX_XLAT_VALUE_INDEXED_BIT,
};
#define FLAG_(name_) name_ = 1 << name_##_BIT
enum print_array_flags {
FLAG_(PAF_PRINT_INDICES),
FLAG_(PAF_INDEX_XLAT_SORTED),
FLAG_(PAF_INDEX_XLAT_VALUE_INDEXED),
};
#undef FLAG_
/**
* @param flags Combination of xlat style settings and additional flags from
* enum print_array_flags.
*/
extern bool
print_array_ex(struct tcb *,
kernel_ulong_t start_addr,
size_t nmemb,
void *elem_buf,
size_t elem_size,
tfetch_mem_fn tfetch_mem_func,
print_fn print_func,
void *opaque_data,
unsigned int flags,
const struct xlat *index_xlat,
size_t index_xlat_size,
const char *index_dflt);
static inline bool
print_array(struct tcb *const tcp,
const kernel_ulong_t start_addr,
const size_t nmemb,
void *const elem_buf,
const size_t elem_size,
tfetch_mem_fn tfetch_mem_func,
print_fn print_func,
void *const opaque_data)
{
return print_array_ex(tcp, start_addr, nmemb, elem_buf, elem_size,
tfetch_mem_func, print_func, opaque_data,
0, NULL, 0, NULL);
}
extern kernel_ulong_t *
fetch_indirect_syscall_args(struct tcb *, kernel_ulong_t addr, unsigned int n_args);
@ -681,8 +917,15 @@ print_struct_statfs(struct tcb *, kernel_ulong_t addr);
extern void
print_struct_statfs64(struct tcb *, kernel_ulong_t addr, kernel_ulong_t size);
extern int
fetch_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr);
extern void
print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr);
extern void print_ifindex(unsigned int);
extern void print_bpf_filter_code(const uint16_t code, bool extended);
extern void qualify(const char *);
extern unsigned int qual_flags(const unsigned int);
@ -695,6 +938,7 @@ DECL_IOCTL(dm);
DECL_IOCTL(evdev);
DECL_IOCTL(file);
DECL_IOCTL(fs_x);
DECL_IOCTL(inotify);
DECL_IOCTL(kvm);
DECL_IOCTL(nsfs);
DECL_IOCTL(ptp);
@ -724,6 +968,10 @@ DECL_NETLINK(route);
DECL_NETLINK(selinux);
DECL_NETLINK(sock_diag);
extern void
decode_netlink_kobject_uevent(struct tcb *, kernel_ulong_t addr,
kernel_ulong_t len);
extern int ts_nz(const struct timespec *);
extern int ts_cmp(const struct timespec *, const struct timespec *);
extern double ts_float(const struct timespec *);
@ -732,7 +980,7 @@ extern void ts_sub(struct timespec *, const struct timespec *, const struct time
extern void ts_mul(struct timespec *, const struct timespec *, int);
extern void ts_div(struct timespec *, const struct timespec *, int);
#ifdef USE_LIBUNWIND
#ifdef ENABLE_STACKTRACE
extern void unwind_init(void);
extern void unwind_tcb_init(struct tcb *);
extern void unwind_tcb_fin(struct tcb *);
@ -755,7 +1003,7 @@ printstr(struct tcb *tcp, kernel_ulong_t addr)
static inline int
printflags64(const struct xlat *x, uint64_t flags, const char *dflt)
{
return printflags_ex(flags, dflt, x, NULL);
return printflags_ex(flags, dflt, XLAT_STYLE_DEFAULT, x, NULL);
}
static inline int
@ -776,6 +1024,30 @@ printxval(const struct xlat *x, const unsigned int val, const char *dflt)
return printxvals(val, dflt, x, NULL);
}
static inline int
printxval64_u(const struct xlat *x, const uint64_t val, const char *dflt)
{
return printxvals_ex(val, dflt, XLAT_STYLE_FMT_U, x, NULL);
}
static inline int
printxval_u(const struct xlat *x, const unsigned int val, const char *dflt)
{
return printxvals_ex(val, dflt, XLAT_STYLE_FMT_U, x, NULL);
}
static inline int
printxval64_d(const struct xlat *x, const int64_t val, const char *dflt)
{
return printxvals_ex(val, dflt, XLAT_STYLE_FMT_D, x, NULL);
}
static inline int
printxval_d(const struct xlat *x, const int val, const char *dflt)
{
return printxvals_ex(val, dflt, XLAT_STYLE_FMT_D, x, NULL);
}
static inline void
tprint_iov(struct tcb *tcp, kernel_ulong_t len, kernel_ulong_t addr,
enum iov_decode decode_iov)
@ -840,6 +1112,19 @@ extern void tprints(const char *str);
extern void tprintf_comment(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
extern void tprints_comment(const char *str);
static inline void
printaddr_comment(const kernel_ulong_t addr)
{
tprintf_comment("%#llx", (unsigned long long) addr);
}
static inline void
print_mac_addr(const char *prefix, const uint8_t addr[], size_t size)
{
tprints(prefix);
tprints(sprint_mac_addr(addr, size));
}
#if SUPPORTED_PERSONALITIES > 1
extern void set_personality(unsigned int personality);
extern unsigned current_personality;
@ -925,39 +1210,94 @@ printnum_long_int(struct tcb *, kernel_ulong_t addr,
const char *fmt_long, const char *fmt_int)
ATTRIBUTE_FORMAT((printf, 3, 0))
ATTRIBUTE_FORMAT((printf, 4, 0));
extern bool printnum_addr_long_int(struct tcb *, kernel_ulong_t addr);
# define printnum_slong(tcp, addr) \
printnum_long_int((tcp), (addr), "%" PRId64, "%d")
# define printnum_ulong(tcp, addr) \
printnum_long_int((tcp), (addr), "%" PRIu64, "%u")
# define printnum_ptr(tcp, addr) \
printnum_addr_long_int((tcp), (addr))
static inline bool
printnum_slong(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_long_int(tcp, addr, "%" PRId64, "%d");
}
static inline bool
printnum_ulong(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_long_int(tcp, addr, "%" PRIu64, "%u");
}
static inline bool
printnum_ptr(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_addr_long_int(tcp, addr);
}
#elif current_wordsize > 4
# define printnum_slong(tcp, addr) \
printnum_int64((tcp), (addr), "%" PRId64)
# define printnum_ulong(tcp, addr) \
printnum_int64((tcp), (addr), "%" PRIu64)
# define printnum_ptr(tcp, addr) \
printnum_addr_int64((tcp), (addr))
static inline bool
printnum_slong(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_int64(tcp, addr, "%" PRId64);
}
static inline bool
printnum_ulong(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_int64(tcp, addr, "%" PRIu64);
}
static inline bool
printnum_ptr(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_addr_int64(tcp, addr);
}
#else /* current_wordsize == 4 */
# define printnum_slong(tcp, addr) \
printnum_int((tcp), (addr), "%d")
# define printnum_ulong(tcp, addr) \
printnum_int((tcp), (addr), "%u")
# define printnum_ptr(tcp, addr) \
printnum_addr_int((tcp), (addr))
static inline bool
printnum_slong(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_int(tcp, addr, "%d");
}
static inline bool
printnum_ulong(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_int(tcp, addr, "%u");
}
static inline bool
printnum_ptr(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_addr_int(tcp, addr);
}
#endif
#ifndef current_klongsize
extern bool printnum_addr_klong_int(struct tcb *, kernel_ulong_t addr);
# define printnum_kptr(tcp, addr) \
printnum_addr_klong_int((tcp), (addr))
static inline bool
printnum_kptr(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_addr_klong_int(tcp, addr);
}
#elif current_klongsize > 4
# define printnum_kptr(tcp, addr) \
printnum_addr_int64((tcp), (addr))
static inline bool
printnum_kptr(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_addr_int64(tcp, addr);
}
#else /* current_klongsize == 4 */
# define printnum_kptr(tcp, addr) \
printnum_addr_int((tcp), (addr))
static inline bool
printnum_kptr(struct tcb *tcp, kernel_ulong_t addr)
{
return printnum_addr_int(tcp, addr);
}
#endif
#define DECL_PRINTPAIR(name) \
@ -1021,28 +1361,27 @@ truncate_kulong_to_current_wordsize(const kernel_ulong_t v)
sizeof(v) == sizeof(long) ? (long long) (long) (v) : \
(long long) (v))
extern const char *const errnoent[];
extern const char *const signalent[];
extern const unsigned int nerrnos;
extern const unsigned int nsignals;
extern const struct_sysent sysent0[];
extern const char *const errnoent0[];
extern const char *const signalent0[];
extern const struct_ioctlent ioctlent0[];
extern const char *const personality_names[];
/* Personality designators to be used for specifying personality */
extern const char *const personality_designators[];
#if SUPPORTED_PERSONALITIES > 1
extern const struct_sysent *sysent;
extern const char *const *errnoent;
extern const char *const *signalent;
extern const struct_ioctlent *ioctlent;
#else
# define sysent sysent0
# define errnoent errnoent0
# define signalent signalent0
# define ioctlent ioctlent0
#endif
extern unsigned nsyscalls;
extern unsigned nerrnos;
extern unsigned nsignals;
extern unsigned nioctlents;
extern const unsigned int nsyscall_vec[SUPPORTED_PERSONALITIES];

2
dm.c
View File

@ -237,7 +237,7 @@ dm_decode_dm_target_deps(struct tcb *const tcp, const kernel_ulong_t addr,
tprints(", deps=");
print_array(tcp, addr + offset_end, s.count, &dev_buf, sizeof(dev_buf),
umoven_or_printaddr, dm_print_dev, NULL);
tfetch_mem, dm_print_dev, NULL);
tprints("}");

View File

@ -2,7 +2,7 @@
* Copyright (c) 2004-2007 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2004 Roland McGrath <roland@redhat.com>
* Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* Copyright (c) 2015-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -94,7 +94,7 @@ epoll_wait_common(struct tcb *tcp)
} else {
struct epoll_event ev;
print_array(tcp, tcp->u_arg[1], tcp->u_rval, &ev, sizeof(ev),
umoven_or_printaddr, print_epoll_event, 0);
tfetch_mem, print_epoll_event, 0);
tprintf(", %d, %d", (int) tcp->u_arg[2], (int) tcp->u_arg[3]);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2017 The strace developers.
* Copyright (c) 1999-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -90,6 +90,7 @@ error_msg_and_die(const char *fmt, ...)
va_list p;
va_start(p, fmt);
verror_msg(0, fmt, p);
va_end(p);
die();
}
@ -100,6 +101,7 @@ error_msg_and_help(const char *fmt, ...)
va_list p;
va_start(p, fmt);
verror_msg(0, fmt, p);
va_end(p);
}
fprintf(stderr, "Try '%s -h' for more information.\n",
program_invocation_name);
@ -121,5 +123,6 @@ perror_msg_and_die(const char *fmt, ...)
va_list p;
va_start(p, fmt);
verror_msg(errno, fmt, p);
va_end(p);
die();
}

59
evdev.c
View File

@ -29,6 +29,8 @@
#include "defs.h"
#include "xlat/evdev_abs.h"
#ifdef HAVE_LINUX_INPUT_H
# include <linux/ioctl.h>
@ -51,6 +53,8 @@
# define SYN_MAX 0xf
# endif
const size_t evdev_abs_size = ARRAY_SIZE(evdev_abs) - 1;
static int
abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
@ -94,7 +98,7 @@ keycode_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
if (!umove_or_printaddr(tcp, arg, &keycode)) {
tprintf("[%u, ", keycode[0]);
printxval(evdev_keycode, keycode[1], "KEY_???");
printxval_index(evdev_keycode, keycode[1], "KEY_???");
tprints("]");
}
@ -121,7 +125,7 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
unsigned int i;
tprintf("index=%" PRIu16 ", keycode=", ike.index);
printxval(evdev_keycode, ike.keycode, "KEY_???");
printxval_index(evdev_keycode, ike.keycode, "KEY_???");
tprints(", scancode=[");
for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
if (i > 0)
@ -160,9 +164,9 @@ getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
}
static int
decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
const struct xlat decode_nr[], const unsigned int max_nr,
const char *const dflt)
decode_bitset_(struct tcb *const tcp, const kernel_ulong_t arg,
const struct xlat decode_nr[], const unsigned int max_nr,
const char *const dflt, size_t decode_nr_size, enum xlat_type xt)
{
tprints(", ");
@ -183,7 +187,7 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
if (i < 0) {
tprints(" 0 ");
} else {
printxval(decode_nr, i, dflt);
printxval_dispatch(decode_nr, decode_nr_size, i, dflt, xt);
while ((i = next_set_bit(decoded_arg, i + 1, size)) > 0) {
if (abbrev(tcp) && bit_displayed >= 3) {
@ -191,7 +195,8 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
break;
}
tprints(", ");
printxval(decode_nr, i, dflt);
printxval_dispatch(decode_nr, decode_nr_size, i, dflt,
xt);
bit_displayed++;
}
}
@ -201,6 +206,10 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
return RVAL_IOCTL_DECODED;
}
#define decode_bitset(tcp_, arg_, decode_nr_, max_nr_, dflt_, xt_) \
decode_bitset_((tcp_), (arg_), (decode_nr_), (max_nr_), \
(dflt_), ARRAY_SIZE(decode_nr_), (xt_))
# ifdef EVIOCGMTSLOTS
static int
mtslots_ioctl(struct tcb *const tcp, const unsigned int code,
@ -251,43 +260,42 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
switch (ev_nr) {
case EV_SYN:
return decode_bitset(tcp, arg, evdev_sync,
SYN_MAX, "SYN_???");
SYN_MAX, "SYN_???", XT_INDEXED);
case EV_KEY:
return decode_bitset(tcp, arg, evdev_keycode,
KEY_MAX, "KEY_???");
KEY_MAX, "KEY_???", XT_INDEXED);
case EV_REL:
return decode_bitset(tcp, arg, evdev_relative_axes,
REL_MAX, "REL_???");
REL_MAX, "REL_???", XT_INDEXED);
case EV_ABS:
return decode_bitset(tcp, arg, evdev_abs,
ABS_MAX, "ABS_???");
ABS_MAX, "ABS_???", XT_INDEXED);
case EV_MSC:
return decode_bitset(tcp, arg, evdev_misc,
MSC_MAX, "MSC_???");
# ifdef EV_SW
MSC_MAX, "MSC_???", XT_INDEXED);
case EV_SW:
return decode_bitset(tcp, arg, evdev_switch,
SW_MAX, "SW_???");
# endif
SW_MAX, "SW_???", XT_INDEXED);
case EV_LED:
return decode_bitset(tcp, arg, evdev_leds,
LED_MAX, "LED_???");
LED_MAX, "LED_???", XT_INDEXED);
case EV_SND:
return decode_bitset(tcp, arg, evdev_snd,
SND_MAX, "SND_???");
SND_MAX, "SND_???", XT_INDEXED);
case EV_REP:
return decode_bitset(tcp, arg, evdev_autorepeat,
REP_MAX, "REP_???");
REP_MAX, "REP_???", XT_INDEXED);
case EV_FF:
return decode_bitset(tcp, arg, evdev_ff_types,
FF_MAX, "FF_???");
FF_MAX, "FF_???", XT_SORTED);
case EV_PWR:
tprints(", ");
printnum_int(tcp, arg, "%d");
return RVAL_IOCTL_DECODED;
case EV_FF_STATUS:
return decode_bitset(tcp, arg, evdev_ff_status,
FF_STATUS_MAX, "FF_STATUS_???");
FF_STATUS_MAX, "FF_STATUS_???",
XT_INDEXED);
default:
tprints(", ");
printaddr(arg);
@ -341,22 +349,23 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code,
# ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
return decode_bitset(tcp, arg, evdev_prop,
INPUT_PROP_MAX, "PROP_???");
INPUT_PROP_MAX, "PROP_???",
XT_INDEXED);
# endif
case _IOC_NR(EVIOCGSND(0)):
return decode_bitset(tcp, arg, evdev_snd,
SND_MAX, "SND_???");
SND_MAX, "SND_???", XT_INDEXED);
# ifdef EVIOCGSW
case _IOC_NR(EVIOCGSW(0)):
return decode_bitset(tcp, arg, evdev_switch,
SW_MAX, "SW_???");
SW_MAX, "SW_???", XT_INDEXED);
# endif
case _IOC_NR(EVIOCGKEY(0)):
return decode_bitset(tcp, arg, evdev_keycode,
KEY_MAX, "KEY_???");
KEY_MAX, "KEY_???", XT_INDEXED);
case _IOC_NR(EVIOCGLED(0)):
return decode_bitset(tcp, arg, evdev_leds,
LED_MAX, "LED_???");
LED_MAX, "LED_???", XT_INDEXED);
}
/* multi-number fixed-length commands */

View File

@ -6,7 +6,7 @@
* Copyright (c) 2007 Roland McGrath <roland@redhat.com>
* Copyright (c) 2011-2012 Denys Vlasenko <vda.linux@googlemail.com>
* Copyright (c) 2010-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -57,8 +57,11 @@ printargv(struct tcb *const tcp, kernel_ulong_t addr)
if (umoven(tcp, addr, wordsize, cp.data)) {
if (sep == start_sep)
printaddr(addr);
else
tprints(", ???]");
else {
tprints(", ...");
printaddr_comment(addr);
tprints("]");
}
return;
}
if (!(wordsize < sizeof(cp.p64) ? cp.p32 : cp.p64)) {

41
f_owner_ex.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef STRACE_F_OWNER_EX_H
#define STRACE_F_OWNER_EX_H
#include <linux/fcntl.h>
#if defined HAVE_STRUCT_F_OWNER_EX
typedef struct f_owner_ex struct_kernel_f_owner_ex;
#elif defined HAVE_STRUCT___KERNEL_F_OWNER_EX
typedef struct __kernel_f_owner_ex struct_kernel_f_owner_ex;
#else
# error struct f_owner_ex definition not found in <linux/fcntl.h>
#endif
#endif /* !STRACE_F_OWNER_EX_H */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -75,10 +75,12 @@ SYS_FUNC(fanotify_mark)
#endif
printflags64(fan_event_flags, mask, "FAN_???");
tprints(", ");
if ((int) tcp->u_arg[argn] == FAN_NOFD)
tprints("FAN_NOFD, ");
else
if ((int) tcp->u_arg[argn] == FAN_NOFD) {
print_xlat_d(FAN_NOFD);
tprints(", ");
} else {
print_dirfd(tcp, tcp->u_arg[argn]);
}
printpath(tcp, tcp->u_arg[argn + 1]);
return RVAL_DECODED;

23
fcntl.c
View File

@ -3,7 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* Copyright (c) 1999-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -35,7 +35,6 @@
#include "xlat/f_owner_types.h"
#include "xlat/f_seals.h"
#include "xlat/fcntlcmds.h"
#include "xlat/fcntl64cmds.h"
#include "xlat/fdflags.h"
#include "xlat/lockfcmds.h"
#include "xlat/notifyflags.h"
@ -197,18 +196,7 @@ SYS_FUNC(fcntl)
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
const unsigned int cmd = tcp->u_arg[1];
const char *str = xlookup(fcntlcmds, cmd);
if (str) {
tprints(str);
} else {
/*
* fcntl syscall does not recognize these
* constants, but we would like to show them
* for better debugging experience.
*/
printxval(fcntl64cmds, cmd, "F_???");
}
printxval(fcntlcmds, tcp->u_arg[1], "F_???");
}
return print_fcntl(tcp);
}
@ -219,12 +207,7 @@ SYS_FUNC(fcntl64)
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
const char *str = xlookup(fcntl64cmds, cmd);
if (str) {
tprints(str);
} else {
printxval(fcntlcmds, cmd, "F_???");
}
printxval(fcntlcmds, cmd, "F_???");
}
switch (cmd) {
case F_SETLK64:

View File

@ -10,6 +10,7 @@ fi
: ${DATE_FILE:=$(dirname "$FILE")/.$(basename "${FILE}").date}
: ${DEFAULT_DATE:=$2}
: ${DATE_FORMAT:=%Y-%m-%d}
LC_TIME=C; export LC_TIME
date=
@ -23,13 +24,19 @@ date=
[ -n "${date}" ] ||
date="$(git log -n 1 --format=format:%cD --no-patch "${FILE}")"
[ -n "${date}" ] || year="${DEFAULT_DATE}"
[ -n "${date}" ] ||
date="${DEFAULT_DATE}"
[ -n "${date}" ] || date="$(date -u)"
[ -n "${date}" ] ||
[ -z "${SOURCE_DATE_EPOCH-}" ] ||
date="$(date -u -d "@${SOURCE_DATE_EPOCH}")"
[ -n "${date}" ] ||
date="$(date -u)"
[ -n "${date}" ] || {
echo >&2 'Undefined date.'
exit 1
}
exec printf "%s" $(date "+${DATE_FORMAT}" -d "${date}")
exec printf "%s" $(date -u "+${DATE_FORMAT}" -d "${date}")

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2016-2017 The strace developers.
* Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -185,7 +185,7 @@ file_ioctl(struct tcb *const tcp, const unsigned int code,
rc = print_array(tcp, arg + offsetof(typeof(args), info),
args.dest_count, &info, sizeof(info),
umoven_or_printaddr,
tfetch_mem,
print_file_dedupe_range_info, limit);
tprints("}");
@ -225,15 +225,15 @@ file_ioctl(struct tcb *const tcp, const unsigned int code,
"FIEMAP_FLAG_???");
tprintf(", fm_mapped_extents=%u",
args.fm_mapped_extents);
tprints(", fm_extents=");
if (abbrev(tcp)) {
tprints("...");
tprints(", ...");
} else {
struct fiemap_extent fe;
tprints(", fm_extents=");
print_array(tcp,
arg + offsetof(typeof(args), fm_extents),
args.fm_mapped_extents, &fe, sizeof(fe),
umoven_or_printaddr,
tfetch_mem,
print_fiemap_extent, 0);
}
tprints("}");

View File

@ -43,6 +43,11 @@ static struct number_set *raw_set;
static struct number_set *trace_set;
static struct number_set *verbose_set;
/* Only syscall numbers are personality-specific so far. */
struct inject_personality_data {
uint16_t scno;
};
static int
sigstr_to_uint(const char *s)
{
@ -102,6 +107,7 @@ parse_delay_token(const char *input, struct inject_opts *fopts, bool isenter)
static bool
parse_inject_token(const char *const token, struct inject_opts *const fopts,
struct inject_personality_data *const pdata,
const bool fault_tokens_only)
{
const char *val;
@ -137,6 +143,27 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
/* F == F+0 */
fopts->step = 0;
}
} else if ((val = STR_STRIP_PREFIX(token, "syscall=")) != token) {
if (fopts->data.flags & INJECT_F_SYSCALL)
return false;
for (unsigned int p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
kernel_long_t scno = scno_by_name(val, p, 0);
if (scno < 0)
return false;
/*
* We want to inject only pure system calls with no side
* effects.
*/
if (!(sysent_vec[p][scno].sys_flags & TRACE_PURE))
return false;
pdata[p].scno = scno;
}
fopts->data.flags |= INJECT_F_SYSCALL;
} else if ((val = STR_STRIP_PREFIX(token, "error=")) != token) {
if (fopts->data.flags & (INJECT_F_ERROR | INJECT_F_RETVAL))
return false;
@ -223,6 +250,7 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
static const char *
parse_inject_expression(char *const str,
struct inject_opts *const fopts,
struct inject_personality_data *const pdata,
const bool fault_tokens_only)
{
if (str[0] == '\0' || str[0] == ':')
@ -233,7 +261,7 @@ parse_inject_expression(char *const str,
char *token;
while ((token = strtok_r(NULL, ":", &saveptr))) {
if (!parse_inject_token(token, fopts, fault_tokens_only))
if (!parse_inject_token(token, fopts, pdata, fault_tokens_only))
return NULL;
}
@ -308,9 +336,10 @@ qualify_inject_common(const char *const str,
.delay_idx = -1
}
};
struct inject_personality_data pdata[SUPPORTED_PERSONALITIES] = { { 0 } };
char *copy = xstrdup(str);
const char *name =
parse_inject_expression(copy, &opts, fault_tokens_only);
parse_inject_expression(copy, &opts, pdata, fault_tokens_only);
if (!name)
error_msg_and_die("invalid %s '%s'", description, str);
@ -321,7 +350,7 @@ qualify_inject_common(const char *const str,
free(copy);
/* If neither of retval, error, signal or delay is specified, then ... */
if (!opts.data.flags) {
if (!(opts.data.flags & INJECT_ACTION_FLAGS)) {
if (fault_tokens_only) {
/* in fault= syntax the default error code is ENOSYS. */
opts.data.rval_idx = retval_new(ENOSYS);
@ -353,6 +382,10 @@ qualify_inject_common(const char *const str,
if (is_number_in_set_array(i, tmp_set, p)) {
add_number_to_set_array(i, inject_set, p);
inject_vec[p][i] = opts;
/* Copy per-personality data. */
inject_vec[p][i].data.scno =
pdata[p].scno;
}
}
}

11
futex.c
View File

@ -3,7 +3,7 @@
* Copyright (c) 2007-2008 Ulrich Drepper <drepper@redhat.com>
* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -37,6 +37,9 @@
#ifndef FUTEX_CLOCK_REALTIME
# define FUTEX_CLOCK_REALTIME 256
#endif
#ifndef FUTEX_OP_OPARG_SHIFT
# define FUTEX_OP_OPARG_SHIFT 8
#endif
#include "xlat/futexops.h"
#include "xlat/futexwakeops.h"
@ -94,8 +97,10 @@ SYS_FUNC(futex)
tprintf(", %u, ", val2);
printaddr(uaddr2);
tprints(", ");
if ((val3 >> 28) & 8)
tprints("FUTEX_OP_OPARG_SHIFT<<28|");
if ((val3 >> 28) & FUTEX_OP_OPARG_SHIFT) {
print_xlat(FUTEX_OP_OPARG_SHIFT);
tprints("<<28|");
}
comment = printxval(futexwakeops, (val3 >> 28) & 0x7, NULL)
? NULL : "FUTEX_OP_???";
tprints("<<28");

View File

@ -99,4 +99,15 @@
# define ATTRIBUTE_FALLTHROUGH ((void) 0)
#endif
#if GNUC_PREREQ(6, 0)
# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wtautological-compare\"");
# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE \
_Pragma("GCC diagnostic pop");
#else
# define DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE /* empty */
# define DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE /* empty */
#endif
#endif /* !STRACE_GCC_COMPAT_H */

View File

@ -38,23 +38,29 @@ cat <<EOF
# define SoM(type_, member_) (sizeof(((type_ *)0)->member_))
EOF
for struct in $(sed -n 's/^struct \(BPF_[^[:space:]]\+_struct\) .*/\1/p' < "$input"); do
for struct in $(sed -n 's/^struct \([^[:space:]]\+_struct\) .*/\1/p' < "$input"); do
case "$struct" in
BPF_*) type_name='union bpf_attr' ;;
*) type_name="struct ${struct%_struct}" ;;
esac
TYPE_NAME="$(printf %s "$type_name" |tr '[:lower:] ' '[:upper:]_')"
enum="$(sed -n 's/^struct '"$struct"' \/\* \([^[:space:]]\+\) \*\/ {.*/\1/p' < "$input")"
ENUM="$(printf %s "$enum" |tr '[:lower:]' '[:upper:]')"
enum="$enum${enum:+.}"
ENUM="$ENUM${ENUM:+_}"
sed -n '/^struct '"$struct"' [^{]*{/,/^};$/p' < "$input" |
sed -n 's/^[[:space:]]\+[^;]*[[:space:]]\([^[:space:];]\+\);$/\1/p' |
sed -n 's/^[[:space:]]\+[^][;]*[[:space:]]\([^][[:space:];]\+\)\(\[[^;]*\]\)\?;$/\1/p' |
while read field; do
FIELD="$(printf %s "$field" |tr '[:lower:]' '[:upper:]')"
cat <<EOF
# ifdef HAVE_UNION_BPF_ATTR_$ENUM$FIELD
static_assert(SoM(struct $struct, $field) == SoM(union bpf_attr, $enum$field),
# ifdef HAVE_${TYPE_NAME}_$ENUM$FIELD
static_assert(SoM(struct $struct, $field) == SoM($type_name, $enum$field),
"$struct.$field size mismatch");
static_assert(offsetof(struct $struct, $field) == offsetof(union bpf_attr, $enum$field),
static_assert(offsetof(struct $struct, $field) == offsetof($type_name, $enum$field),
"$struct.$field offset mismatch");
# endif /* HAVE_UNION_BPF_ATTR_$ENUM$FIELD */
# endif /* HAVE_${TYPE_NAME}_$ENUM$FIELD */
EOF
done
cat <<EOF

48
inotify_ioctl.c Normal file
View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "defs.h"
#include <linux/ioctl.h>
#ifndef INOTIFY_IOC_SETNEXTWD
# define INOTIFY_IOC_SETNEXTWD _IOW('I', 0, int32_t)
#endif
int
inotify_ioctl(struct tcb *const tcp, const unsigned int code,
const kernel_ulong_t arg)
{
switch (code) {
case INOTIFY_IOC_SETNEXTWD:
tprintf(", %d", (int) arg);
return RVAL_IOCTL_DECODED;
}
return RVAL_DECODED;
}

4
io.c
View File

@ -3,7 +3,7 @@
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 The strace developers.
* Copyright (c) 1999-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -123,7 +123,7 @@ tprint_iov_upto(struct tcb *const tcp, const kernel_ulong_t len,
};
print_array(tcp, addr, len, iov, current_wordsize * 2,
umoven_or_printaddr_ignore_syserror, print_iovec, &config);
tfetch_mem_ignore_syserror, print_iovec, &config);
}
SYS_FUNC(readv)

47
ioctl.c
View File

@ -33,11 +33,6 @@
#include <linux/ioctl.h>
#include "xlat/ioctl_dirs.h"
#ifdef HAVE_LINUX_INPUT_H
# include <linux/input.h>
#endif
#include "xlat/evdev_abs.h"
#include "xlat/evdev_ev.h"
static int
@ -92,7 +87,8 @@ evdev_decode_number(const unsigned int code)
if (_IOC_DIR(code) == _IOC_WRITE) {
if (nr >= 0xc0 && nr <= 0xc0 + 0x3f) {
tprints("EVIOCSABS(");
printxval(evdev_abs, nr - 0xc0, "ABS_???");
printxval_indexn(evdev_abs, evdev_abs_size, nr - 0xc0,
"ABS_???");
tprints(")");
return 1;
}
@ -108,7 +104,8 @@ evdev_decode_number(const unsigned int code)
return 1;
} else if (nr >= 0x40 && nr <= 0x40 + 0x3f) {
tprints("EVIOCGABS(");
printxval(evdev_abs, nr - 0x40, "ABS_???");
printxval_indexn(evdev_abs, evdev_abs_size, nr - 0x40,
"ABS_???");
tprints(")");
return 1;
}
@ -258,6 +255,8 @@ ioctl_decode(struct tcb *tcp)
const kernel_ulong_t arg = tcp->u_arg[2];
switch (_IOC_TYPE(code)) {
case '$':
return perf_ioctl(tcp, code, arg);
#if defined(ALPHA) || defined(POWERPC)
case 'f': {
int ret = file_ioctl(tcp, code, arg);
@ -325,6 +324,8 @@ ioctl_decode(struct tcb *tcp)
case 0xae:
return kvm_ioctl(tcp, code, arg);
#endif
case 'I':
return inotify_ioctl(tcp, code, arg);
default:
break;
}
@ -339,19 +340,29 @@ SYS_FUNC(ioctl)
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
ret = ioctl_decode_command_number(tcp);
if (!(ret & IOCTL_NUMBER_STOP_LOOKUP)) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
if (ret)
tprints(" or ");
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else if (!ret) {
ioctl_print_code(tcp->u_arg[1]);
if (xlat_verbosity != XLAT_STYLE_ABBREV)
tprintf("%#x", (unsigned int) tcp->u_arg[1]);
if (xlat_verbosity == XLAT_STYLE_VERBOSE)
tprints(" /* ");
if (xlat_verbosity != XLAT_STYLE_RAW) {
ret = ioctl_decode_command_number(tcp);
if (!(ret & IOCTL_NUMBER_STOP_LOOKUP)) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
if (ret)
tprints(" or ");
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else if (!ret) {
ioctl_print_code(tcp->u_arg[1]);
}
}
}
if (xlat_verbosity == XLAT_STYLE_VERBOSE)
tprints(" */");
ret = ioctl_decode(tcp);
} else {
ret = ioctl_decode(tcp) | RVAL_DECODED;

View File

@ -56,17 +56,14 @@ static const char *
sprint_ioprio(unsigned int ioprio)
{
static char outstr[256];
const char *str;
char class_buf[64];
unsigned int class, data;
class = IOPRIO_PRIO_CLASS(ioprio);
data = IOPRIO_PRIO_DATA(ioprio);
str = xlookup(ioprio_class, class);
if (str)
xsprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", str, data);
else
xsprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */, %d)",
class, "IOPRIO_CLASS_???", data);
sprintxval(class_buf, sizeof(class_buf), ioprio_class, class,
"IOPRIO_CLASS_???");
xsprintf(outstr, "IOPRIO_PRIO_VALUE(%s, %d)", class_buf, data);
return outstr;
}

7
ipc.c
View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 1999-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,15 +34,11 @@ SYS_FUNC(ipc)
unsigned int call = tcp->u_arg[0];
unsigned int version = call >> 16;
call &= 0xffff;
const char *str = xlookup(ipccalls, call);
if (version)
tprintf("%u<<16|", version);
if (str)
tprints(str);
else
tprintf("%u", call);
printxval_u(ipccalls, call, NULL);
unsigned int i;
for (i = 1; i < tcp->s_ent->nargs; ++i)

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2003 Roland McGrath <roland@redhat.com>
* Copyright (c) 2003-2017 The strace developers.
* Copyright (c) 2003-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -43,8 +43,10 @@
#define PRINTCTL(flagset, arg, dflt) \
do { \
if ((arg) & IPC_64) \
tprints("IPC_64|"); \
if ((arg) & IPC_64) { \
print_xlat(IPC_64); \
tprints("|"); \
} \
printxval((flagset), (arg) & ~IPC_64, dflt); \
} while (0)

View File

@ -5,7 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* Copyright (c) 2015-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -41,15 +41,12 @@
#endif
#include "xlat/ipc_msg_flags.h"
#include "xlat/ipc_private.h"
#include "xlat/resource_flags.h"
SYS_FUNC(msgget)
{
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
tprints(", ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");
@ -99,7 +96,7 @@ fetch_msgrcv_args(struct tcb *const tcp, const kernel_ulong_t addr,
if (umove_or_printaddr(tcp, addr, &tmp))
return -1;
pair[0] = tmp[0];
pair[1] = tmp[1];
pair[1] = (int) tmp[1];
}
return 0;
}

View File

@ -5,7 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* Copyright (c) 2015-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -64,7 +64,7 @@ tprint_sembuf_array(struct tcb *const tcp, const kernel_ulong_t addr,
#if defined HAVE_SYS_SEM_H || defined HAVE_LINUX_SEM_H
struct sembuf sb;
print_array(tcp, addr, count, &sb, sizeof(sb),
umoven_or_printaddr, print_sembuf, 0);
tfetch_mem, print_sembuf, 0);
#else
printaddr(addr);
#endif
@ -103,11 +103,7 @@ SYS_FUNC(semtimedop)
SYS_FUNC(semget)
{
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
tprintf(", %d, ", (int) tcp->u_arg[1]);
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");

View File

@ -5,7 +5,7 @@
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2003-2006 Roland McGrath <roland@redhat.com>
* Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* Copyright (c) 2015-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -52,11 +52,7 @@
SYS_FUNC(shmget)
{
const int key = (int) tcp->u_arg[0];
if (key)
tprintf("%#x", key);
else
tprints("IPC_PRIVATE");
printxval(ipc_private, (unsigned int) tcp->u_arg[0], NULL);
tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
unsigned int flags = tcp->u_arg[2] & ~0777;
@ -67,10 +63,12 @@ SYS_FUNC(shmget)
if (flags || !hugetlb_value)
printflags(shm_resource_flags, flags, NULL);
if (hugetlb_value)
tprintf("%s%u<<SHM_HUGE_SHIFT",
if (hugetlb_value) {
tprintf("%s%u<<",
flags ? "|" : "",
hugetlb_value >> SHM_HUGE_SHIFT);
print_xlat_u(SHM_HUGE_SHIFT);
}
if (flags || hugetlb_value)
tprints("|");

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -76,7 +76,7 @@ print_kexec_segments(struct tcb *const tcp, const kernel_ulong_t addr,
const size_t sizeof_seg = ARRAY_SIZE(seg) * current_wordsize;
print_array(tcp, addr, len, seg, sizeof_seg,
umoven_or_printaddr, print_seg, 0);
tfetch_mem, print_seg, 0);
}
SYS_FUNC(kexec_load)

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2014-2017 The strace developers.
* Copyright (c) 2014-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -44,12 +44,7 @@ struct keyctl_dh_params {
static void
print_keyring_serial_number(key_serial_t id)
{
const char *str = xlookup(key_spec, (unsigned int) id);
if (str)
tprints(str);
else
tprintf("%d", id);
printxval_d(key_spec, id, NULL);
}
SYS_FUNC(add_key)
@ -195,12 +190,8 @@ keyctl_reject_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
print_keyring_serial_number(id1);
tprintf(", %u, ", timeout);
if (err_str)
tprintf("%s, ", err_str);
else
tprintf("%u, ", error);
print_xlat_ex(error, err_str, XLAT_STYLE_FMT_U);
tprints(", ");
print_keyring_serial_number(id2);
}
@ -396,7 +387,8 @@ SYS_FUNC(keyctl)
break;
case KEYCTL_SET_REQKEY_KEYRING:
printxval(key_reqkeys, arg2, "KEY_REQKEY_DEFL_???");
printxvals_ex((int) arg2, "KEY_REQKEY_DEFL_???",
XLAT_STYLE_FMT_D, key_reqkeys, NULL);
break;
case KEYCTL_SET_TIMEOUT:

View File

@ -283,6 +283,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_ADD_CONFIG", _IOC_WRITE, 0x6477, 0x48 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_REMOVE_CONFIG", _IOC_WRITE, 0x6478, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_QUERY", _IOC_READ|_IOC_WRITE, 0x6479, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
@ -422,8 +423,11 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_LABEL_BO", _IOC_READ|_IOC_WRITE, 0x644a, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_CREATE", _IOC_READ|_IOC_WRITE, 0x644c, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_DESTROY", _IOC_READ|_IOC_WRITE, 0x644d, 0x04 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_GET_VALUES", _IOC_READ|_IOC_WRITE, 0x644e, 0x0c },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SET_TILING", _IOC_READ|_IOC_WRITE, 0x6448, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa8 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -1160,6 +1164,7 @@
{ "linux/if_tun.h", "TUNSETVNETHDRSZ", _IOC_WRITE, 0x54d8, 0x04 },
{ "linux/if_tun.h", "TUNSETVNETLE", _IOC_WRITE, 0x54dc, 0x04 },
{ "linux/iio/events.h", "IIO_GET_EVENT_FD_IOCTL", _IOC_READ, 0x6990, 0x04 },
{ "linux/inotify.h", "INOTIFY_IOC_SETNEXTWD", _IOC_WRITE, 0x4900, 0x04 },
{ "linux/input.h", "EVIOCGEFFECTS", _IOC_READ, 0x4584, 0x04 },
{ "linux/input.h", "EVIOCGID", _IOC_READ, 0x4502, 0x08 },
{ "linux/input.h", "EVIOCGKEYCODE", _IOC_READ, 0x4504, 0x08 },
@ -1197,6 +1202,9 @@
{ "linux/ipmi.h", "IPMICTL_SET_TIMING_PARMS_CMD", _IOC_READ, 0x6916, 0x08 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD", _IOC_READ, 0x690f, 0x02 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD_CHANS", _IOC_READ, 0x691d, 0x0c },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_CLEAR_SMS_ATN", _IOC_NONE, 0xb101, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_FORCE_ABORT", _IOC_NONE, 0xb102, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_SET_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/isdn.h", "IIOCDBGVAR", _IOC_NONE, 0x497f, 0x00 },
{ "linux/isdn.h", "IIOCDRVCTL", _IOC_NONE, 0x4980, 0x00 },
{ "linux/isdn.h", "IIOCGETCPS", _IOC_NONE, 0x4915, 0x00 },
@ -1238,48 +1246,6 @@
{ "linux/ivtv.h", "IVTV_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x38 },
{ "linux/ivtv.h", "IVTV_IOC_PASSTHROUGH_MODE", _IOC_WRITE, 0x56c1, 0x04 },
{ "linux/ivtvfb.h", "IVTVFB_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x0c },
{ "linux/ixjuser.h", "IXJCTL_AEC_GET_LEVEL", _IOC_NONE, 0x71cd, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_AEC_START", _IOC_WRITE, 0x71cb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_AEC_STOP", _IOC_NONE, 0x71cc, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_CARDTYPE", _IOC_READ, 0x71c1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CID", _IOC_READ, 0x71d4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CIDCW", _IOC_WRITE, 0x71d9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_AGAIN", _IOC_WRITE, 0x71d2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_COEFF_SET", _IOC_WRITE, 0x71d0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_CLEAR", _IOC_NONE, 0x71e7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_READ", _IOC_READ, 0x71e6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_IDLE", _IOC_NONE, 0x71c5, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_RESET", _IOC_NONE, 0x71c0, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_TYPE", _IOC_READ, 0x71c3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_VERSION", _IOC_READ, 0x71c4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DTMF_PRESCALE", _IOC_WRITE, 0x71e8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FILTER_CADENCE", _IOC_WRITE, 0x71d6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_READ", _IOC_READ, 0x71e2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_WRITTEN", _IOC_READ, 0x71e3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_GET_FILTER_HIST", _IOC_WRITE, 0x71c8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_HZ", _IOC_WRITE, 0x71e0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INIT_TONE", _IOC_WRITE, 0x71c9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_START", _IOC_WRITE, 0x71fd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_STOP", _IOC_WRITE, 0x71fe, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_MIXER", _IOC_WRITE, 0x71cf, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PLAY_CID", _IOC_NONE, 0x71d7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_PORT", _IOC_WRITE, 0x71d1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_POTS_PSTN", _IOC_WRITE, 0x71d5, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PSTN_LINETEST", _IOC_NONE, 0x71d3, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_RATE", _IOC_WRITE, 0x71e1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_READ_WAIT", _IOC_READ, 0x71e4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_RXG", _IOC_WRITE, 0x71ea, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_TXG", _IOC_WRITE, 0x71eb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SERIAL", _IOC_READ, 0x71c2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER", _IOC_WRITE, 0x71c7, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER_RAW", _IOC_WRITE, 0x71dd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_LED", _IOC_WRITE, 0x71ce, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SIGCTL", _IOC_WRITE, 0x71e9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_TESTRAM", _IOC_NONE, 0x71c6, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_TONE_CADENCE", _IOC_WRITE, 0x71ca, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VERSION", _IOC_READ, 0x71da, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VMWI", _IOC_READ, 0x71d8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_WRITE_WAIT", _IOC_READ, 0x71e5, 0x04 },
{ "linux/joystick.h", "JSIOCGAXES", _IOC_READ, 0x6a11, 0x01 },
{ "linux/joystick.h", "JSIOCGAXMAP", _IOC_READ, 0x6a32, 0x40 },
{ "linux/joystick.h", "JSIOCGBTNMAP", _IOC_READ, 0x6a34, 0x400 },
@ -1338,6 +1304,8 @@
{ "linux/kd.h", "PIO_UNIMAP", 0, 0x4B67, 0 },
{ "linux/kd.h", "PIO_UNIMAPCLR", 0, 0x4B68, 0 },
{ "linux/kd.h", "PIO_UNISCRNMAP", 0, 0x4B6A, 0 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ACQUIRE_VM", _IOC_WRITE, 0x4b15, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ALLOC_MEMORY_OF_GPU", _IOC_READ|_IOC_WRITE, 0x4b16, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_EVENT", _IOC_READ|_IOC_WRITE, 0x4b08, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b02, 0x58 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_ADDRESS_WATCH", _IOC_WRITE, 0x4b0f, 0x10 },
@ -1346,15 +1314,19 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_WAVE_CONTROL", _IOC_WRITE, 0x4b10, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_EVENT", _IOC_WRITE, 0x4b09, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b03, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_FREE_MEMORY_OF_GPU", _IOC_WRITE, 0x4b17, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_CLOCK_COUNTERS", _IOC_READ|_IOC_WRITE, 0x4b05, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES", _IOC_READ, 0x4b06, 0x190 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES_NEW", _IOC_READ|_IOC_WRITE, 0x4b14, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_TILE_CONFIG", _IOC_READ|_IOC_WRITE, 0x4b12, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_VERSION", _IOC_READ, 0x4b01, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_MAP_MEMORY_TO_GPU", _IOC_READ|_IOC_WRITE, 0x4b18, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_RESET_EVENT", _IOC_WRITE, 0x4b0b, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_EVENT", _IOC_WRITE, 0x4b0a, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_SCRATCH_BACKING_VA", _IOC_READ|_IOC_WRITE, 0x4b11, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_TRAP_HANDLER", _IOC_WRITE, 0x4b13, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU", _IOC_READ|_IOC_WRITE, 0x4b19, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
@ -1552,6 +1524,7 @@
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_MODIFY_ATTRIBUTES", _IOC_WRITE, 0x240b, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PAUSE_OUTPUT", _IOC_WRITE, 0x2409, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PERIOD", _IOC_WRITE, 0x2404, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_QUERY_BPF", _IOC_READ|_IOC_WRITE, 0x240a, 0x04 },
@ -1680,6 +1653,7 @@
{ "linux/random.h", "RNDCLEARPOOL", _IOC_NONE, 0x5206, 0x00 },
{ "linux/random.h", "RNDGETENTCNT", _IOC_READ, 0x5200, 0x04 },
{ "linux/random.h", "RNDGETPOOL", _IOC_READ, 0x5202, 0x08 },
{ "linux/random.h", "RNDRESEEDCRNG", _IOC_NONE, 0x5207, 0x00 },
{ "linux/random.h", "RNDZAPENTCNT", _IOC_NONE, 0x5204, 0x00 },
{ "linux/raw.h", "RAW_GETBIND", _IOC_NONE, 0xac01, 0x00 },
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
@ -2022,53 +1996,6 @@
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_CHECK", _IOC_WRITE, 0x7182, 0x04 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_LIST", _IOC_READ, 0x7181, 0x04 },
{ "linux/telephony.h", "PHONE_CPT_STOP", _IOC_NONE, 0x71a4, 0x00 },
{ "linux/telephony.h", "PHONE_DIALTONE", _IOC_NONE, 0x71a3, 0x00 },
{ "linux/telephony.h", "PHONE_DTMF_OOB", _IOC_WRITE, 0x7199, 0x04 },
{ "linux/telephony.h", "PHONE_DTMF_READY", _IOC_READ, 0x7196, 0x04 },
{ "linux/telephony.h", "PHONE_EXCEPTION", _IOC_READ, 0x719a, 0x04 },
{ "linux/telephony.h", "PHONE_FRAME", _IOC_WRITE, 0x718d, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF", _IOC_READ, 0x7197, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF_ASCII", _IOC_READ, 0x7198, 0x04 },
{ "linux/telephony.h", "PHONE_GET_TONE_OFF_TIME", _IOC_NONE, 0x719f, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_ON_TIME", _IOC_NONE, 0x719e, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_STATE", _IOC_NONE, 0x71a0, 0x00 },
{ "linux/telephony.h", "PHONE_HOOKSTATE", _IOC_NONE, 0x7184, 0x00 },
{ "linux/telephony.h", "PHONE_MAXRINGS", _IOC_WRITE, 0x7185, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_CODEC", _IOC_WRITE, 0x7190, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_DEPTH", _IOC_WRITE, 0x7193, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_LEVEL", _IOC_NONE, 0x7195, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_START", _IOC_NONE, 0x7191, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_STOP", _IOC_NONE, 0x7192, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_TONE", _IOC_WRITE, 0x719b, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME", _IOC_WRITE, 0x7194, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME_LINEAR", _IOC_WRITE, 0x71dc, 0x04 },
{ "linux/telephony.h", "PHONE_PSTN_GET_STATE", _IOC_NONE, 0x71a5, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_LINETEST", _IOC_NONE, 0x71a8, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_SET_STATE", _IOC_WRITE, 0x71a4, 0x04 },
{ "linux/telephony.h", "PHONE_QUERY_CODEC", _IOC_READ|_IOC_WRITE, 0x71a7, 0x04 },
{ "linux/telephony.h", "PHONE_REC_CODEC", _IOC_WRITE, 0x7189, 0x04 },
{ "linux/telephony.h", "PHONE_REC_DEPTH", _IOC_WRITE, 0x718c, 0x04 },
{ "linux/telephony.h", "PHONE_REC_LEVEL", _IOC_NONE, 0x718f, 0x00 },
{ "linux/telephony.h", "PHONE_REC_START", _IOC_NONE, 0x718a, 0x00 },
{ "linux/telephony.h", "PHONE_REC_STOP", _IOC_NONE, 0x718b, 0x00 },
{ "linux/telephony.h", "PHONE_REC_VOLUME", _IOC_WRITE, 0x718e, 0x04 },
{ "linux/telephony.h", "PHONE_REC_VOLUME_LINEAR", _IOC_WRITE, 0x71db, 0x04 },
{ "linux/telephony.h", "PHONE_RING", _IOC_NONE, 0x7183, 0x00 },
{ "linux/telephony.h", "PHONE_RINGBACK", _IOC_NONE, 0x71a2, 0x00 },
{ "linux/telephony.h", "PHONE_RING_CADENCE", _IOC_WRITE, 0x7186, 0x02 },
{ "linux/telephony.h", "PHONE_RING_START", _IOC_WRITE, 0x7187, 0x04 },
{ "linux/telephony.h", "PHONE_RING_STOP", _IOC_NONE, 0x7188, 0x00 },
{ "linux/telephony.h", "PHONE_SET_TONE_OFF_TIME", _IOC_WRITE, 0x719d, 0x04 },
{ "linux/telephony.h", "PHONE_SET_TONE_ON_TIME", _IOC_WRITE, 0x719c, 0x04 },
{ "linux/telephony.h", "PHONE_VAD", _IOC_WRITE, 0x71a9, 0x04 },
{ "linux/telephony.h", "PHONE_WINK", _IOC_WRITE, 0x71aa, 0x04 },
{ "linux/telephony.h", "PHONE_WINK_DURATION", _IOC_WRITE, 0x71a6, 0x04 },
{ "linux/timerfd.h", "TFD_IOC_SET_TICKS", _IOC_WRITE, 0x5400, 0x08 },
{ "linux/toshiba.h", "TOSHIBA_ACPI_SCI", _IOC_READ|_IOC_WRITE, 0x7491, 0x18 },
{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x18 },
@ -2199,6 +2126,7 @@
{ "linux/vfio.h", "VFIO_DEVICE_GET_IRQ_INFO", _IOC_NONE, 0x3b6d, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_PCI_HOT_RESET_INFO", _IOC_NONE, 0x3b70, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_REGION_INFO", _IOC_NONE, 0x3b6c, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_IOEVENTFD", _IOC_NONE, 0x3b74, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_PCI_HOT_RESET", _IOC_NONE, 0x3b71, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_QUERY_GFX_PLANE", _IOC_NONE, 0x3b72, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_RESET", _IOC_NONE, 0x3b6f, 0x00 },
@ -2523,7 +2451,7 @@
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ACK_EVENT", _IOC_WRITE, 0x1bea, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_ASSIGN_CTXT", _IOC_READ|_IOC_WRITE, 0x1be1, 0x1c },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CREDIT_UPD", _IOC_NONE, 0x1be6, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x26 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_INFO", _IOC_WRITE, 0x1be2, 0x28 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_CTXT_RESET", _IOC_NONE, 0x1bec, 0x00 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_GET_VERS", _IOC_READ, 0x1bee, 0x04 },
{ "rdma/rdma_user_ioctl.h", "HFI1_IOCTL_POLL_TYPE", _IOC_WRITE, 0x1be9, 0x04 },
@ -2537,7 +2465,7 @@
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x10 },
{ "rdma/rdma_user_ioctl_cmds.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x18 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },

View File

@ -283,6 +283,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_ADD_CONFIG", _IOC_WRITE, 0x6477, 0x48 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_REMOVE_CONFIG", _IOC_WRITE, 0x6478, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_QUERY", _IOC_READ|_IOC_WRITE, 0x6479, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
@ -422,8 +423,11 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_LABEL_BO", _IOC_READ|_IOC_WRITE, 0x644a, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_CREATE", _IOC_READ|_IOC_WRITE, 0x644c, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_DESTROY", _IOC_READ|_IOC_WRITE, 0x644d, 0x04 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_GET_VALUES", _IOC_READ|_IOC_WRITE, 0x644e, 0x0c },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SET_TILING", _IOC_READ|_IOC_WRITE, 0x6448, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa8 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -1160,6 +1164,7 @@
{ "linux/if_tun.h", "TUNSETVNETHDRSZ", _IOC_WRITE, 0x54d8, 0x04 },
{ "linux/if_tun.h", "TUNSETVNETLE", _IOC_WRITE, 0x54dc, 0x04 },
{ "linux/iio/events.h", "IIO_GET_EVENT_FD_IOCTL", _IOC_READ, 0x6990, 0x04 },
{ "linux/inotify.h", "INOTIFY_IOC_SETNEXTWD", _IOC_WRITE, 0x4900, 0x04 },
{ "linux/input.h", "EVIOCGEFFECTS", _IOC_READ, 0x4584, 0x04 },
{ "linux/input.h", "EVIOCGID", _IOC_READ, 0x4502, 0x08 },
{ "linux/input.h", "EVIOCGKEYCODE", _IOC_READ, 0x4504, 0x08 },
@ -1197,6 +1202,9 @@
{ "linux/ipmi.h", "IPMICTL_SET_TIMING_PARMS_CMD", _IOC_READ, 0x6916, 0x08 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD", _IOC_READ, 0x690f, 0x02 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD_CHANS", _IOC_READ, 0x691d, 0x0c },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_CLEAR_SMS_ATN", _IOC_NONE, 0xb101, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_FORCE_ABORT", _IOC_NONE, 0xb102, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_SET_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/isdn.h", "IIOCDBGVAR", _IOC_NONE, 0x497f, 0x00 },
{ "linux/isdn.h", "IIOCDRVCTL", _IOC_NONE, 0x4980, 0x00 },
{ "linux/isdn.h", "IIOCGETCPS", _IOC_NONE, 0x4915, 0x00 },
@ -1238,48 +1246,6 @@
{ "linux/ivtv.h", "IVTV_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x38 },
{ "linux/ivtv.h", "IVTV_IOC_PASSTHROUGH_MODE", _IOC_WRITE, 0x56c1, 0x04 },
{ "linux/ivtvfb.h", "IVTVFB_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x0c },
{ "linux/ixjuser.h", "IXJCTL_AEC_GET_LEVEL", _IOC_NONE, 0x71cd, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_AEC_START", _IOC_WRITE, 0x71cb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_AEC_STOP", _IOC_NONE, 0x71cc, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_CARDTYPE", _IOC_READ, 0x71c1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CID", _IOC_READ, 0x71d4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CIDCW", _IOC_WRITE, 0x71d9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_AGAIN", _IOC_WRITE, 0x71d2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_COEFF_SET", _IOC_WRITE, 0x71d0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_CLEAR", _IOC_NONE, 0x71e7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_READ", _IOC_READ, 0x71e6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_IDLE", _IOC_NONE, 0x71c5, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_RESET", _IOC_NONE, 0x71c0, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_TYPE", _IOC_READ, 0x71c3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_VERSION", _IOC_READ, 0x71c4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DTMF_PRESCALE", _IOC_WRITE, 0x71e8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FILTER_CADENCE", _IOC_WRITE, 0x71d6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_READ", _IOC_READ, 0x71e2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_WRITTEN", _IOC_READ, 0x71e3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_GET_FILTER_HIST", _IOC_WRITE, 0x71c8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_HZ", _IOC_WRITE, 0x71e0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INIT_TONE", _IOC_WRITE, 0x71c9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_START", _IOC_WRITE, 0x71fd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_STOP", _IOC_WRITE, 0x71fe, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_MIXER", _IOC_WRITE, 0x71cf, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PLAY_CID", _IOC_NONE, 0x71d7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_PORT", _IOC_WRITE, 0x71d1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_POTS_PSTN", _IOC_WRITE, 0x71d5, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PSTN_LINETEST", _IOC_NONE, 0x71d3, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_RATE", _IOC_WRITE, 0x71e1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_READ_WAIT", _IOC_READ, 0x71e4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_RXG", _IOC_WRITE, 0x71ea, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_TXG", _IOC_WRITE, 0x71eb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SERIAL", _IOC_READ, 0x71c2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER", _IOC_WRITE, 0x71c7, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER_RAW", _IOC_WRITE, 0x71dd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_LED", _IOC_WRITE, 0x71ce, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SIGCTL", _IOC_WRITE, 0x71e9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_TESTRAM", _IOC_NONE, 0x71c6, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_TONE_CADENCE", _IOC_WRITE, 0x71ca, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VERSION", _IOC_READ, 0x71da, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VMWI", _IOC_READ, 0x71d8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_WRITE_WAIT", _IOC_READ, 0x71e5, 0x04 },
{ "linux/joystick.h", "JSIOCGAXES", _IOC_READ, 0x6a11, 0x01 },
{ "linux/joystick.h", "JSIOCGAXMAP", _IOC_READ, 0x6a32, 0x40 },
{ "linux/joystick.h", "JSIOCGBTNMAP", _IOC_READ, 0x6a34, 0x400 },
@ -1338,6 +1304,8 @@
{ "linux/kd.h", "PIO_UNIMAP", 0, 0x4B67, 0 },
{ "linux/kd.h", "PIO_UNIMAPCLR", 0, 0x4B68, 0 },
{ "linux/kd.h", "PIO_UNISCRNMAP", 0, 0x4B6A, 0 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ACQUIRE_VM", _IOC_WRITE, 0x4b15, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ALLOC_MEMORY_OF_GPU", _IOC_READ|_IOC_WRITE, 0x4b16, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_EVENT", _IOC_READ|_IOC_WRITE, 0x4b08, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b02, 0x58 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_ADDRESS_WATCH", _IOC_WRITE, 0x4b0f, 0x10 },
@ -1346,15 +1314,19 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_WAVE_CONTROL", _IOC_WRITE, 0x4b10, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_EVENT", _IOC_WRITE, 0x4b09, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b03, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_FREE_MEMORY_OF_GPU", _IOC_WRITE, 0x4b17, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_CLOCK_COUNTERS", _IOC_READ|_IOC_WRITE, 0x4b05, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES", _IOC_READ, 0x4b06, 0x190 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES_NEW", _IOC_READ|_IOC_WRITE, 0x4b14, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_TILE_CONFIG", _IOC_READ|_IOC_WRITE, 0x4b12, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_VERSION", _IOC_READ, 0x4b01, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_MAP_MEMORY_TO_GPU", _IOC_READ|_IOC_WRITE, 0x4b18, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_RESET_EVENT", _IOC_WRITE, 0x4b0b, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_EVENT", _IOC_WRITE, 0x4b0a, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_SCRATCH_BACKING_VA", _IOC_READ|_IOC_WRITE, 0x4b11, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_TRAP_HANDLER", _IOC_WRITE, 0x4b13, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU", _IOC_READ|_IOC_WRITE, 0x4b19, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
@ -1552,6 +1524,7 @@
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_MODIFY_ATTRIBUTES", _IOC_WRITE, 0x240b, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PAUSE_OUTPUT", _IOC_WRITE, 0x2409, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PERIOD", _IOC_WRITE, 0x2404, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_QUERY_BPF", _IOC_READ|_IOC_WRITE, 0x240a, 0x04 },
@ -1680,6 +1653,7 @@
{ "linux/random.h", "RNDCLEARPOOL", _IOC_NONE, 0x5206, 0x00 },
{ "linux/random.h", "RNDGETENTCNT", _IOC_READ, 0x5200, 0x04 },
{ "linux/random.h", "RNDGETPOOL", _IOC_READ, 0x5202, 0x08 },
{ "linux/random.h", "RNDRESEEDCRNG", _IOC_NONE, 0x5207, 0x00 },
{ "linux/random.h", "RNDZAPENTCNT", _IOC_NONE, 0x5204, 0x00 },
{ "linux/raw.h", "RAW_GETBIND", _IOC_NONE, 0xac01, 0x00 },
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
@ -2022,53 +1996,6 @@
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_CHECK", _IOC_WRITE, 0x7182, 0x04 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_LIST", _IOC_READ, 0x7181, 0x04 },
{ "linux/telephony.h", "PHONE_CPT_STOP", _IOC_NONE, 0x71a4, 0x00 },
{ "linux/telephony.h", "PHONE_DIALTONE", _IOC_NONE, 0x71a3, 0x00 },
{ "linux/telephony.h", "PHONE_DTMF_OOB", _IOC_WRITE, 0x7199, 0x04 },
{ "linux/telephony.h", "PHONE_DTMF_READY", _IOC_READ, 0x7196, 0x04 },
{ "linux/telephony.h", "PHONE_EXCEPTION", _IOC_READ, 0x719a, 0x04 },
{ "linux/telephony.h", "PHONE_FRAME", _IOC_WRITE, 0x718d, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF", _IOC_READ, 0x7197, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF_ASCII", _IOC_READ, 0x7198, 0x04 },
{ "linux/telephony.h", "PHONE_GET_TONE_OFF_TIME", _IOC_NONE, 0x719f, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_ON_TIME", _IOC_NONE, 0x719e, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_STATE", _IOC_NONE, 0x71a0, 0x00 },
{ "linux/telephony.h", "PHONE_HOOKSTATE", _IOC_NONE, 0x7184, 0x00 },
{ "linux/telephony.h", "PHONE_MAXRINGS", _IOC_WRITE, 0x7185, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_CODEC", _IOC_WRITE, 0x7190, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_DEPTH", _IOC_WRITE, 0x7193, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_LEVEL", _IOC_NONE, 0x7195, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_START", _IOC_NONE, 0x7191, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_STOP", _IOC_NONE, 0x7192, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_TONE", _IOC_WRITE, 0x719b, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME", _IOC_WRITE, 0x7194, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME_LINEAR", _IOC_WRITE, 0x71dc, 0x04 },
{ "linux/telephony.h", "PHONE_PSTN_GET_STATE", _IOC_NONE, 0x71a5, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_LINETEST", _IOC_NONE, 0x71a8, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_SET_STATE", _IOC_WRITE, 0x71a4, 0x04 },
{ "linux/telephony.h", "PHONE_QUERY_CODEC", _IOC_READ|_IOC_WRITE, 0x71a7, 0x04 },
{ "linux/telephony.h", "PHONE_REC_CODEC", _IOC_WRITE, 0x7189, 0x04 },
{ "linux/telephony.h", "PHONE_REC_DEPTH", _IOC_WRITE, 0x718c, 0x04 },
{ "linux/telephony.h", "PHONE_REC_LEVEL", _IOC_NONE, 0x718f, 0x00 },
{ "linux/telephony.h", "PHONE_REC_START", _IOC_NONE, 0x718a, 0x00 },
{ "linux/telephony.h", "PHONE_REC_STOP", _IOC_NONE, 0x718b, 0x00 },
{ "linux/telephony.h", "PHONE_REC_VOLUME", _IOC_WRITE, 0x718e, 0x04 },
{ "linux/telephony.h", "PHONE_REC_VOLUME_LINEAR", _IOC_WRITE, 0x71db, 0x04 },
{ "linux/telephony.h", "PHONE_RING", _IOC_NONE, 0x7183, 0x00 },
{ "linux/telephony.h", "PHONE_RINGBACK", _IOC_NONE, 0x71a2, 0x00 },
{ "linux/telephony.h", "PHONE_RING_CADENCE", _IOC_WRITE, 0x7186, 0x02 },
{ "linux/telephony.h", "PHONE_RING_START", _IOC_WRITE, 0x7187, 0x04 },
{ "linux/telephony.h", "PHONE_RING_STOP", _IOC_NONE, 0x7188, 0x00 },
{ "linux/telephony.h", "PHONE_SET_TONE_OFF_TIME", _IOC_WRITE, 0x719d, 0x04 },
{ "linux/telephony.h", "PHONE_SET_TONE_ON_TIME", _IOC_WRITE, 0x719c, 0x04 },
{ "linux/telephony.h", "PHONE_VAD", _IOC_WRITE, 0x71a9, 0x04 },
{ "linux/telephony.h", "PHONE_WINK", _IOC_WRITE, 0x71aa, 0x04 },
{ "linux/telephony.h", "PHONE_WINK_DURATION", _IOC_WRITE, 0x71a6, 0x04 },
{ "linux/timerfd.h", "TFD_IOC_SET_TICKS", _IOC_WRITE, 0x5400, 0x08 },
{ "linux/toshiba.h", "TOSHIBA_ACPI_SCI", _IOC_READ|_IOC_WRITE, 0x7491, 0x18 },
{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x18 },
@ -2199,6 +2126,7 @@
{ "linux/vfio.h", "VFIO_DEVICE_GET_IRQ_INFO", _IOC_NONE, 0x3b6d, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_PCI_HOT_RESET_INFO", _IOC_NONE, 0x3b70, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_REGION_INFO", _IOC_NONE, 0x3b6c, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_IOEVENTFD", _IOC_NONE, 0x3b74, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_PCI_HOT_RESET", _IOC_NONE, 0x3b71, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_QUERY_GFX_PLANE", _IOC_NONE, 0x3b72, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_RESET", _IOC_NONE, 0x3b6f, 0x00 },
@ -2537,7 +2465,7 @@
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x10 },
{ "rdma/rdma_user_ioctl_cmds.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x18 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },

View File

@ -283,6 +283,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_ADD_CONFIG", _IOC_WRITE, 0x6477, 0x48 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_REMOVE_CONFIG", _IOC_WRITE, 0x6478, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_QUERY", _IOC_READ|_IOC_WRITE, 0x6479, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
@ -422,8 +423,11 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_LABEL_BO", _IOC_READ|_IOC_WRITE, 0x644a, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_CREATE", _IOC_READ|_IOC_WRITE, 0x644c, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_DESTROY", _IOC_READ|_IOC_WRITE, 0x644d, 0x04 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_GET_VALUES", _IOC_READ|_IOC_WRITE, 0x644e, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SET_TILING", _IOC_READ|_IOC_WRITE, 0x6448, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa8 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -1160,6 +1164,7 @@
{ "linux/if_tun.h", "TUNSETVNETHDRSZ", _IOC_WRITE, 0x54d8, 0x04 },
{ "linux/if_tun.h", "TUNSETVNETLE", _IOC_WRITE, 0x54dc, 0x04 },
{ "linux/iio/events.h", "IIO_GET_EVENT_FD_IOCTL", _IOC_READ, 0x6990, 0x04 },
{ "linux/inotify.h", "INOTIFY_IOC_SETNEXTWD", _IOC_WRITE, 0x4900, 0x04 },
{ "linux/input.h", "EVIOCGEFFECTS", _IOC_READ, 0x4584, 0x04 },
{ "linux/input.h", "EVIOCGID", _IOC_READ, 0x4502, 0x08 },
{ "linux/input.h", "EVIOCGKEYCODE", _IOC_READ, 0x4504, 0x08 },
@ -1197,6 +1202,9 @@
{ "linux/ipmi.h", "IPMICTL_SET_TIMING_PARMS_CMD", _IOC_READ, 0x6916, 0x08 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD", _IOC_READ, 0x690f, 0x02 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD_CHANS", _IOC_READ, 0x691d, 0x0c },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_CLEAR_SMS_ATN", _IOC_NONE, 0xb101, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_FORCE_ABORT", _IOC_NONE, 0xb102, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_SET_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/isdn.h", "IIOCDBGVAR", _IOC_NONE, 0x497f, 0x00 },
{ "linux/isdn.h", "IIOCDRVCTL", _IOC_NONE, 0x4980, 0x00 },
{ "linux/isdn.h", "IIOCGETCPS", _IOC_NONE, 0x4915, 0x00 },
@ -1238,48 +1246,6 @@
{ "linux/ivtv.h", "IVTV_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x38 },
{ "linux/ivtv.h", "IVTV_IOC_PASSTHROUGH_MODE", _IOC_WRITE, 0x56c1, 0x04 },
{ "linux/ivtvfb.h", "IVTVFB_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x0c },
{ "linux/ixjuser.h", "IXJCTL_AEC_GET_LEVEL", _IOC_NONE, 0x71cd, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_AEC_START", _IOC_WRITE, 0x71cb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_AEC_STOP", _IOC_NONE, 0x71cc, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_CARDTYPE", _IOC_READ, 0x71c1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CID", _IOC_READ, 0x71d4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CIDCW", _IOC_WRITE, 0x71d9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_AGAIN", _IOC_WRITE, 0x71d2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_COEFF_SET", _IOC_WRITE, 0x71d0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_CLEAR", _IOC_NONE, 0x71e7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_READ", _IOC_READ, 0x71e6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_IDLE", _IOC_NONE, 0x71c5, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_RESET", _IOC_NONE, 0x71c0, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_TYPE", _IOC_READ, 0x71c3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_VERSION", _IOC_READ, 0x71c4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DTMF_PRESCALE", _IOC_WRITE, 0x71e8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FILTER_CADENCE", _IOC_WRITE, 0x71d6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_READ", _IOC_READ, 0x71e2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_WRITTEN", _IOC_READ, 0x71e3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_GET_FILTER_HIST", _IOC_WRITE, 0x71c8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_HZ", _IOC_WRITE, 0x71e0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INIT_TONE", _IOC_WRITE, 0x71c9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_START", _IOC_WRITE, 0x71fd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_STOP", _IOC_WRITE, 0x71fe, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_MIXER", _IOC_WRITE, 0x71cf, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PLAY_CID", _IOC_NONE, 0x71d7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_PORT", _IOC_WRITE, 0x71d1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_POTS_PSTN", _IOC_WRITE, 0x71d5, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PSTN_LINETEST", _IOC_NONE, 0x71d3, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_RATE", _IOC_WRITE, 0x71e1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_READ_WAIT", _IOC_READ, 0x71e4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_RXG", _IOC_WRITE, 0x71ea, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_TXG", _IOC_WRITE, 0x71eb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SERIAL", _IOC_READ, 0x71c2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER", _IOC_WRITE, 0x71c7, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER_RAW", _IOC_WRITE, 0x71dd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_LED", _IOC_WRITE, 0x71ce, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SIGCTL", _IOC_WRITE, 0x71e9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_TESTRAM", _IOC_NONE, 0x71c6, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_TONE_CADENCE", _IOC_WRITE, 0x71ca, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VERSION", _IOC_READ, 0x71da, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VMWI", _IOC_READ, 0x71d8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_WRITE_WAIT", _IOC_READ, 0x71e5, 0x04 },
{ "linux/joystick.h", "JSIOCGAXES", _IOC_READ, 0x6a11, 0x01 },
{ "linux/joystick.h", "JSIOCGAXMAP", _IOC_READ, 0x6a32, 0x40 },
{ "linux/joystick.h", "JSIOCGBTNMAP", _IOC_READ, 0x6a34, 0x400 },
@ -1338,6 +1304,8 @@
{ "linux/kd.h", "PIO_UNIMAP", 0, 0x4B67, 0 },
{ "linux/kd.h", "PIO_UNIMAPCLR", 0, 0x4B68, 0 },
{ "linux/kd.h", "PIO_UNISCRNMAP", 0, 0x4B6A, 0 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ACQUIRE_VM", _IOC_WRITE, 0x4b15, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ALLOC_MEMORY_OF_GPU", _IOC_READ|_IOC_WRITE, 0x4b16, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_EVENT", _IOC_READ|_IOC_WRITE, 0x4b08, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b02, 0x58 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_ADDRESS_WATCH", _IOC_WRITE, 0x4b0f, 0x10 },
@ -1346,15 +1314,19 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_WAVE_CONTROL", _IOC_WRITE, 0x4b10, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_EVENT", _IOC_WRITE, 0x4b09, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b03, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_FREE_MEMORY_OF_GPU", _IOC_WRITE, 0x4b17, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_CLOCK_COUNTERS", _IOC_READ|_IOC_WRITE, 0x4b05, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES", _IOC_READ, 0x4b06, 0x190 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES_NEW", _IOC_READ|_IOC_WRITE, 0x4b14, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_TILE_CONFIG", _IOC_READ|_IOC_WRITE, 0x4b12, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_VERSION", _IOC_READ, 0x4b01, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_MAP_MEMORY_TO_GPU", _IOC_READ|_IOC_WRITE, 0x4b18, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_RESET_EVENT", _IOC_WRITE, 0x4b0b, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_EVENT", _IOC_WRITE, 0x4b0a, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_SCRATCH_BACKING_VA", _IOC_READ|_IOC_WRITE, 0x4b11, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_TRAP_HANDLER", _IOC_WRITE, 0x4b13, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU", _IOC_READ|_IOC_WRITE, 0x4b19, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
@ -1552,6 +1524,7 @@
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_MODIFY_ATTRIBUTES", _IOC_WRITE, 0x240b, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PAUSE_OUTPUT", _IOC_WRITE, 0x2409, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PERIOD", _IOC_WRITE, 0x2404, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_QUERY_BPF", _IOC_READ|_IOC_WRITE, 0x240a, 0x04 },
@ -1680,6 +1653,7 @@
{ "linux/random.h", "RNDCLEARPOOL", _IOC_NONE, 0x5206, 0x00 },
{ "linux/random.h", "RNDGETENTCNT", _IOC_READ, 0x5200, 0x04 },
{ "linux/random.h", "RNDGETPOOL", _IOC_READ, 0x5202, 0x08 },
{ "linux/random.h", "RNDRESEEDCRNG", _IOC_NONE, 0x5207, 0x00 },
{ "linux/random.h", "RNDZAPENTCNT", _IOC_NONE, 0x5204, 0x00 },
{ "linux/raw.h", "RAW_GETBIND", _IOC_NONE, 0xac01, 0x00 },
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
@ -2022,53 +1996,6 @@
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_CHECK", _IOC_WRITE, 0x7182, 0x04 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_LIST", _IOC_READ, 0x7181, 0x04 },
{ "linux/telephony.h", "PHONE_CPT_STOP", _IOC_NONE, 0x71a4, 0x00 },
{ "linux/telephony.h", "PHONE_DIALTONE", _IOC_NONE, 0x71a3, 0x00 },
{ "linux/telephony.h", "PHONE_DTMF_OOB", _IOC_WRITE, 0x7199, 0x04 },
{ "linux/telephony.h", "PHONE_DTMF_READY", _IOC_READ, 0x7196, 0x04 },
{ "linux/telephony.h", "PHONE_EXCEPTION", _IOC_READ, 0x719a, 0x04 },
{ "linux/telephony.h", "PHONE_FRAME", _IOC_WRITE, 0x718d, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF", _IOC_READ, 0x7197, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF_ASCII", _IOC_READ, 0x7198, 0x04 },
{ "linux/telephony.h", "PHONE_GET_TONE_OFF_TIME", _IOC_NONE, 0x719f, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_ON_TIME", _IOC_NONE, 0x719e, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_STATE", _IOC_NONE, 0x71a0, 0x00 },
{ "linux/telephony.h", "PHONE_HOOKSTATE", _IOC_NONE, 0x7184, 0x00 },
{ "linux/telephony.h", "PHONE_MAXRINGS", _IOC_WRITE, 0x7185, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_CODEC", _IOC_WRITE, 0x7190, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_DEPTH", _IOC_WRITE, 0x7193, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_LEVEL", _IOC_NONE, 0x7195, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_START", _IOC_NONE, 0x7191, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_STOP", _IOC_NONE, 0x7192, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_TONE", _IOC_WRITE, 0x719b, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME", _IOC_WRITE, 0x7194, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME_LINEAR", _IOC_WRITE, 0x71dc, 0x04 },
{ "linux/telephony.h", "PHONE_PSTN_GET_STATE", _IOC_NONE, 0x71a5, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_LINETEST", _IOC_NONE, 0x71a8, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_SET_STATE", _IOC_WRITE, 0x71a4, 0x04 },
{ "linux/telephony.h", "PHONE_QUERY_CODEC", _IOC_READ|_IOC_WRITE, 0x71a7, 0x04 },
{ "linux/telephony.h", "PHONE_REC_CODEC", _IOC_WRITE, 0x7189, 0x04 },
{ "linux/telephony.h", "PHONE_REC_DEPTH", _IOC_WRITE, 0x718c, 0x04 },
{ "linux/telephony.h", "PHONE_REC_LEVEL", _IOC_NONE, 0x718f, 0x00 },
{ "linux/telephony.h", "PHONE_REC_START", _IOC_NONE, 0x718a, 0x00 },
{ "linux/telephony.h", "PHONE_REC_STOP", _IOC_NONE, 0x718b, 0x00 },
{ "linux/telephony.h", "PHONE_REC_VOLUME", _IOC_WRITE, 0x718e, 0x04 },
{ "linux/telephony.h", "PHONE_REC_VOLUME_LINEAR", _IOC_WRITE, 0x71db, 0x04 },
{ "linux/telephony.h", "PHONE_RING", _IOC_NONE, 0x7183, 0x00 },
{ "linux/telephony.h", "PHONE_RINGBACK", _IOC_NONE, 0x71a2, 0x00 },
{ "linux/telephony.h", "PHONE_RING_CADENCE", _IOC_WRITE, 0x7186, 0x02 },
{ "linux/telephony.h", "PHONE_RING_START", _IOC_WRITE, 0x7187, 0x04 },
{ "linux/telephony.h", "PHONE_RING_STOP", _IOC_NONE, 0x7188, 0x00 },
{ "linux/telephony.h", "PHONE_SET_TONE_OFF_TIME", _IOC_WRITE, 0x719d, 0x04 },
{ "linux/telephony.h", "PHONE_SET_TONE_ON_TIME", _IOC_WRITE, 0x719c, 0x04 },
{ "linux/telephony.h", "PHONE_VAD", _IOC_WRITE, 0x71a9, 0x04 },
{ "linux/telephony.h", "PHONE_WINK", _IOC_WRITE, 0x71aa, 0x04 },
{ "linux/telephony.h", "PHONE_WINK_DURATION", _IOC_WRITE, 0x71a6, 0x04 },
{ "linux/timerfd.h", "TFD_IOC_SET_TICKS", _IOC_WRITE, 0x5400, 0x08 },
{ "linux/toshiba.h", "TOSHIBA_ACPI_SCI", _IOC_READ|_IOC_WRITE, 0x7491, 0x18 },
{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x18 },
@ -2199,6 +2126,7 @@
{ "linux/vfio.h", "VFIO_DEVICE_GET_IRQ_INFO", _IOC_NONE, 0x3b6d, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_PCI_HOT_RESET_INFO", _IOC_NONE, 0x3b70, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_REGION_INFO", _IOC_NONE, 0x3b6c, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_IOEVENTFD", _IOC_NONE, 0x3b74, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_PCI_HOT_RESET", _IOC_NONE, 0x3b71, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_QUERY_GFX_PLANE", _IOC_NONE, 0x3b72, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_RESET", _IOC_NONE, 0x3b6f, 0x00 },
@ -2537,7 +2465,7 @@
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x10 },
{ "rdma/rdma_user_ioctl_cmds.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x18 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },

View File

@ -282,6 +282,7 @@
[289] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[290] = { 1, 0, SEN(pkey_free), "pkey_free" },
[291] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" },
#undef sys_ARCH_mmap
#undef ARCH_WANT_SYNC_FILE_RANGE2

View File

@ -283,6 +283,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_ADD_CONFIG", _IOC_WRITE, 0x6477, 0x48 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_REMOVE_CONFIG", _IOC_WRITE, 0x6478, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_QUERY", _IOC_READ|_IOC_WRITE, 0x6479, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
@ -422,8 +423,11 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_LABEL_BO", _IOC_READ|_IOC_WRITE, 0x644a, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_CREATE", _IOC_READ|_IOC_WRITE, 0x644c, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_DESTROY", _IOC_READ|_IOC_WRITE, 0x644d, 0x04 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_GET_VALUES", _IOC_READ|_IOC_WRITE, 0x644e, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SET_TILING", _IOC_READ|_IOC_WRITE, 0x6448, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa8 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -1160,6 +1164,7 @@
{ "linux/if_tun.h", "TUNSETVNETHDRSZ", _IOC_WRITE, 0x54d8, 0x04 },
{ "linux/if_tun.h", "TUNSETVNETLE", _IOC_WRITE, 0x54dc, 0x04 },
{ "linux/iio/events.h", "IIO_GET_EVENT_FD_IOCTL", _IOC_READ, 0x6990, 0x04 },
{ "linux/inotify.h", "INOTIFY_IOC_SETNEXTWD", _IOC_WRITE, 0x4900, 0x04 },
{ "linux/input.h", "EVIOCGEFFECTS", _IOC_READ, 0x4584, 0x04 },
{ "linux/input.h", "EVIOCGID", _IOC_READ, 0x4502, 0x08 },
{ "linux/input.h", "EVIOCGKEYCODE", _IOC_READ, 0x4504, 0x08 },
@ -1197,6 +1202,9 @@
{ "linux/ipmi.h", "IPMICTL_SET_TIMING_PARMS_CMD", _IOC_READ, 0x6916, 0x08 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD", _IOC_READ, 0x690f, 0x02 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD_CHANS", _IOC_READ, 0x691d, 0x0c },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_CLEAR_SMS_ATN", _IOC_NONE, 0xb101, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_FORCE_ABORT", _IOC_NONE, 0xb102, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_SET_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/isdn.h", "IIOCDBGVAR", _IOC_NONE, 0x497f, 0x00 },
{ "linux/isdn.h", "IIOCDRVCTL", _IOC_NONE, 0x4980, 0x00 },
{ "linux/isdn.h", "IIOCGETCPS", _IOC_NONE, 0x4915, 0x00 },
@ -1238,48 +1246,6 @@
{ "linux/ivtv.h", "IVTV_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x40 },
{ "linux/ivtv.h", "IVTV_IOC_PASSTHROUGH_MODE", _IOC_WRITE, 0x56c1, 0x04 },
{ "linux/ivtvfb.h", "IVTVFB_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x18 },
{ "linux/ixjuser.h", "IXJCTL_AEC_GET_LEVEL", _IOC_NONE, 0x71cd, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_AEC_START", _IOC_WRITE, 0x71cb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_AEC_STOP", _IOC_NONE, 0x71cc, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_CARDTYPE", _IOC_READ, 0x71c1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CID", _IOC_READ, 0x71d4, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_CIDCW", _IOC_WRITE, 0x71d9, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_DAA_AGAIN", _IOC_WRITE, 0x71d2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_COEFF_SET", _IOC_WRITE, 0x71d0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_CLEAR", _IOC_NONE, 0x71e7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_READ", _IOC_READ, 0x71e6, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_DSP_IDLE", _IOC_NONE, 0x71c5, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_RESET", _IOC_NONE, 0x71c0, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_TYPE", _IOC_READ, 0x71c3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_VERSION", _IOC_READ, 0x71c4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DTMF_PRESCALE", _IOC_WRITE, 0x71e8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FILTER_CADENCE", _IOC_WRITE, 0x71d6, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_READ", _IOC_READ, 0x71e2, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_WRITTEN", _IOC_READ, 0x71e3, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_GET_FILTER_HIST", _IOC_WRITE, 0x71c8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_HZ", _IOC_WRITE, 0x71e0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INIT_TONE", _IOC_WRITE, 0x71c9, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_START", _IOC_WRITE, 0x71fd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_STOP", _IOC_WRITE, 0x71fe, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_MIXER", _IOC_WRITE, 0x71cf, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PLAY_CID", _IOC_NONE, 0x71d7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_PORT", _IOC_WRITE, 0x71d1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_POTS_PSTN", _IOC_WRITE, 0x71d5, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PSTN_LINETEST", _IOC_NONE, 0x71d3, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_RATE", _IOC_WRITE, 0x71e1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_READ_WAIT", _IOC_READ, 0x71e4, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_SC_RXG", _IOC_WRITE, 0x71ea, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_TXG", _IOC_WRITE, 0x71eb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SERIAL", _IOC_READ, 0x71c2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER", _IOC_WRITE, 0x71c7, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER_RAW", _IOC_WRITE, 0x71dd, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_SET_LED", _IOC_WRITE, 0x71ce, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SIGCTL", _IOC_WRITE, 0x71e9, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_TESTRAM", _IOC_NONE, 0x71c6, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_TONE_CADENCE", _IOC_WRITE, 0x71ca, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_VERSION", _IOC_READ, 0x71da, 0x08 },
{ "linux/ixjuser.h", "IXJCTL_VMWI", _IOC_READ, 0x71d8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_WRITE_WAIT", _IOC_READ, 0x71e5, 0x08 },
{ "linux/joystick.h", "JSIOCGAXES", _IOC_READ, 0x6a11, 0x01 },
{ "linux/joystick.h", "JSIOCGAXMAP", _IOC_READ, 0x6a32, 0x40 },
{ "linux/joystick.h", "JSIOCGBTNMAP", _IOC_READ, 0x6a34, 0x400 },
@ -1338,6 +1304,8 @@
{ "linux/kd.h", "PIO_UNIMAP", 0, 0x4B67, 0 },
{ "linux/kd.h", "PIO_UNIMAPCLR", 0, 0x4B68, 0 },
{ "linux/kd.h", "PIO_UNISCRNMAP", 0, 0x4B6A, 0 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ACQUIRE_VM", _IOC_WRITE, 0x4b15, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ALLOC_MEMORY_OF_GPU", _IOC_READ|_IOC_WRITE, 0x4b16, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_EVENT", _IOC_READ|_IOC_WRITE, 0x4b08, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b02, 0x58 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_ADDRESS_WATCH", _IOC_WRITE, 0x4b0f, 0x10 },
@ -1346,15 +1314,19 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_WAVE_CONTROL", _IOC_WRITE, 0x4b10, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_EVENT", _IOC_WRITE, 0x4b09, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b03, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_FREE_MEMORY_OF_GPU", _IOC_WRITE, 0x4b17, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_CLOCK_COUNTERS", _IOC_READ|_IOC_WRITE, 0x4b05, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES", _IOC_READ, 0x4b06, 0x190 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES_NEW", _IOC_READ|_IOC_WRITE, 0x4b14, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_TILE_CONFIG", _IOC_READ|_IOC_WRITE, 0x4b12, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_VERSION", _IOC_READ, 0x4b01, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_MAP_MEMORY_TO_GPU", _IOC_READ|_IOC_WRITE, 0x4b18, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_RESET_EVENT", _IOC_WRITE, 0x4b0b, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_EVENT", _IOC_WRITE, 0x4b0a, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_SCRATCH_BACKING_VA", _IOC_READ|_IOC_WRITE, 0x4b11, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_TRAP_HANDLER", _IOC_WRITE, 0x4b13, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU", _IOC_READ|_IOC_WRITE, 0x4b19, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
@ -1552,6 +1524,7 @@
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_MODIFY_ATTRIBUTES", _IOC_WRITE, 0x240b, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PAUSE_OUTPUT", _IOC_WRITE, 0x2409, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PERIOD", _IOC_WRITE, 0x2404, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_QUERY_BPF", _IOC_READ|_IOC_WRITE, 0x240a, 0x08 },
@ -1680,6 +1653,7 @@
{ "linux/random.h", "RNDCLEARPOOL", _IOC_NONE, 0x5206, 0x00 },
{ "linux/random.h", "RNDGETENTCNT", _IOC_READ, 0x5200, 0x04 },
{ "linux/random.h", "RNDGETPOOL", _IOC_READ, 0x5202, 0x08 },
{ "linux/random.h", "RNDRESEEDCRNG", _IOC_NONE, 0x5207, 0x00 },
{ "linux/random.h", "RNDZAPENTCNT", _IOC_NONE, 0x5204, 0x00 },
{ "linux/raw.h", "RAW_GETBIND", _IOC_NONE, 0xac01, 0x00 },
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
@ -2022,53 +1996,6 @@
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_CHECK", _IOC_WRITE, 0x7182, 0x08 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_LIST", _IOC_READ, 0x7181, 0x08 },
{ "linux/telephony.h", "PHONE_CPT_STOP", _IOC_NONE, 0x71a4, 0x00 },
{ "linux/telephony.h", "PHONE_DIALTONE", _IOC_NONE, 0x71a3, 0x00 },
{ "linux/telephony.h", "PHONE_DTMF_OOB", _IOC_WRITE, 0x7199, 0x04 },
{ "linux/telephony.h", "PHONE_DTMF_READY", _IOC_READ, 0x7196, 0x04 },
{ "linux/telephony.h", "PHONE_EXCEPTION", _IOC_READ, 0x719a, 0x04 },
{ "linux/telephony.h", "PHONE_FRAME", _IOC_WRITE, 0x718d, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF", _IOC_READ, 0x7197, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF_ASCII", _IOC_READ, 0x7198, 0x04 },
{ "linux/telephony.h", "PHONE_GET_TONE_OFF_TIME", _IOC_NONE, 0x719f, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_ON_TIME", _IOC_NONE, 0x719e, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_STATE", _IOC_NONE, 0x71a0, 0x00 },
{ "linux/telephony.h", "PHONE_HOOKSTATE", _IOC_NONE, 0x7184, 0x00 },
{ "linux/telephony.h", "PHONE_MAXRINGS", _IOC_WRITE, 0x7185, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_CODEC", _IOC_WRITE, 0x7190, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_DEPTH", _IOC_WRITE, 0x7193, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_LEVEL", _IOC_NONE, 0x7195, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_START", _IOC_NONE, 0x7191, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_STOP", _IOC_NONE, 0x7192, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_TONE", _IOC_WRITE, 0x719b, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME", _IOC_WRITE, 0x7194, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME_LINEAR", _IOC_WRITE, 0x71dc, 0x04 },
{ "linux/telephony.h", "PHONE_PSTN_GET_STATE", _IOC_NONE, 0x71a5, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_LINETEST", _IOC_NONE, 0x71a8, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_SET_STATE", _IOC_WRITE, 0x71a4, 0x04 },
{ "linux/telephony.h", "PHONE_QUERY_CODEC", _IOC_READ|_IOC_WRITE, 0x71a7, 0x08 },
{ "linux/telephony.h", "PHONE_REC_CODEC", _IOC_WRITE, 0x7189, 0x04 },
{ "linux/telephony.h", "PHONE_REC_DEPTH", _IOC_WRITE, 0x718c, 0x04 },
{ "linux/telephony.h", "PHONE_REC_LEVEL", _IOC_NONE, 0x718f, 0x00 },
{ "linux/telephony.h", "PHONE_REC_START", _IOC_NONE, 0x718a, 0x00 },
{ "linux/telephony.h", "PHONE_REC_STOP", _IOC_NONE, 0x718b, 0x00 },
{ "linux/telephony.h", "PHONE_REC_VOLUME", _IOC_WRITE, 0x718e, 0x04 },
{ "linux/telephony.h", "PHONE_REC_VOLUME_LINEAR", _IOC_WRITE, 0x71db, 0x04 },
{ "linux/telephony.h", "PHONE_RING", _IOC_NONE, 0x7183, 0x00 },
{ "linux/telephony.h", "PHONE_RINGBACK", _IOC_NONE, 0x71a2, 0x00 },
{ "linux/telephony.h", "PHONE_RING_CADENCE", _IOC_WRITE, 0x7186, 0x02 },
{ "linux/telephony.h", "PHONE_RING_START", _IOC_WRITE, 0x7187, 0x08 },
{ "linux/telephony.h", "PHONE_RING_STOP", _IOC_NONE, 0x7188, 0x00 },
{ "linux/telephony.h", "PHONE_SET_TONE_OFF_TIME", _IOC_WRITE, 0x719d, 0x04 },
{ "linux/telephony.h", "PHONE_SET_TONE_ON_TIME", _IOC_WRITE, 0x719c, 0x04 },
{ "linux/telephony.h", "PHONE_VAD", _IOC_WRITE, 0x71a9, 0x04 },
{ "linux/telephony.h", "PHONE_WINK", _IOC_WRITE, 0x71aa, 0x04 },
{ "linux/telephony.h", "PHONE_WINK_DURATION", _IOC_WRITE, 0x71a6, 0x04 },
{ "linux/timerfd.h", "TFD_IOC_SET_TICKS", _IOC_WRITE, 0x5400, 0x08 },
{ "linux/toshiba.h", "TOSHIBA_ACPI_SCI", _IOC_READ|_IOC_WRITE, 0x7491, 0x18 },
{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x18 },
@ -2199,6 +2126,7 @@
{ "linux/vfio.h", "VFIO_DEVICE_GET_IRQ_INFO", _IOC_NONE, 0x3b6d, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_PCI_HOT_RESET_INFO", _IOC_NONE, 0x3b70, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_REGION_INFO", _IOC_NONE, 0x3b6c, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_IOEVENTFD", _IOC_NONE, 0x3b74, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_PCI_HOT_RESET", _IOC_NONE, 0x3b71, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_QUERY_GFX_PLANE", _IOC_NONE, 0x3b72, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_RESET", _IOC_NONE, 0x3b6f, 0x00 },
@ -2537,7 +2465,7 @@
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x10 },
{ "rdma/rdma_user_ioctl_cmds.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x18 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },

View File

@ -275,3 +275,4 @@
[289] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[290] = { 1, 0, SEN(pkey_free), "pkey_free" },
[291] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[292] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" },

View File

@ -1,2 +0,0 @@
/* ARM personality */
#include "errnoent.h"

View File

@ -1 +0,0 @@
#include "signalent.h"

View File

@ -1,8 +1,8 @@
static int
arch_set_error(struct tcb *tcp)
{
alpha_r0 = tcp->u_error;
return upoke(tcp, REG_R0, alpha_r0);
return upoke(tcp, REG_A3, (alpha_a3 = 1))
|| upoke(tcp, REG_R0, (alpha_r0 = tcp->u_error));
}
static int

View File

@ -36,12 +36,27 @@ static inline kernel_ulong_t
raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err)
{
*err = 0;
#ifdef __thumb__ /* && FRAME_POINTERS_ENABLED */
register kernel_ulong_t rt;
register kernel_ulong_t r0 __asm__("r0");
__asm__ __volatile__("mov %1,r7; mov r7,%2; swi 0x0; mov r7,%1"
: "=r"(r0), "=&r"(rt)
: "r"(nr)
: "memory");
#else
register kernel_ulong_t r7 __asm__("r7") = nr;
register kernel_ulong_t r0 __asm__("r0");
__asm__ __volatile__("swi 0x0"
: "=r"(r0)
: "r"(r7)
: "memory");
#endif
return r0;
}
# define raw_syscall_0 raw_syscall_0

View File

@ -423,6 +423,7 @@
[395] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[396] = { 1, 0, SEN(pkey_free), "pkey_free" },
[397] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[398] = { 4, 0, SEN(rseq), "rseq" },
#ifdef __ARM_EABI__
# define ARM_FIRST_SHUFFLED_SYSCALL 400

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1995-2017 The strace developers.
* Copyright (c) 1995-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,6 +36,7 @@
#endif
/* still unfinished */
#define sys_rseq printargs
#define sys_vm86 printargs
#define sys_vm86old printargs

View File

@ -58,6 +58,7 @@
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_HYPERV_EVENTFD", _IOC_WRITE, 0xaebd, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },

View File

@ -411,6 +411,8 @@
[382] = { 1, 0, SEN(pkey_free), "pkey_free" },
[383] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[384] = { 2, TP, SEN(arch_prctl), "arch_prctl" },
[385] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" },
[386] = { 4, 0, SEN(rseq), "rseq" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -27,21 +27,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* IA-32 syscalls that have pointer arguments which are incompatible
* with 64-bit layout get redirected to printargs.
*/
#if CST > 0
# undef SYS_FUNC_NAME
# define SYS_FUNC_NAME(syscall_name) printargs
# include "../i386/syscallent.h"
# undef SYS_FUNC_NAME
# define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(syscall_name)
#endif
/* You must be careful to check ../i386/syscallent.h so that this table
starts where that one leaves off.
*/
[1024] = { 0, 0, SEN(printargs), "ni_syscall" },
[1025] = { 1, TP|SE, SEN(exit), "exit" },
[1026] = { 3, TD, SEN(read), "read" },

5
linux/linux/signal.h Normal file
View File

@ -0,0 +1,5 @@
/*
* Workaround the infamous incompatibility between <linux/signal.h>
* and many libc headers by overriding <linux/signal.h> with <signal.h>.
*/
#include <signal.h>

View File

@ -38,7 +38,7 @@
[6035] = { 2, 0, SEN(getitimer), "getitimer" },
[6036] = { 3, 0, SEN(setitimer), "setitimer" },
[6037] = { 1, 0, SEN(alarm), "alarm" },
[6038] = { 0, NF, SEN(getpid), "getpid" },
[6038] = { 0, PU|NF, SEN(getpid), "getpid" },
[6039] = { 4, TD|TN, SEN(sendfile), "sendfile" },
[6040] = { 3, TN, SEN(socket), "socket" },
[6041] = { 3, TN, SEN(connect), "connect" },
@ -100,16 +100,16 @@
[6097] = { 1, 0, SEN(sysinfo), "sysinfo" },
[6098] = { 1, 0, SEN(times), "times" },
[6099] = { 4, 0, SEN(ptrace), "ptrace" },
[6100] = { 0, NF, SEN(getuid), "getuid" },
[6100] = { 0, PU|NF, SEN(getuid), "getuid" },
[6101] = { 3, 0, SEN(syslog), "syslog" },
[6102] = { 0, NF, SEN(getgid), "getgid" },
[6102] = { 0, PU|NF, SEN(getgid), "getgid" },
[6103] = { 1, 0, SEN(setuid), "setuid" },
[6104] = { 1, 0, SEN(setgid), "setgid" },
[6105] = { 0, NF, SEN(geteuid), "geteuid" },
[6106] = { 0, NF, SEN(getegid), "getegid" },
[6105] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[6106] = { 0, PU|NF, SEN(getegid), "getegid" },
[6107] = { 2, 0, SEN(setpgid), "setpgid" },
[6108] = { 0, NF, SEN(getppid), "getppid" },
[6109] = { 0, 0, SEN(getpgrp), "getpgrp" },
[6108] = { 0, PU|NF, SEN(getppid), "getppid" },
[6109] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[6110] = { 0, 0, SEN(setsid), "setsid" },
[6111] = { 2, 0, SEN(setreuid), "setreuid" },
[6112] = { 2, 0, SEN(setregid), "setregid" },
@ -178,7 +178,7 @@
[6175] = { 5, TN, SEN(putpmsg), "putpmsg" },
[6176] = { 0, 0, SEN(afs_syscall), "afs_syscall" },
[6177] = { 0, 0, SEN(printargs), "reserved177" },
[6178] = { 0, NF, SEN(gettid), "gettid" },
[6178] = { 0, PU|NF, SEN(gettid), "gettid" },
[6179] = { 3, TD, SEN(readahead), "readahead" },
[6180] = { 5, TF, SEN(setxattr), "setxattr" },
[6181] = { 5, TF, SEN(setxattr), "lsetxattr" },

View File

@ -38,7 +38,7 @@
[5035] = { 2, 0, SEN(getitimer), "getitimer" },
[5036] = { 3, 0, SEN(setitimer), "setitimer" },
[5037] = { 1, 0, SEN(alarm), "alarm" },
[5038] = { 0, NF, SEN(getpid), "getpid" },
[5038] = { 0, PU|NF, SEN(getpid), "getpid" },
[5039] = { 4, TD|TN, SEN(sendfile), "sendfile" },
[5040] = { 3, TN, SEN(socket), "socket" },
[5041] = { 3, TN, SEN(connect), "connect" },
@ -100,16 +100,16 @@
[5097] = { 1, 0, SEN(sysinfo), "sysinfo" },
[5098] = { 1, 0, SEN(times), "times" },
[5099] = { 4, 0, SEN(ptrace), "ptrace" },
[5100] = { 0, NF, SEN(getuid), "getuid" },
[5100] = { 0, PU|NF, SEN(getuid), "getuid" },
[5101] = { 3, 0, SEN(syslog), "syslog" },
[5102] = { 0, NF, SEN(getgid), "getgid" },
[5102] = { 0, PU|NF, SEN(getgid), "getgid" },
[5103] = { 1, 0, SEN(setuid), "setuid" },
[5104] = { 1, 0, SEN(setgid), "setgid" },
[5105] = { 0, NF, SEN(geteuid), "geteuid" },
[5106] = { 0, NF, SEN(getegid), "getegid" },
[5105] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[5106] = { 0, PU|NF, SEN(getegid), "getegid" },
[5107] = { 2, 0, SEN(setpgid), "setpgid" },
[5108] = { 0, NF, SEN(getppid), "getppid" },
[5109] = { 0, 0, SEN(getpgrp), "getpgrp" },
[5108] = { 0, PU|NF, SEN(getppid), "getppid" },
[5109] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[5110] = { 0, 0, SEN(setsid), "setsid" },
[5111] = { 2, 0, SEN(setreuid), "setreuid" },
[5112] = { 2, 0, SEN(setregid), "setregid" },
@ -178,7 +178,7 @@
[5175] = { 5, TN, SEN(putpmsg), "putpmsg" },
[5176] = { 0, 0, SEN(afs_syscall), "afs_syscall" },
[5177] = { 0, 0, SEN(printargs), "reserved177" },
[5178] = { 0, NF, SEN(gettid), "gettid" },
[5178] = { 0, PU|NF, SEN(gettid), "gettid" },
[5179] = { 3, TD, SEN(readahead), "readahead" },
[5180] = { 5, TF, SEN(setxattr), "setxattr" },
[5181] = { 5, TF, SEN(setxattr), "lsetxattr" },

View File

@ -21,11 +21,11 @@
[4017] = { 0, TM, SEN(break), "break" },
[4018] = { 2, TF|TST|TSTA, SEN(oldstat), "oldstat" },
[4019] = { 3, TD, SEN(lseek), "lseek" },
[4020] = { 0, NF, SEN(getpid), "getpid" },
[4020] = { 0, PU|NF, SEN(getpid), "getpid" },
[4021] = { 5, TF, SEN(mount), "mount" },
[4022] = { 1, TF, SEN(umount), "umount" },
[4023] = { 1, 0, SEN(setuid), "setuid" },
[4024] = { 0, NF, SEN(getuid), "getuid" },
[4024] = { 0, PU|NF, SEN(getuid), "getuid" },
[4025] = { 1, 0, SEN(stime), "stime" },
[4026] = { 4, 0, SEN(ptrace), "ptrace" },
[4027] = { 1, 0, SEN(alarm), "alarm" },
@ -48,10 +48,10 @@
[4044] = { 0, 0, SEN(prof), "prof" },
[4045] = { 1, TM|SI, SEN(brk), "brk" },
[4046] = { 1, 0, SEN(setgid), "setgid" },
[4047] = { 0, NF, SEN(getgid), "getgid" },
[4047] = { 0, PU|NF, SEN(getgid), "getgid" },
[4048] = { 2, TS, SEN(signal), "signal" },
[4049] = { 0, NF, SEN(geteuid), "geteuid" },
[4050] = { 0, NF, SEN(getegid), "getegid" },
[4049] = { 0, PU|NF, SEN(geteuid), "geteuid" },
[4050] = { 0, PU|NF, SEN(getegid), "getegid" },
[4051] = { 1, TF, SEN(acct), "acct" },
[4052] = { 2, TF, SEN(umount2), "umount2" },
[4053] = { 0, 0, SEN(lock), "lock" },
@ -65,8 +65,8 @@
[4061] = { 1, TF, SEN(chroot), "chroot" },
[4062] = { 2, TSFA, SEN(ustat), "ustat" },
[4063] = { 2, TD, SEN(dup2), "dup2" },
[4064] = { 0, NF, SEN(getppid), "getppid" },
[4065] = { 0, 0, SEN(getpgrp), "getpgrp" },
[4064] = { 0, PU|NF, SEN(getppid), "getppid" },
[4065] = { 0, PU|NF, SEN(getpgrp), "getpgrp" },
[4066] = { 0, 0, SEN(setsid), "setsid" },
[4067] = { 3, TS, SEN(sigaction), "sigaction" },
[4068] = { 0, TS, SEN(sgetmask), "sgetmask" },
@ -223,7 +223,7 @@
[4219] = { 3, TD, SEN(getdents64), "getdents64" },
[4220] = { 3, TD, SEN(fcntl64), "fcntl64" },
[4221] = { },
[4222] = { 0, NF, SEN(gettid), "gettid" },
[4222] = { 0, PU|NF, SEN(gettid), "gettid" },
[4223] = { 5, TD, SEN(readahead), "readahead" },
[4224] = { 5, TF, SEN(setxattr), "setxattr" },
[4225] = { 5, TF, SEN(setxattr), "lsetxattr" },

View File

@ -2,8 +2,10 @@ static int
arch_set_error(struct tcb *tcp)
{
ppc_regs.gpr[3] = tcp->u_error;
ppc_regs.ccr |= 0x10000000;
#ifdef HAVE_GETREGS_OLD
return upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
return upoke(tcp, sizeof(long) * PT_CCR, ppc_regs.ccr) ||
upoke(tcp, sizeof(long) * (PT_R0 + 3), ppc_regs.gpr[3]);
#else
return set_regs(tcp->pid);
#endif

View File

@ -414,6 +414,7 @@
[384] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[385] = { 1, 0, SEN(pkey_free), "pkey_free" },
[386] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[387] = { 4, 0, SEN(rseq), "rseq" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -1 +0,0 @@
#include "errnoent.h"

View File

@ -1 +0,0 @@
#include "signalent.h"

View File

@ -409,6 +409,7 @@
[384] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[385] = { 1, 0, SEN(pkey_free), "pkey_free" },
[386] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[387] = { 4, 0, SEN(rseq), "rseq" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -1,2 +0,0 @@
/* RISC-V rv32 and rv64 */
#include "../errnoent.h"

View File

@ -1,2 +0,0 @@
/* RISC-V rv32 and rv64 */
#include "../signalent.h"

View File

@ -410,6 +410,7 @@
[378] = { 2, 0, SEN(s390_guarded_storage), "s390_guarded_storage" },
[379] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[380] = { 4, 0, SEN(s390_sthyi), "s390_sthyi" },
[381] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -1 +0,0 @@
#include "errnoent.h"

View File

@ -1 +0,0 @@
#include "signalent.h"

View File

@ -394,6 +394,7 @@
[378] = { 2, 0, SEN(s390_guarded_storage), "s390_guarded_storage" },
[379] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[380] = { 4, 0, SEN(s390_sthyi), "s390_sthyi" },
[381] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -1 +0,0 @@
#include "errnoent.h"

View File

@ -1 +0,0 @@
#include "signalent.h"

View File

@ -1,2 +0,0 @@
/* tilegx32/tilepro */
#include "errnoent.h"

View File

@ -1,2 +0,0 @@
/* tilegx32/tilepro */
#include "signalent.h"

View File

@ -1,2 +0,0 @@
/* i386 personality */
#include "errnoent.h"

View File

@ -283,6 +283,7 @@
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_ADD_CONFIG", _IOC_WRITE, 0x6477, 0x48 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_OPEN", _IOC_WRITE, 0x6476, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_PERF_REMOVE_CONFIG", _IOC_WRITE, 0x6478, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_QUERY", _IOC_READ|_IOC_WRITE, 0x6479, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_REG_READ", _IOC_READ|_IOC_WRITE, 0x6471, 0x10 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SETPARAM", _IOC_WRITE, 0x6447, 0x08 },
{ "drm/i915_drm.h", "DRM_IOCTL_I915_SET_SPRITE_COLORKEY", _IOC_READ|_IOC_WRITE, 0x646b, 0x14 },
@ -422,8 +423,11 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_LABEL_BO", _IOC_READ|_IOC_WRITE, 0x644a, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_CREATE", _IOC_READ|_IOC_WRITE, 0x644c, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_DESTROY", _IOC_READ|_IOC_WRITE, 0x644d, 0x04 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_PERFMON_GET_VALUES", _IOC_READ|_IOC_WRITE, 0x644e, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SET_TILING", _IOC_READ|_IOC_WRITE, 0x6448, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_SUBMIT_CL", _IOC_READ|_IOC_WRITE, 0x6440, 0xa8 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
{ "drm/vgem_drm.h", "DRM_IOCTL_VGEM_FENCE_ATTACH", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -1160,6 +1164,7 @@
{ "linux/if_tun.h", "TUNSETVNETHDRSZ", _IOC_WRITE, 0x54d8, 0x04 },
{ "linux/if_tun.h", "TUNSETVNETLE", _IOC_WRITE, 0x54dc, 0x04 },
{ "linux/iio/events.h", "IIO_GET_EVENT_FD_IOCTL", _IOC_READ, 0x6990, 0x04 },
{ "linux/inotify.h", "INOTIFY_IOC_SETNEXTWD", _IOC_WRITE, 0x4900, 0x04 },
{ "linux/input.h", "EVIOCGEFFECTS", _IOC_READ, 0x4584, 0x04 },
{ "linux/input.h", "EVIOCGID", _IOC_READ, 0x4502, 0x08 },
{ "linux/input.h", "EVIOCGKEYCODE", _IOC_READ, 0x4504, 0x08 },
@ -1197,6 +1202,9 @@
{ "linux/ipmi.h", "IPMICTL_SET_TIMING_PARMS_CMD", _IOC_READ, 0x6916, 0x08 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD", _IOC_READ, 0x690f, 0x02 },
{ "linux/ipmi.h", "IPMICTL_UNREGISTER_FOR_CMD_CHANS", _IOC_READ, 0x691d, 0x0c },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_CLEAR_SMS_ATN", _IOC_NONE, 0xb101, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_FORCE_ABORT", _IOC_NONE, 0xb102, 0x00 },
{ "linux/ipmi_bmc.h", "IPMI_BMC_IOCTL_SET_SMS_ATN", _IOC_NONE, 0xb100, 0x00 },
{ "linux/isdn.h", "IIOCDBGVAR", _IOC_NONE, 0x497f, 0x00 },
{ "linux/isdn.h", "IIOCDRVCTL", _IOC_NONE, 0x4980, 0x00 },
{ "linux/isdn.h", "IIOCGETCPS", _IOC_NONE, 0x4915, 0x00 },
@ -1238,48 +1246,6 @@
{ "linux/ivtv.h", "IVTV_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x38 },
{ "linux/ivtv.h", "IVTV_IOC_PASSTHROUGH_MODE", _IOC_WRITE, 0x56c1, 0x04 },
{ "linux/ivtvfb.h", "IVTVFB_IOC_DMA_FRAME", _IOC_WRITE, 0x56c0, 0x0c },
{ "linux/ixjuser.h", "IXJCTL_AEC_GET_LEVEL", _IOC_NONE, 0x71cd, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_AEC_START", _IOC_WRITE, 0x71cb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_AEC_STOP", _IOC_NONE, 0x71cc, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_CARDTYPE", _IOC_READ, 0x71c1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CID", _IOC_READ, 0x71d4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_CIDCW", _IOC_WRITE, 0x71d9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_AGAIN", _IOC_WRITE, 0x71d2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DAA_COEFF_SET", _IOC_WRITE, 0x71d0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_CLEAR", _IOC_NONE, 0x71e7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DRYBUFFER_READ", _IOC_READ, 0x71e6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_IDLE", _IOC_NONE, 0x71c5, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_RESET", _IOC_NONE, 0x71c0, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_DSP_TYPE", _IOC_READ, 0x71c3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DSP_VERSION", _IOC_READ, 0x71c4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_DTMF_PRESCALE", _IOC_WRITE, 0x71e8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FILTER_CADENCE", _IOC_WRITE, 0x71d6, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_READ", _IOC_READ, 0x71e2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_FRAMES_WRITTEN", _IOC_READ, 0x71e3, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_GET_FILTER_HIST", _IOC_WRITE, 0x71c8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_HZ", _IOC_WRITE, 0x71e0, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INIT_TONE", _IOC_WRITE, 0x71c9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_START", _IOC_WRITE, 0x71fd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_INTERCOM_STOP", _IOC_WRITE, 0x71fe, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_MIXER", _IOC_WRITE, 0x71cf, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PLAY_CID", _IOC_NONE, 0x71d7, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_PORT", _IOC_WRITE, 0x71d1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_POTS_PSTN", _IOC_WRITE, 0x71d5, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_PSTN_LINETEST", _IOC_NONE, 0x71d3, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_RATE", _IOC_WRITE, 0x71e1, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_READ_WAIT", _IOC_READ, 0x71e4, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_RXG", _IOC_WRITE, 0x71ea, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SC_TXG", _IOC_WRITE, 0x71eb, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SERIAL", _IOC_READ, 0x71c2, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER", _IOC_WRITE, 0x71c7, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_FILTER_RAW", _IOC_WRITE, 0x71dd, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SET_LED", _IOC_WRITE, 0x71ce, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_SIGCTL", _IOC_WRITE, 0x71e9, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_TESTRAM", _IOC_NONE, 0x71c6, 0x00 },
{ "linux/ixjuser.h", "IXJCTL_TONE_CADENCE", _IOC_WRITE, 0x71ca, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VERSION", _IOC_READ, 0x71da, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_VMWI", _IOC_READ, 0x71d8, 0x04 },
{ "linux/ixjuser.h", "IXJCTL_WRITE_WAIT", _IOC_READ, 0x71e5, 0x04 },
{ "linux/joystick.h", "JSIOCGAXES", _IOC_READ, 0x6a11, 0x01 },
{ "linux/joystick.h", "JSIOCGAXMAP", _IOC_READ, 0x6a32, 0x40 },
{ "linux/joystick.h", "JSIOCGBTNMAP", _IOC_READ, 0x6a34, 0x400 },
@ -1338,6 +1304,8 @@
{ "linux/kd.h", "PIO_UNIMAP", 0, 0x4B67, 0 },
{ "linux/kd.h", "PIO_UNIMAPCLR", 0, 0x4B68, 0 },
{ "linux/kd.h", "PIO_UNISCRNMAP", 0, 0x4B6A, 0 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ACQUIRE_VM", _IOC_WRITE, 0x4b15, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_ALLOC_MEMORY_OF_GPU", _IOC_READ|_IOC_WRITE, 0x4b16, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_EVENT", _IOC_READ|_IOC_WRITE, 0x4b08, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_CREATE_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b02, 0x58 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_ADDRESS_WATCH", _IOC_WRITE, 0x4b0f, 0x10 },
@ -1346,15 +1314,19 @@
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DBG_WAVE_CONTROL", _IOC_WRITE, 0x4b10, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_EVENT", _IOC_WRITE, 0x4b09, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_DESTROY_QUEUE", _IOC_READ|_IOC_WRITE, 0x4b03, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_FREE_MEMORY_OF_GPU", _IOC_WRITE, 0x4b17, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_CLOCK_COUNTERS", _IOC_READ|_IOC_WRITE, 0x4b05, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES", _IOC_READ, 0x4b06, 0x190 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_PROCESS_APERTURES_NEW", _IOC_READ|_IOC_WRITE, 0x4b14, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_TILE_CONFIG", _IOC_READ|_IOC_WRITE, 0x4b12, 0x28 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_GET_VERSION", _IOC_READ, 0x4b01, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_MAP_MEMORY_TO_GPU", _IOC_READ|_IOC_WRITE, 0x4b18, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_RESET_EVENT", _IOC_WRITE, 0x4b0b, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_EVENT", _IOC_WRITE, 0x4b0a, 0x08 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_MEMORY_POLICY", _IOC_WRITE, 0x4b04, 0x20 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_SCRATCH_BACKING_VA", _IOC_READ|_IOC_WRITE, 0x4b11, 0x10 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_SET_TRAP_HANDLER", _IOC_WRITE, 0x4b13, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU", _IOC_READ|_IOC_WRITE, 0x4b19, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_UPDATE_QUEUE", _IOC_WRITE, 0x4b07, 0x18 },
{ "linux/kfd_ioctl.h", "AMDKFD_IOC_WAIT_EVENTS", _IOC_READ|_IOC_WRITE, 0x4b0c, 0x18 },
{ "linux/lightnvm.h", "NVME_NVM_IOCTL_ADMIN_VIO", _IOC_READ|_IOC_WRITE, 0x4c41, 0x50 },
@ -1552,6 +1524,7 @@
{ "linux/perf_event.h", "PERF_EVENT_IOC_DISABLE", _IOC_NONE, 0x2401, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ENABLE", _IOC_NONE, 0x2400, 0x00 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_ID", _IOC_READ, 0x2407, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_MODIFY_ATTRIBUTES", _IOC_WRITE, 0x240b, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PAUSE_OUTPUT", _IOC_WRITE, 0x2409, 0x04 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_PERIOD", _IOC_WRITE, 0x2404, 0x08 },
{ "linux/perf_event.h", "PERF_EVENT_IOC_QUERY_BPF", _IOC_READ|_IOC_WRITE, 0x240a, 0x04 },
@ -1680,6 +1653,7 @@
{ "linux/random.h", "RNDCLEARPOOL", _IOC_NONE, 0x5206, 0x00 },
{ "linux/random.h", "RNDGETENTCNT", _IOC_READ, 0x5200, 0x04 },
{ "linux/random.h", "RNDGETPOOL", _IOC_READ, 0x5202, 0x08 },
{ "linux/random.h", "RNDRESEEDCRNG", _IOC_NONE, 0x5207, 0x00 },
{ "linux/random.h", "RNDZAPENTCNT", _IOC_NONE, 0x5204, 0x00 },
{ "linux/raw.h", "RAW_GETBIND", _IOC_NONE, 0xac01, 0x00 },
{ "linux/raw.h", "RAW_SETBIND", _IOC_NONE, 0xac00, 0x00 },
@ -2022,53 +1996,6 @@
{ "linux/tee.h", "TEE_IOC_SUPPL_RECV", _IOC_READ, 0xa406, 0x10 },
{ "linux/tee.h", "TEE_IOC_SUPPL_SEND", _IOC_READ, 0xa407, 0x10 },
{ "linux/tee.h", "TEE_IOC_VERSION", _IOC_READ, 0xa400, 0x0c },
{ "linux/telephony.h", "OLD_PHONE_RING_START", _IOC_NONE, 0x7187, 0x00 },
{ "linux/telephony.h", "PHONE_BUSY", _IOC_NONE, 0x71a1, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES", _IOC_NONE, 0x7180, 0x00 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_CHECK", _IOC_WRITE, 0x7182, 0x04 },
{ "linux/telephony.h", "PHONE_CAPABILITIES_LIST", _IOC_READ, 0x7181, 0x04 },
{ "linux/telephony.h", "PHONE_CPT_STOP", _IOC_NONE, 0x71a4, 0x00 },
{ "linux/telephony.h", "PHONE_DIALTONE", _IOC_NONE, 0x71a3, 0x00 },
{ "linux/telephony.h", "PHONE_DTMF_OOB", _IOC_WRITE, 0x7199, 0x04 },
{ "linux/telephony.h", "PHONE_DTMF_READY", _IOC_READ, 0x7196, 0x04 },
{ "linux/telephony.h", "PHONE_EXCEPTION", _IOC_READ, 0x719a, 0x04 },
{ "linux/telephony.h", "PHONE_FRAME", _IOC_WRITE, 0x718d, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF", _IOC_READ, 0x7197, 0x04 },
{ "linux/telephony.h", "PHONE_GET_DTMF_ASCII", _IOC_READ, 0x7198, 0x04 },
{ "linux/telephony.h", "PHONE_GET_TONE_OFF_TIME", _IOC_NONE, 0x719f, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_ON_TIME", _IOC_NONE, 0x719e, 0x00 },
{ "linux/telephony.h", "PHONE_GET_TONE_STATE", _IOC_NONE, 0x71a0, 0x00 },
{ "linux/telephony.h", "PHONE_HOOKSTATE", _IOC_NONE, 0x7184, 0x00 },
{ "linux/telephony.h", "PHONE_MAXRINGS", _IOC_WRITE, 0x7185, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_CODEC", _IOC_WRITE, 0x7190, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_DEPTH", _IOC_WRITE, 0x7193, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_LEVEL", _IOC_NONE, 0x7195, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_START", _IOC_NONE, 0x7191, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_STOP", _IOC_NONE, 0x7192, 0x00 },
{ "linux/telephony.h", "PHONE_PLAY_TONE", _IOC_WRITE, 0x719b, 0x01 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME", _IOC_WRITE, 0x7194, 0x04 },
{ "linux/telephony.h", "PHONE_PLAY_VOLUME_LINEAR", _IOC_WRITE, 0x71dc, 0x04 },
{ "linux/telephony.h", "PHONE_PSTN_GET_STATE", _IOC_NONE, 0x71a5, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_LINETEST", _IOC_NONE, 0x71a8, 0x00 },
{ "linux/telephony.h", "PHONE_PSTN_SET_STATE", _IOC_WRITE, 0x71a4, 0x04 },
{ "linux/telephony.h", "PHONE_QUERY_CODEC", _IOC_READ|_IOC_WRITE, 0x71a7, 0x04 },
{ "linux/telephony.h", "PHONE_REC_CODEC", _IOC_WRITE, 0x7189, 0x04 },
{ "linux/telephony.h", "PHONE_REC_DEPTH", _IOC_WRITE, 0x718c, 0x04 },
{ "linux/telephony.h", "PHONE_REC_LEVEL", _IOC_NONE, 0x718f, 0x00 },
{ "linux/telephony.h", "PHONE_REC_START", _IOC_NONE, 0x718a, 0x00 },
{ "linux/telephony.h", "PHONE_REC_STOP", _IOC_NONE, 0x718b, 0x00 },
{ "linux/telephony.h", "PHONE_REC_VOLUME", _IOC_WRITE, 0x718e, 0x04 },
{ "linux/telephony.h", "PHONE_REC_VOLUME_LINEAR", _IOC_WRITE, 0x71db, 0x04 },
{ "linux/telephony.h", "PHONE_RING", _IOC_NONE, 0x7183, 0x00 },
{ "linux/telephony.h", "PHONE_RINGBACK", _IOC_NONE, 0x71a2, 0x00 },
{ "linux/telephony.h", "PHONE_RING_CADENCE", _IOC_WRITE, 0x7186, 0x02 },
{ "linux/telephony.h", "PHONE_RING_START", _IOC_WRITE, 0x7187, 0x04 },
{ "linux/telephony.h", "PHONE_RING_STOP", _IOC_NONE, 0x7188, 0x00 },
{ "linux/telephony.h", "PHONE_SET_TONE_OFF_TIME", _IOC_WRITE, 0x719d, 0x04 },
{ "linux/telephony.h", "PHONE_SET_TONE_ON_TIME", _IOC_WRITE, 0x719c, 0x04 },
{ "linux/telephony.h", "PHONE_VAD", _IOC_WRITE, 0x71a9, 0x04 },
{ "linux/telephony.h", "PHONE_WINK", _IOC_WRITE, 0x71aa, 0x04 },
{ "linux/telephony.h", "PHONE_WINK_DURATION", _IOC_WRITE, 0x71a6, 0x04 },
{ "linux/timerfd.h", "TFD_IOC_SET_TICKS", _IOC_WRITE, 0x5400, 0x08 },
{ "linux/toshiba.h", "TOSHIBA_ACPI_SCI", _IOC_READ|_IOC_WRITE, 0x7491, 0x18 },
{ "linux/toshiba.h", "TOSH_SMM", _IOC_READ|_IOC_WRITE, 0x7490, 0x18 },
@ -2199,6 +2126,7 @@
{ "linux/vfio.h", "VFIO_DEVICE_GET_IRQ_INFO", _IOC_NONE, 0x3b6d, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_PCI_HOT_RESET_INFO", _IOC_NONE, 0x3b70, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_GET_REGION_INFO", _IOC_NONE, 0x3b6c, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_IOEVENTFD", _IOC_NONE, 0x3b74, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_PCI_HOT_RESET", _IOC_NONE, 0x3b71, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_QUERY_GFX_PLANE", _IOC_NONE, 0x3b72, 0x00 },
{ "linux/vfio.h", "VFIO_DEVICE_RESET", _IOC_NONE, 0x3b6f, 0x00 },
@ -2537,7 +2465,7 @@
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT", _IOC_READ|_IOC_WRITE, 0x1b01, 0x1c },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_REGISTER_AGENT2", _IOC_READ|_IOC_WRITE, 0x1b04, 0x28 },
{ "rdma/rdma_user_ioctl.h", "IB_USER_MAD_UNREGISTER_AGENT", _IOC_WRITE, 0x1b02, 0x04 },
{ "rdma/rdma_user_ioctl.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x10 },
{ "rdma/rdma_user_ioctl_cmds.h", "RDMA_VERBS_IOCTL", _IOC_READ|_IOC_WRITE, 0x1b01, 0x18 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_ATTACH", _IOC_READ|_IOC_WRITE, 0xca80, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_DETACH", _IOC_READ|_IOC_WRITE, 0xca83, 0x60 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_MANAGE_LUN", _IOC_READ|_IOC_WRITE, 0xca86, 0x68 },

View File

@ -1,2 +0,0 @@
/* i386 personality */
#include "signalent.h"

View File

@ -11,14 +11,14 @@
[ 10] = { 3, TM|SI, SEN(mprotect), "mprotect" },
[ 11] = { 2, TM|SI, SEN(munmap), "munmap" },
[ 12] = { 1, TM|SI, SEN(brk), "brk" },
[ 13] = { 4, TS, SEN(printargs), "64:rt_sigaction" },
[ 13] = { 4, TS, SEN(printargs), "rt_sigaction#64" },
[ 14] = { 4, TS, SEN(rt_sigprocmask), "rt_sigprocmask" },
[ 15] = { 0, TS, SEN(rt_sigreturn), "64:rt_sigreturn" },
[ 16] = { 3, TD, SEN(printargs), "64:ioctl" },
[ 15] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn#64" },
[ 16] = { 3, TD, SEN(printargs), "ioctl#64" },
[ 17] = { 4, TD, SEN(pread), "pread64" },
[ 18] = { 4, TD, SEN(pwrite), "pwrite64" },
[ 19] = { 3, TD, SEN(printargs), "64:readv" },
[ 20] = { 3, TD, SEN(printargs), "64:writev" },
[ 19] = { 3, TD, SEN(printargs), "readv#64" },
[ 20] = { 3, TD, SEN(printargs), "writev#64" },
[ 21] = { 2, TF, SEN(access), "access" },
[ 22] = { 1, TD, SEN(pipe), "pipe" },
[ 23] = { 5, TD, SEN(select), "select" },
@ -43,21 +43,21 @@
[ 42] = { 3, TN, SEN(connect), "connect" },
[ 43] = { 3, TN, SEN(accept), "accept" },
[ 44] = { 6, TN, SEN(sendto), "sendto" },
[ 45] = { 6, TN, SEN(printargs), "64:recvfrom" },
[ 46] = { 3, TN, SEN(printargs), "64:sendmsg" },
[ 47] = { 3, TN, SEN(printargs), "64:recvmsg" },
[ 45] = { 6, TN, SEN(printargs), "recvfrom#64" },
[ 46] = { 3, TN, SEN(printargs), "sendmsg#64" },
[ 47] = { 3, TN, SEN(printargs), "recvmsg#64" },
[ 48] = { 2, TN, SEN(shutdown), "shutdown" },
[ 49] = { 3, TN, SEN(bind), "bind" },
[ 50] = { 2, TN, SEN(listen), "listen" },
[ 51] = { 3, TN, SEN(getsockname), "getsockname" },
[ 52] = { 3, TN, SEN(getpeername), "getpeername" },
[ 53] = { 4, TN, SEN(socketpair), "socketpair" },
[ 54] = { 5, TN, SEN(printargs), "64:setsockopt" },
[ 55] = { 5, TN, SEN(printargs), "64:getsockopt" },
[ 54] = { 5, TN, SEN(printargs), "setsockopt#64" },
[ 55] = { 5, TN, SEN(printargs), "getsockopt#64" },
[ 56] = { 5, TP, SEN(clone), "clone" },
[ 57] = { 0, TP, SEN(fork), "fork" },
[ 58] = { 0, TP, SEN(vfork), "vfork" },
[ 59] = { 3, TF|TP|SE|SI, SEN(printargs), "64:execve" },
[ 59] = { 3, TF|TP|SE|SI, SEN(printargs), "execve#64" },
[ 60] = { 1, TP|SE, SEN(exit), "exit" },
[ 61] = { 4, TP, SEN(wait4), "wait4" },
[ 62] = { 2, TS, SEN(kill), "kill" },
@ -99,7 +99,7 @@
[ 98] = { 2, 0, SEN(getrusage), "getrusage" },
[ 99] = { 1, 0, SEN(sysinfo), "sysinfo" },
[100] = { 1, 0, SEN(times), "times" },
[101] = { 4, 0, SEN(printargs), "64:ptrace" },
[101] = { 4, 0, SEN(printargs), "ptrace#64" },
[102] = { 0, PU|NF, SEN(getuid), "getuid" },
[103] = { 3, 0, SEN(syslog), "syslog" },
[104] = { 0, PU|NF, SEN(getgid), "getgid" },
@ -125,14 +125,14 @@
[124] = { 1, 0, SEN(getsid), "getsid" },
[125] = { 2, 0, SEN(capget), "capget" },
[126] = { 2, 0, SEN(capset), "capset" },
[127] = { 2, TS, SEN(printargs), "64:rt_sigpending" },
[128] = { 4, TS, SEN(printargs), "64:rt_sigtimedwait" },
[129] = { 3, TS, SEN(printargs), "64:rt_sigqueueinfo" },
[127] = { 2, TS, SEN(printargs), "rt_sigpending#64" },
[128] = { 4, TS, SEN(printargs), "rt_sigtimedwait#64" },
[129] = { 3, TS, SEN(printargs), "rt_sigqueueinfo#64" },
[130] = { 2, TS, SEN(rt_sigsuspend), "rt_sigsuspend" },
[131] = { 2, TS, SEN(printargs), "64:sigaltstack" },
[131] = { 2, TS, SEN(printargs), "sigaltstack#64" },
[132] = { 2, TF, SEN(utime), "utime" },
[133] = { 3, TF, SEN(mknod), "mknod" },
[134] = { 1, TF, SEN(printargs), "64:uselib" },
[134] = { 1, TF, SEN(printargs), "uselib#64" },
[135] = { 1, NF, SEN(personality), "personality" },
[136] = { 2, TSFA, SEN(ustat), "ustat" },
[137] = { 2, TF|TSF|TSFA, SEN(statfs), "statfs" },
@ -154,7 +154,7 @@
[153] = { 0, 0, SEN(vhangup), "vhangup" },
[154] = { 3, 0, SEN(modify_ldt), "modify_ldt" },
[155] = { 2, TF, SEN(pivotroot), "pivot_root" },
[156] = { 1, 0, SEN(printargs), "64:_sysctl" },
[156] = { 1, 0, SEN(printargs), "_sysctl#64" },
[157] = { 5, 0, SEN(prctl), "prctl" },
[158] = { 2, TP, SEN(arch_prctl), "arch_prctl" },
[159] = { 1, 0, SEN(adjtimex), "adjtimex" },
@ -172,13 +172,13 @@
[171] = { 2, 0, SEN(setdomainname), "setdomainname" },
[172] = { 1, 0, SEN(iopl), "iopl" },
[173] = { 3, 0, SEN(ioperm), "ioperm" },
[174] = { 2, 0, SEN(printargs), "64:create_module" },
[174] = { 2, 0, SEN(printargs), "create_module#64" },
[175] = { 3, 0, SEN(init_module), "init_module" },
[176] = { 2, 0, SEN(delete_module), "delete_module" },
[177] = { 1, 0, SEN(printargs), "64:get_kernel_syms" },
[178] = { 5, 0, SEN(printargs), "64:query_module" },
[177] = { 1, 0, SEN(printargs), "get_kernel_syms#64" },
[178] = { 5, 0, SEN(printargs), "query_module#64" },
[179] = { 4, TF, SEN(quotactl), "quotactl" },
[180] = { 3, 0, SEN(printargs), "64:nfsservctl" },
[180] = { 3, 0, SEN(printargs), "nfsservctl#64" },
[181] = { 5, TN, SEN(getpmsg), "getpmsg" },
[182] = { 5, TN, SEN(putpmsg), "putpmsg" },
[183] = { 5, 0, SEN(afs_syscall), "afs_syscall" },
@ -203,24 +203,24 @@
[202] = { 6, 0, SEN(futex), "futex" },
[203] = { 3, 0, SEN(sched_setaffinity), "sched_setaffinity" },
[204] = { 3, 0, SEN(sched_getaffinity), "sched_getaffinity" },
[205] = { 1, 0, SEN(printargs), "64:set_thread_area" },
[206] = { 2, TM, SEN(printargs), "64:io_setup" },
[205] = { 1, 0, SEN(printargs), "set_thread_area#64" },
[206] = { 2, TM, SEN(printargs), "io_setup#64" },
[207] = { 1, TM, SEN(io_destroy), "io_destroy" },
[208] = { 5, 0, SEN(io_getevents), "io_getevents" },
[209] = { 3, 0, SEN(printargs), "64:io_submit" },
[209] = { 3, 0, SEN(printargs), "io_submit#64" },
[210] = { 3, 0, SEN(io_cancel), "io_cancel" },
[211] = { 1, 0, SEN(printargs), "64:get_thread_area" },
[211] = { 1, 0, SEN(printargs), "get_thread_area#64" },
[212] = { 3, 0, SEN(lookup_dcookie), "lookup_dcookie" },
[213] = { 1, TD, SEN(epoll_create), "epoll_create" },
[214] = { 4, 0, SEN(printargs), "64:epoll_ctl_old" },
[215] = { 4, 0, SEN(printargs), "64:epoll_wait_old" },
[214] = { 4, 0, SEN(printargs), "epoll_ctl_old#64" },
[215] = { 4, 0, SEN(printargs), "epoll_wait_old#64" },
[216] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[217] = { 3, TD, SEN(getdents64), "getdents64" },
[218] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[219] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[220] = { 4, TI, SEN(semtimedop), "semtimedop" },
[221] = { 4, TD, SEN(fadvise64), "fadvise64" },
[222] = { 3, 0, SEN(printargs), "64:timer_create" },
[222] = { 3, 0, SEN(printargs), "timer_create#64" },
[223] = { 4, 0, SEN(timer_settime), "timer_settime" },
[224] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
[225] = { 1, 0, SEN(timer_getoverrun), "timer_getoverrun" },
@ -234,7 +234,7 @@
[233] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" },
[234] = { 3, TS, SEN(tgkill), "tgkill" },
[235] = { 2, TF, SEN(utimes), "utimes" },
[236] = { 5, 0, SEN(printargs), "64:vserver" },
[236] = { 5, 0, SEN(printargs), "vserver#64" },
[237] = { 6, TM, SEN(mbind), "mbind" },
[238] = { 3, TM, SEN(set_mempolicy), "set_mempolicy" },
[239] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },
@ -242,10 +242,10 @@
[241] = { 1, 0, SEN(mq_unlink), "mq_unlink" },
[242] = { 5, TD, SEN(mq_timedsend), "mq_timedsend" },
[243] = { 5, TD, SEN(mq_timedreceive), "mq_timedreceive" },
[244] = { 2, 0, SEN(printargs), "64:mq_notify" },
[244] = { 2, 0, SEN(printargs), "mq_notify#64" },
[245] = { 3, TD, SEN(mq_getsetattr), "mq_getsetattr" },
[246] = { 4, 0, SEN(printargs), "64:kexec_load" },
[247] = { 5, TP, SEN(printargs), "64:waitid" },
[246] = { 4, 0, SEN(printargs), "kexec_load#64" },
[247] = { 5, TP, SEN(printargs), "waitid#64" },
[248] = { 5, 0, SEN(add_key), "add_key" },
[249] = { 4, 0, SEN(request_key), "request_key" },
[250] = { 5, 0, SEN(keyctl), "keyctl" },
@ -271,13 +271,13 @@
[270] = { 6, TD, SEN(pselect6), "pselect6" },
[271] = { 5, TD, SEN(ppoll), "ppoll" },
[272] = { 1, TP, SEN(unshare), "unshare" },
[273] = { 2, 0, SEN(printargs), "64:set_robust_list" },
[274] = { 3, 0, SEN(printargs), "64:get_robust_list" },
[273] = { 2, 0, SEN(printargs), "set_robust_list#64" },
[274] = { 3, 0, SEN(printargs), "get_robust_list#64" },
[275] = { 6, TD, SEN(splice), "splice" },
[276] = { 4, TD, SEN(tee), "tee" },
[277] = { 4, TD, SEN(sync_file_range), "sync_file_range" },
[278] = { 4, TD, SEN(printargs), "64:vmsplice" },
[279] = { 6, TM, SEN(printargs), "64:move_pages" },
[278] = { 4, TD, SEN(printargs), "vmsplice#64" },
[279] = { 6, TM, SEN(printargs), "move_pages#64" },
[280] = { 4, TD|TF, SEN(utimensat), "utimensat" },
[281] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[282] = { 3, TD|TS, SEN(signalfd), "signalfd" },
@ -293,11 +293,11 @@
[292] = { 3, TD, SEN(dup3), "dup3" },
[293] = { 2, TD, SEN(pipe2), "pipe2" },
[294] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[295] = { 4, TD, SEN(printargs), "64:preadv" },
[296] = { 4, TD, SEN(printargs), "64:pwritev" },
[297] = { 4, TP|TS, SEN(printargs), "64:rt_tgsigqueueinfo" },
[295] = { 4, TD, SEN(printargs), "preadv#64" },
[296] = { 4, TD, SEN(printargs), "pwritev#64" },
[297] = { 4, TP|TS, SEN(printargs), "rt_tgsigqueueinfo#64" },
[298] = { 5, TD, SEN(perf_event_open), "perf_event_open" },
[299] = { 5, TN, SEN(printargs), "64:recvmmsg" },
[299] = { 5, TN, SEN(printargs), "recvmmsg#64" },
[300] = { 2, TD, SEN(fanotify_init), "fanotify_init" },
[301] = { 5, TD|TF, SEN(fanotify_mark), "fanotify_mark" },
[302] = { 4, 0, SEN(prlimit64), "prlimit64" },
@ -305,11 +305,11 @@
[304] = { 3, TD, SEN(open_by_handle_at), "open_by_handle_at" },
[305] = { 2, 0, SEN(clock_adjtime), "clock_adjtime" },
[306] = { 1, TD, SEN(syncfs), "syncfs" },
[307] = { 4, TN, SEN(printargs), "64:sendmmsg" },
[307] = { 4, TN, SEN(printargs), "sendmmsg#64" },
[308] = { 2, TD, SEN(setns), "setns" },
[309] = { 3, 0, SEN(getcpu), "getcpu" },
[310] = { 6, 0, SEN(printargs), "64:process_vm_readv" },
[311] = { 6, 0, SEN(printargs), "64:process_vm_writev" },
[310] = { 6, 0, SEN(printargs), "process_vm_readv#64" },
[311] = { 6, 0, SEN(printargs), "process_vm_writev#64" },
[312] = { 5, 0, SEN(kcmp), "kcmp" },
[313] = { 3, TD, SEN(finit_module), "finit_module" },
[314] = { 3, 0, SEN(sched_setattr), "sched_setattr" },
@ -320,18 +320,19 @@
[319] = { 2, TD, SEN(memfd_create), "memfd_create" },
[320] = { 5, TD, SEN(kexec_file_load), "kexec_file_load" },
[321] = { 3, TD, SEN(bpf), "bpf" },
[322] = { 5, TD|TF|TP|SE|SI, SEN(printargs), "64:execveat" },
[322] = { 5, TD|TF|TP|SE|SI, SEN(printargs), "execveat#64" },
[323] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[324] = { 2, 0, SEN(membarrier), "membarrier" },
[325] = { 3, TM, SEN(mlock2), "mlock2" },
[326] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[327] = { 6, TD, SEN(printargs), "64:preadv2" },
[328] = { 6, TD, SEN(printargs), "64:pwritev2" },
[327] = { 6, TD, SEN(printargs), "preadv2#64" },
[328] = { 6, TD, SEN(printargs), "pwritev2#64" },
[329] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[330] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[331] = { 1, 0, SEN(pkey_free), "pkey_free" },
[332] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[333 ... 511] = { },
[333] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" },
[334 ... 511] = { },
/*
* x32-specific system call numbers start at 512 to avoid cache impact
* for native 64-bit operation.
@ -372,3 +373,4 @@
[545] = { 5, CST|TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[546] = { 5, TD, SEN(preadv2), "preadv2" },
[547] = { 5, TD, SEN(pwritev2), "pwritev2" },
[334] = { 4, 0, SEN(rseq), "rseq" },

View File

@ -1,2 +0,0 @@
/* i386 personality */
#include "errnoent.h"

View File

@ -1,2 +0,0 @@
/* x32 personality */
#include "errnoent.h"

View File

@ -58,6 +58,7 @@
{ "linux/kvm.h", "KVM_GET_XCRS", _IOC_READ, 0xaea6, 0x188 },
{ "linux/kvm.h", "KVM_GET_XSAVE", _IOC_READ, 0xaea4, 0x1000 },
{ "linux/kvm.h", "KVM_HAS_DEVICE_ATTR", _IOC_WRITE, 0xaee3, 0x18 },
{ "linux/kvm.h", "KVM_HYPERV_EVENTFD", _IOC_WRITE, 0xaebd, 0x18 },
{ "linux/kvm.h", "KVM_INTERRUPT", _IOC_WRITE, 0xae86, 0x04 },
{ "linux/kvm.h", "KVM_IOEVENTFD", _IOC_WRITE, 0xae79, 0x40 },
{ "linux/kvm.h", "KVM_IRQFD", _IOC_WRITE, 0xae76, 0x20 },

View File

@ -1,2 +0,0 @@
/* i386 personality */
#include "signalent.h"

View File

@ -1,2 +0,0 @@
/* x32 personality */
#include "signalent.h"

View File

@ -331,3 +331,5 @@
[330] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[331] = { 1, 0, SEN(pkey_free), "pkey_free" },
[332] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[333] = { 6, 0, SEN(io_pgetevents), "io_pgetevents" },
[334] = { 4, 0, SEN(rseq), "rseq" },

28
m4/gen_bpf_attr_m4.awk Normal file
View File

@ -0,0 +1,28 @@
/^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/ {
match($0, /^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/, a)
struct_name = a[1]
subtype_name = a[3]
if (struct_name ~ /^BPF_/)
prefix = "union bpf_attr"
else
prefix = "struct " struct_name
if (subtype_name != "")
prefix = prefix "." subtype_name
in_struct = 1
next
}
/^}( ATTRIBUTE_ALIGNED\(.*\))?;/ {
in_struct = 0
next
}
(in_struct == 1) {
if (match($0, /^[[:space:]]+[^;\[\]]+[[:space:]]+([^[:space:]\[\];]+)(\[[^;]*\])?;$/, a)) {
print "\t\t" prefix "." a[1] ","
}
}

View File

@ -34,37 +34,7 @@ AC_DEFUN([st_BPF_ATTR], [dnl
AC_CHECK_MEMBERS(m4_normalize([
EOF
fetch_structs()
{
local name="${1:-}"
local name_re=
[ -z "$name" ] ||
name_re='\/\* '"$name"' \*\/ '
sed -n '/^struct BPF_[^[:space:]]\+_struct '"$name_re"'{/,/^};/p' < "$input"
}
filter_entries()
{
local name="${1:-}"
local subtype=
[ -z "$name" ] ||
subtype=".$name"
local search='^[[:space:]]\+[^;]*[[:space:]]\([^[:space:];]\+\);$'
local replacement='\t\tunion bpf_attr'"$subtype"'.\1,'
sed -n "s/$search/$replacement/p" |
sort -u
}
# nameless structures in union bpf_attr
fetch_structs |
filter_entries
# named structures in union bpf_attr
for name in $(sed -n 's/^struct BPF_[^[:space:]]\+_struct \/\* \([^[:space:]]\+\) \*\/ {.*/\1/p' < "$input"); do
fetch_structs "$name" |
filter_entries "$name"
done
gawk -f "${0%/*}"/gen_bpf_attr_m4.awk < "$input" | sort -u
cat <<'EOF'
union bpf_attr.dummy

82
m4/st_demangle.m4 Normal file
View File

@ -0,0 +1,82 @@
#!/usr/bin/m4
#
# Copyright (c) 2017-2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_DEFUN([st_DEMANGLE], [dnl
AC_ARG_WITH([libiberty],
[AS_HELP_STRING([--with-libiberty],
[use libiberty to demangle symbols in stack trace])],
[case "${withval}" in
yes|no|check) ;;
*) with_libiberty=yes
libiberty_CPPFLAGS="-I${withval}/include"
libiberty_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libiberty=check]
)
libiberty_CPPFLAGS=
libiberty_LDFLAGS=
libiberty_LIBS=
use_libiberty=no
AS_IF([test "x$with_libiberty" != xno],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS"
AC_CHECK_HEADERS([demangle.h libiberty/demangle.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libiberty_LDFLAGS"
AC_CHECK_LIB([iberty],[cplus_demangle],
[libiberty_LIBS="-liberty"
use_libiberty=yes
],
[if test "x$with_libiberty" != xcheck; then
AC_MSG_FAILURE([failed to find cplus_demangle in libiberty])
fi
]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libiberty" != xcheck; then
AC_MSG_FAILURE([failed to find demangle.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
AC_MSG_CHECKING([whether to enable symbols demangling in stack trace])
if test "x$use_libiberty" = xyes; then
AC_DEFINE([USE_DEMANGLE], 1, [Do symbols demangling in stack trace])
AC_SUBST(libiberty_LIBS)
AC_SUBST(libiberty_LDFLAGS)
AC_SUBST(libiberty_CPPFLAGS)
fi
AC_MSG_RESULT([$use_libiberty])
])

113
m4/st_libdw.m4 Normal file
View File

@ -0,0 +1,113 @@
#!/usr/bin/m4
#
# Copyright (c) 2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_DEFUN([st_ARG_LIBDW], [dnl
: ${libdw_CPPFLAGS=}
: ${libdw_CFLAGS=}
: ${libdw_LDFLAGS=}
: ${libdw_LIBS=}
AC_ARG_WITH([libdw],
[AS_HELP_STRING([--with-libdw],
[use libdw to implement stack tracing support]
)
],
[case "${withval}" in
yes|no|check) ;;
*) libdw_CPPFLAGS="-I${withval}/include"
libdw_LDFLAGS="-L${withval}/lib"
with_libdw=yes ;;
esac
],
[with_libdw=check]
)
])
AC_DEFUN([st_LIBDW], [dnl
have_libdw=
AS_IF([test "x$with_libdw" != xno && test "x$use_unwinder" = x],
[saved_CPPFLAGS="$CPPFLAGS"
saved_CFLAGS="$CFLAGS"
CPPFLAGS="$CPPFLAGS $libdw_CPPFLAGS"
CFLAGS="$CFLAGS $libdw_CFLAGS"
AC_CHECK_HEADERS([elfutils/libdwfl.h],
[AC_CHECK_LIB([dw], [dwfl_linux_proc_attach],
[libdw_LIBS="-ldw $libdw_LIBS"
AC_CACHE_CHECK([for elfutils version],
[st_cv_ELFUTILS_VERSION],
[[st_cv_ELFUTILS_VERSION="$(echo _ELFUTILS_VERSION |
$CPP $CPPFLAGS -P -imacros elfutils/version.h - |
grep '^[0-9]')"
test -n "$st_cv_ELFUTILS_VERSION" ||
st_cv_ELFUTILS_VERSION=0
]]
)
AS_IF([test "$st_cv_ELFUTILS_VERSION" -ge 164],
[have_libdw=yes],
[AS_IF([test "x$with_libdw" = xyes],
[AC_MSG_ERROR([elfutils version >= 164 is required for stack tracing support])],
[AC_MSG_WARN([elfutils version >= 164 is required for stack tracing support])]
)
]
)
],
[AS_IF([test "x$with_libdw" = xyes],
[AC_MSG_FAILURE([failed to find dwfl_linux_proc_attach in libdw])],
)
],
[$libdw_LDFLAGS $libdw_LIBS]
)
],
[AS_IF([test "x$with_libdw" = xyes],
[AC_MSG_FAILURE([failed to find elfutils/libdwfl.h])]
)
]
)
CFLAGS="$saved_CFLAGS"
CPPFLAGS="$saved_CPPFLAGS"
]
)
AS_IF([test "x$have_libdw" = xyes],
[use_unwinder=libdw
AC_DEFINE([USE_LIBDW], 1,
[Whether to use libdw for stack tracing]
)
AC_SUBST(libdw_CPPFLAGS)
AC_SUBST(libdw_CFLAGS)
AC_SUBST(libdw_LDFLAGS)
AC_SUBST(libdw_LIBS)
]
)
])

119
m4/st_libunwind.m4 Normal file
View File

@ -0,0 +1,119 @@
#!/usr/bin/m4
#
# Copyright (c) 2013-2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_DEFUN([st_ARG_LIBUNWIND], [dnl
AC_ARG_WITH([libunwind],
[AS_HELP_STRING([--with-libunwind],
[use libunwind to implement stack tracing support])],
[case "${withval}" in
yes|no|check) ;;
*) with_libunwind=yes
libunwind_CPPFLAGS="-I${withval}/include"
libunwind_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libunwind=check]
)
])
AC_DEFUN([st_LIBUNWIND], [dnl
libunwind_CPPFLAGS=
libunwind_LDFLAGS=
libunwind_LIBS=
AS_IF([test "x$with_libunwind" != xno && test "x$use_unwinder" = x],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
AC_CHECK_HEADERS([libunwind-ptrace.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
AC_CHECK_LIB([unwind], [backtrace],
[libunwind_LIBS="-lunwind $libunwind_LIBS"
AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
saved_LIBS="$LIBS"
LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
[[return !unw_create_addr_space(0, 0)]])
],
[AC_MSG_RESULT([yes])
libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
[libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
use_unwinder=libunwind
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
fi
],
[$libunwind_LIBS]
)
],
[AC_MSG_RESULT([no])
if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
fi
]
)
LIBS="$saved_LIBS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind])
fi
],
[$libunwind_LIBS]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
if test "x$use_unwinder" = xlibunwind; then
AC_DEFINE([USE_LIBUNWIND], 1,
[Whether to use libunwind for stack tracing])
AC_SUBST(libunwind_LIBS)
AC_SUBST(libunwind_LDFLAGS)
AC_SUBST(libunwind_CPPFLAGS)
fi
])

78
m4/st_stacktrace.m4 Normal file
View File

@ -0,0 +1,78 @@
#!/usr/bin/m4
#
# Copyright (c) 2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_DEFUN([st_STACKTRACE], [dnl
AC_ARG_ENABLE([stacktrace],
[AS_HELP_STRING([--enable-stacktrace=yes|no|check],
[whether to enable stack tracing support, default is check])],
[case "$enableval" in
yes|no|check) enable_stacktrace="$enableval" ;;
*) AC_MSG_ERROR([bad value $enableval for enable-stacktrace option.
Valid options are: yes, no, check.])
;;
esac],
[enable_stacktrace=check])
use_unwinder=
dnl Whether to enable stack tracing support?
AS_IF([test x"$enable_stacktrace" != xno],
[st_ARG_LIBDW
st_ARG_LIBUNWIND
AS_IF([test "x$with_libdw" = xyes && test "x$with_libunwind" = xyes],
[AC_MSG_ERROR([--with-libdw=yes and --with-libunwind=yes are mutually exclusive])],
[test "x$with_libdw" = xyes], [with_libunwind=no],
[test "x$with_libunwind" = xyes], [with_libdw=no]
)
AS_IF([test "x$use_unwinder" = x], [st_LIBDW])
AS_IF([test "x$use_unwinder" = x], [st_LIBUNWIND])
AS_IF([test x"$enable_stacktrace$use_unwinder" = xyes],
[AC_MSG_ERROR([stack tracing support requires an unwinder])]
)
]
)
AC_MSG_CHECKING([whether to enable stack tracing support])
AM_CONDITIONAL([ENABLE_STACKTRACE], [test "x$use_unwinder" != x])
AM_CONDITIONAL([USE_LIBDW], [test "x$use_unwinder" = xlibdw])
AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_unwinder" = xlibunwind])
use_libiberty=
AS_IF([test "x$use_unwinder" != x],
[AC_DEFINE([ENABLE_STACKTRACE], [1],
[Define to enable stack tracing support])
AC_DEFINE_UNQUOTED([USE_UNWINDER], ["$use_unwinder"],
[The unwinder to use for stack tracing support])
AC_MSG_RESULT([yes, using $use_unwinder])
dnl As stack tracing support is enabled, check for a demangler.
st_DEMANGLE],
[AC_MSG_RESULT([no])])
AM_CONDITIONAL([USE_DEMANGLE], [test "x$use_libiberty" = xyes])
])

View File

@ -35,6 +35,8 @@
#define ARRAY_SIZE(a_) (sizeof(a_) / sizeof((a_)[0]) + MUST_BE_ARRAY(a_))
#define ARRSZ_PAIR(a_) a_, ARRAY_SIZE(a_)
#define STRINGIFY(...) #__VA_ARGS__
#define STRINGIFY_VAL(...) STRINGIFY(__VA_ARGS__)

21
maint/README-release Normal file
View File

@ -0,0 +1,21 @@
* commit changes prepared by maint/update_copyright_years.sh
* update copyright year number range in COPYING and debian/copyright
* prepare NEWS for release
* generate release notes for strace.io and git repository mirrors
using maint/gen-release-notes.sh, maint/gen-release-github.sh
and maint/gen-release-gitlab.sh
* create a release tag using maint/gen-tag-message.sh
* generate a release tarball using make-dist
* send the tarball to release farms for the final testing
* prepare and test package builds for ALT and Rawhide
* generate a detached signature for the tarball using gpg -ab
* push the release tag to all git repository mirrors
* upload the tarball, it's signature and release notes to strace.io
and all git repository mirrors
* adjust the link to the latest release at strace.io
* submit a release announce to strace-devel
* update irc #strace topic using /topic #strace
* update https://en.wikipedia.org/wiki/Strace
* tweet the news
* announce the new release at http://freshcode.club/projects/strace
* announce the new release at other news-related sites

12
maint/gen-release-github.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh -efu
"$(dirname "$0")"/gen-tag-message.sh |
sed 's/\([^[:space:]]\)\*/\1\\*/g'
cat <<'EOF'
Downloads
=========
**Please ignore so called "Source code" links provided by github above, they are useless**.
EOF

22
maint/gen-release-gitlab.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh -efu
cat <<'EOF'
Downloads
=========
EOF
set +f
set -- strace-*.tar.xz*
set -f
for f; do
printf '[%s](/uploads/%s/%s)\n' "$f" "..." "$f"
done
cat <<'EOF'
**Please ignore so called "Source code" links provided by gitlab, they are useless**.
EOF
"$(dirname "$0")"/gen-tag-message.sh |
sed 's/\([^[:space:]]\)\*/\1\\*/g'

5
maint/gen-release-notes.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh -efu
echo '<pre>'
"$(dirname "$0")"/gen-tag-message.sh
echo '</pre>'

View File

@ -1,5 +1,6 @@
#!/bin/sh -efu
# Copyright (c) 2017 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2017-2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -65,4 +66,5 @@ changes or bug reports. These include:
__EOF__
"$(dirname "$0")"/gen-contributors-list.sh
"$(dirname "$0")"/gen-contributors-list.sh |
sed 's/^./* &/'

Some files were not shown because too many files have changed in this diff Show More