Compare commits

..

334 Commits
v4.18 ... v4.19

Author SHA1 Message Date
af9010e63b Prepare for 4.19 release
* NEWS: Update for 4.19 release.
2017-09-05 12:13:14 +00:00
6b259c1b63 .mailmap: add canonical name and address of Edgar Kaziakhmedov
* .mailmap: Add canonical name and address of Edgar Kaziakhmedov here
to avoid duplications in CREDITS file.
2017-09-05 12:13:14 +00:00
832320813b maint: add gen-tag-message.sh script
* maint/gen-tag-message.sh: New file.
2017-09-05 12:13:14 +00:00
10c45eef05 maint: add gen-contributors-list.sh script
* maint/gen-contributors-list.sh: New file.
2017-09-05 12:13:14 +00:00
dc3dfc68b4 Update copyright headers
Headers updated automatically with

    maint/update_copyright_headers.sh -c
2017-09-05 10:09:10 +02:00
2769e408e5 update_copyright_years.sh: add ability to automatically commit results
* maint/update_copyright_years.sh (DEFAULT_GIT_COMMIT_MESSAGE,
GIT_COMMIT_MESSAGE): New variables.
<-c>: New option, implies -a, calls git commit with GIT_COMMIT_TEMPLATE string
as a template.
2017-09-05 10:09:10 +02:00
db70fcf6da configure.ac: specify minimal GNU Automake version
In order to provide better diagnostics.

* configure.ac (AM_INIT_AUTOMAKE): Specify minimal GNU Automake version as
1.13 due to usage of AM_EXTRA_RECURSIVE_TARGETS macro.

Closes: https://github.com/strace/strace/issues/11
2017-09-04 23:21:14 +02:00
94e0fe19bc Update NEWS 2017-09-04 23:17:27 +02:00
8801aa382e tests: check decoding of IFLA_XDP netlink attribute of ifinfomsg
* tests/nlattr_ifla_xdp.c: New file.
* tests/gen_tests.in (nlattr_ifla_xdp): New entry.
* tests/pure_executables.list: Add nlattr_ifla_xdp.
* tests/.gitignore: Likewise.
2017-09-03 15:39:24 +00:00
214c36b39d tests: check decoding of IFLA_PORT_SELF netlink attribute of ifinfomsg
* tests/nlattr_ifla_port.c: New file.
* tests/gen_tests.in (nlattr_ifla_port): New entry.
* tests/pure_executables.list: Add nlattr_ifla_port.
* tests/.gitignore: Likewise.
2017-09-03 15:39:24 +00:00
3feafcbb7a tests: check decoding of more ifinfomsg netlink attributes
* tests/nlattr_ifinfomsg.c (IFLA_LINKINFO, IFLA_VF_PORTS,
IFLA_INFO_KIND, IFLA_VF_PORT): New macros.
(main): Check decoding of IFLA_LINKINFO and IFLA_VF_PORTS.
2017-09-03 15:39:24 +00:00
38042986d9 rtnl_link: decode more ifinfomsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for struct ifla_port_vsi
in <linux/if_link.h>.
* rtnl_link.c: Include "xlat/rtnl_ifla_info_attrs.h",
"xlat/rtnl_ifla_port_attrs.h", "xlat/rtnl_ifla_port_attrs.h",
"xlat/rtnl_ifla_xdp_attrs.h", and "xlat/xdp_flags.h".
(decode_ifla_linkinfo, decode_ifla_port_vsi,
decode_ifla_port, decode_ifla_vf_ports,
decode_ifla_xdp_flags, decode_ifla_xdp): New functions.
(ifla_linkinfo_nla_decoders, ifla_port_nla_decoders,
ifla_vf_port_nla_decoders, ifla_xdp_nla_decoders): New arrays.
(ifinfomsg_nla_decoders) <IFLA_LINKINFO>: Use decode_ifla_linkinfo.
<IFLA_VF_PORTS>: Use decode_ifla_vf_ports.
<IFLA_PORT_SELF>: Use decode_ifla_port.
<IFLA_XDP>: Use decode_ifla_xdp.
* xlat/rtnl_ifla_info_attrs.in: New file.
* xlat/rtnl_ifla_port_attrs.in: Likewise.
* xlat/rtnl_ifla_vf_port_attrs.in: Likewise.
* xlat/rtnl_ifla_xdp_attrs.in: Likewise.
* xlat/xdp_flags.in: Likewise.
2017-09-03 15:39:24 +00:00
46a4dcf4c3 keyctl: add support for KDF parameters decoding in KEYCTL_DH_COMPUTE
* fetch_struct_keyctl_kdf_params.c: New file.
* keyctl_kdf_params.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* configure.ac: Add check for struct keyctl_kdf_params presence in
<linux/keyctl.h>.
* defs.h (struct strace_keyctl_kdf_params): Add forward declaration.
* keyctl.c (keyctl_dh_compute): Add new parameter kdf_addr, print it
on exiting.
(SYS_FUNC(keyctl)) <case KEYCTL_DH_COMPUTE>: Pass arg5 to
keyctl_dh_compute.
* tests/keyctl.c: Include assert.h.
(struct keyctl_kdf_params) [!HAVE_STRUCT_KEYCTL_KDF_PARAMS]: New
definition.
(STR32): New definition, copied from ioctl_dm.c.
(append_str, kckdfp_to_str): New functions.
(main): Update expected output, add checks for struct keyctl_kdf_params
decoding.
2017-09-02 21:48:14 +00:00
5a8b032f2f tests/keyctl: improve readability
* tests/keyctl.c: Since do_keyctl() has so convoluted calling convention
and keyctl test is so complex, let's try to improve readability a bit
with some conventions regarding do_keyctl() call formatting: arguments
representing single keyctl argument should be put on the separate line,
continuations of arguments related to the same keyctl argument should
have additional indentation and termination 0UL should always be
on a separate line.  Also, while we are here, let's add spaces
to two type casts that are missing them.
2017-09-02 21:48:14 +00:00
be307d73ce s390: update ioctl entries from linux 4.13
* linux/s390/ioctls_arch0.h: Update from linux v4.13-rc7 using ioctls_gen.sh.
2017-09-01 21:08:20 +00:00
874b1943f0 mpers.awk: fix regression introduced by the previous cleanup
* mpers.awk (what_is): Remove returned_size from local variables.

Fixes: v4.18-308-gfd3447b5 ("mpers.awk: declare local variables consistently")
2017-09-01 17:30:13 +00:00
9069517382 rtnl_link: enhance decoding of struct rtnl_link_stats{,64}
Enhance runtime detection of struct rtnl_link_stats.rx_nohandler
and struct rtnl_link_stats64.rx_nohandler.

* rtnl_link.c (decode_rtnl_link_stats): Do not accept structure length
greater than min_size but less than sizeof(struct rtnl_link_stats).
(decode_rtnl_link_stats64): Likewise, so not accept structure length
greater than min_size but less than sizeof(struct rtnl_link_stats64).
2017-09-01 08:41:08 +00:00
b738f44a52 rtnl_neightbl: enhance decoding of struct ndt_stats
Add support of kernels that operate with older definition of
struct ndt_stats than the definition used to build strace.

* rtnl_neightbl.c (decode_ndt_stats): Add runtime detection
of struct ndt_stats.ndts_table_fulls field, print the field
when it is available.
2017-09-01 08:41:08 +00:00
bf1a463c79 tests: check decoding of IFLA_PROTINFO netlink attribute of ifinfomsg
* tests/nlattr_ifla_brport.c: New file.
* tests/gen_tests.in (nlattr_ifla_brport): New entry.
* tests/pure_executables.list: Add nlattr_ifla_brport.
* tests/.gitignore: Likewise.
* tests/test_nlattr.h (TEST_NESTED_NLATTR_OBJECT): New macro.
2017-09-01 08:41:08 +00:00
496a12551c rtnl_link: decode IFLA_PROTINFO netlink attribute of ifinfomsg
* configure.ac (AC_CHECK_TYPES): Check for ifla_bridge_id
and rtnl_link_stats64 structures in <linux/if_link.h>.
* rtnl_link.c: Include "xlat/rtnl_ifla_brport_attrs.h".
(decode_ifla_bridge_id, decode_ifla_protinfo): New functions.
(ifla_brport_nla_decoders): New array.
(ifinfomsg_nla_decoders) <IFLA_PROTINFO>: Use decode_ifla_protinfo.
* xlat/rtnl_ifla_brport_attrs.in: New file.
2017-09-01 08:41:08 +00:00
3c28699bfd tests: check decoding of ndtmsg netlink attributes
* tests/nlattr_ndtmsg.c (NDTA_PARMS, NDTPA_IFINDEX): New macros.
(main): Check decoding of NDTA_CONFIG, NDTA_PARMS and NDTA_STATS.
2017-09-01 08:41:08 +00:00
bbfc46d638 rtnl_neightbl: decode ndtmsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for ndt_config
and ndt_stats structures in <linux/neighbour.h>.
(AC_CHECK_MEMBERS): Check for ndts_table_fulls field in struct ndt_stats.
* rtnl_neightbl.c: Include "xlat/rtnl_neightbl_parms_attrs.h".
(decode_ndt_config, decode_ndta_parms, decode_ndta_parms): New functions.
(ndt_parms_nla_decoders, ndtmsg_nla_decoders): New arrays.
(decode_ndtmsg): Use ndtmsg_nla_decoders.
* xlat/rtnl_neightbl_parms_attrs.in: New file.
2017-09-01 08:41:08 +00:00
76ac04f5f9 tests: check decoding of ifaddrlblmsg netlink attributes
* tests/nlattr_ifaddrlblmsg.c (main): Check decoding of IFAL_ADDRESS.
2017-09-01 08:41:08 +00:00
c23f5baaec rtnl_addrlabel: decode ifaddrlblmsg netlink attributes
* rtnl_addrlabel.c (decode_ifal_address): New function.
(ifaddrlblmsg_nla_decoders): New array.
(decode_ifaddrlblmsg): Use it.
2017-09-01 08:41:08 +00:00
170c3ead53 alpha: wire up new syscalls
* linux/alpha/syscallent.h [514..522]: New entries.
2017-09-01 00:56:59 +00:00
2cb9ebe6a7 tests/.gitignore: add missing files that should be ignored
* tests/.gitignore: Add is_linux_mips_n64.
2017-08-31 09:57:47 +00:00
fd3447b51e mpers.awk: declare local variables consistently
* mpers.awk (compare_indices): Make c1 and c2 variables local.
(enter): Make item variable local.
(what_is): Make loc_diff, returned_size, and to_return local.
2017-08-31 09:54:24 +00:00
bfe513073d mpers.awk: separate local variables from real parameters by newline
* mpers.awk (array_get, update_upper_bound): Separate local variables
from real parameters by newline.
2017-08-30 09:48:51 +00:00
c95b9cb23b rtnl_rule: enhance FRA_TABLE decoding
The attribute of FRA_TABLE is not just a 32-bit integer, some constants
have well-known symbolic names like RT_TABLE_DEFAULT.

* rtnl_rule.c (fib_rule_hdr_nla_decoders) <FRA_TABLE>:
Use decode_nla_rt_class.
* tests/nlattr_fib_rule_hdr.c (FRA_TABLE): New macro.
(main): Check FRA_TABLE decoding.
2017-08-29 10:09:04 +00:00
a6a1bc9abc rtnl_route: enhance RTA_TABLE decoding
The attribute of RTA_TABLE is not just a 32-bit integer, some constants
have well-known symbolic names like RT_TABLE_DEFAULT.

* nlattr.h (decode_nla_rt_class): New prototype.
* rtnl_route.c (decode_nla_rt_class): New function.
(rtmsg_nla_decoders) <RTA_TABLE>: Use it.
* tests/nlattr_rtmsg.c (main): Check RTA_TABLE decoding.
2017-08-29 10:09:04 +00:00
b2278dc30a rtnl_nsid: decode rtgenmsg netlink attributes
* rtnl_nsid.c (rtgenmsg_nla_decoders): New array.
(decode_rtgenmsg): Use it.
2017-08-29 15:23:59 +08:00
aa01963208 rtnl_netconf: decode netconfmsg netlink attributes
* rtnl_netconf.c (netconfmsg_nla_decoders): New array.
(decode_netconfmsg): Use it.
2017-08-29 15:23:59 +08:00
d396a91d89 tests: check decoding of ndmsg netlink attributes
* tests/nlattr_ndmsg.c: Include <netinet/in.h> and <arpa/inet.h>.
(NDA_PORT): New macro.
(main): Check decoding of NDA_DST, NDA_CACHEINFO and NDA_PORT.
2017-08-29 15:23:59 +08:00
19abd528fb rtnl_neigh: decode ndmsg netlink attributes
* nlattr.c: Include <netinet/in.h> and <arpa/inet.h>.
(decode_nla_be16): New function.
* nlattr.h (decode_nla_be16): New prototype.
* rtnl_neigh.c (decode_neigh_addr,
decode_nda_cacheinfo): New functions.
(ndmsg_nla_decoders): New array.
(decode_ndmsg): Use it.
2017-08-29 15:23:36 +08:00
65ad4f2cce tests: check decoding of fib_rule_hdr netlink attributes
* tests/nlattr_fib_rule_hdr.c: Include <inttypes.h>.
(FRA_TUN_ID, FRA_UID_RANGE): New macros.
(main): Check decoding of FRA_DST, FRA_UID_RANGE and FRA_TUN_ID.
2017-08-29 15:15:04 +08:00
b9a437c147 rtnl_rule: decode fib_rule_hdr netlink attributes
* configure.ac (AC_CHECK_FUNCS): Add be64toh.
(AC_CHECK_TYPES): Check for struct fib_rule_uid_range
in <linux/fib_rules.h>.
* nlattr.c: Include <endian.h>.
(decode_nla_be64): New function.
* nlattr.h (decode_nla_be64): New prototype.
* rtnl_rule.c (decode_rule_addr,
decode_fib_rule_uid_range): New functions.
(fib_rule_hdr_nla_decoders): New array.
(decode_fib_rule_hdr): Use it.
2017-08-29 15:13:12 +08:00
62c573a002 rtnl_neigh: fix ndm_type field decode in struct ndmsg
* defs.h (routing_types): New xlat prototype.
* rtnl_neigh.c (decode_ndmsg): Fix ndm_type decode.
* xlat/nda_types.in: Remove it.
* tests/netlink_route.c (test_rtnl_neigh): Update the test.
* tests/nlattr_ndmsg.c (init_ndmsg, print_ndmsg): Likewise.
2017-08-29 12:16:03 +08:00
ed9faa2e27 Disallow more than one signal= specification in an injection expression
Specifying several signal= specifications in an injection expressions
makes no sense.

* filter_qualify.c (parse_inject_token): Disallow second
signal= specification.
* strace.1.in: Document it.
* tests/qual_inject-syntax.test: Check it.
2017-08-28 23:38:43 +00:00
fe1ab2a53a Add "flags" field to struct inject_data
Introduce "flags" field to struct inject_data and use it instead
of magic rval and signo constants.
Due to layout of struct inject_data, this new field does not change
sizeof(struct inject_data).

* defs.h (INJECT_F_RETVAL, INJECT_F_SIGNAL): New macros.
(INJECT_OPTS_RVAL_DEFAULT): Remove macro.
(struct inject_data): Add "flags" field.
* filter_qualify.c (parse_inject_token, qualify_inject_common): Check
struct inject_data.flags instead of inject_data.rval
and inject_data.signo, do not initialize inject_opts.data.
* syscall.c (tamper_with_syscall_entering): Check struct
inject_data.flags instead of inject_data.rval and inject_data.signo.
2017-08-28 22:37:27 +00:00
4fa9ea3707 Move inject data of struct inject_opts to inject_data substructure
* defs.h (inject_data): New structure.
(struct inject_opts): Replace "signo" and "rval" fields with "data"
field of type "struct inject_data".
* filter_qualify.c (parse_inject_token, qualify_inject_common): Update
for the new layout of struct inject_opts.
* syscall.c (tamper_with_syscall_entering, tamper_with_syscall_exiting):
Likewise.

Co-authored-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>
2017-08-28 22:37:27 +00:00
5f270dcbc6 Update ioctl entries from linux v4.13-rc7
* linux/32/ioctls_inc_align16.h: Update from linux v4.13-rc7 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/arm/ioctls_arch0.h: Likewise.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390x/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
* NEWS: Mention this.
2017-08-28 14:44:38 +00:00
c345a7e653 tests: check decoding of ifinfomsg netlink attributes
* tests/nlattr_ifinfomsg.c: Include <stddef.h> and <linux/if_link.h>.
(IFLA_LINK_NETNSID): New macro.
(main): Check decoding of IFLA_LINK_NETNSID,
IFLA_STATS, IFLA_MAP and IFLA_STATS64.
2017-08-28 10:41:54 +00:00
df87f17101 rtnl_link: decode ifinfomsg netlink attributes
* configure.ac (AC_CHECK_HEADERS): Add linux/if_link.h.
(AC_CHECK_TYPES): Check for struct rtnl_link_stats64
in <linux/if_link.h>.
(AC_CHECK_MEMBERS): Check for rx_nohandler field
in struct rtnl_link_stats/rtnl_link_stats64.
* rtnl_link.c: Include <linux/if_link.h>.
(decode_rtnl_link_stats, decode_rtnl_link_ifmap,
decode_rtnl_link_stats64): New functions.
(ifinfomsg_nla_decoders): New array.
(decode_ifinfomsg): Use it.
2017-08-28 10:41:54 +00:00
d45d71be06 Imply RVAL_DECODED when RVAL_IOCTL_PARSED is returned on entering
Also, rename RVAL_IOCTL_PARSED to RVAL_IOCTL_DECODED as the latter
is a more suitable name.

* defs.h (RVAL_IOCTL_PARSED): Rename to RVAL_IOCTL_DECODED.
* ioctl.c (ioctl_decode): Update comment.
(SYS_FUNC(ioctl)): Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED,
add convertation of RVAL_IOCTL_DECODED to RVAL_DECODED.
* block.c (block_ioctl): Replace RVAL_DECODED | RVAL_IOCTL_PARSED
with RVAL_IOCTL_DECODED on entering.  Replace RVAL_IOCTL_PARSED
with RVAL_IOCTL_DECODED on exiting.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c: Likewise.
* file_ioctl.c: Likewise.
* fs_x_ioctl.c: Likewise.
* hdio.c: Likewise.
* loop.c: Likewise.
* mtd.c: Likewise.
* nsfs.c: Likewise.
* print_sg_req_info.c: Likewise.
* ptp.c: Likewise.
* rtc.c: Likewise.
* scsi.c: Likewise.
* sg_io_v3.c: Likewise.
* sg_io_v4.c: Likewise.
* sock.c: Likewise.
* term.c: Likewise.
* ubi.c: Likewise.
* userfaultfd.c: Likewise.
* dm.c (dm_known_ioctl): Return RVAL_IOCTL_DECODED on exiting and 0
on entering.  Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED
on exiting.
* v4l2.c: Likewise.

Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-08-28 00:39:15 +00:00
3ca301fff8 Replace return 1 ioctl sub-decoder hack with proper flag
* defs.h (RVAL_IOCTL_PARSED): Introduce new flag for ioctl sub-decoders
* to signalise that they have successfully printed argument.
* ioctl.c (SYS_FUNC(ioctl)): Check for RVAL_IOCTL_PARSED flag, remove
un-set it before returning the value.
* block.c: Use RVAL_IOCTL_PARSED instead of 1.
* btrfs.c: Likewise.
* dm.c: Likewise.
* evdev.c: Likewise.
* file_ioctl.c: Likewise.
* fs_x_ioctl.c: Likewise.
* hdio.c: Likewise.
* loop.c: Likewise.
* mtd.c: Likewise.
* nsfs.c: Likewise.
* print_sg_req_info.c: Likewise.
* ptp.c: Likewise.
* rtc.c: Likewise.
* scsi.c: Likewise.
* sg_io_v3.c: Likewise.
* sg_io_v4.c: Likewise.
* sock.c: Likewise.
* term.c: Likewise.
* ubi.c: Likewise.
* userfaultfd.c: Likewise.
* v4l2.c: Likewise.
2017-08-28 02:33:20 +02:00
6e367ed223 v4l2: streamline logic
Move exiting path out of if (entering(tcp)) { ... return 0; } else,
provide common exit point in v4l2_ioctl handler, use break instead of
return in specific command handlers.

* v4l2.c (print_v4l2_format, print_v4l2_buffer, print_v4l2_standard,
print_v4l2_input, print_v4l2_frmivalenum): Move exiting path out of else
par of the entering(tcp) condition.
(v4l2_ioctl): Add return RVAL_DECODED | 1 at the end of function.
(v4l2_ioctl) <case VIDIOC_S_STD, case VIDIOC_S_INPUT>: Replace return
with break.
2017-08-28 02:33:20 +02:00
8c29b65f71 v4l2: reorder field printing in order to avoid auxstr usage
Also rework flow a little in order to reduce amount of indentation.

* v4l2.c (print_v4l2_requestbuffers): Print count as the last field on
entering, append it with updated value on exiting.
* tests/ioctl_v4l2.c: Update expected output.
2017-08-28 02:33:20 +02:00
d4555fd56e userfaultfd: streamline logic
Make userfaultfd ioctl handling more in line with other ioctl decoders.

* userfaultfd.c (uffdio_ioctl): Return RVAL_DECODED | 1, break instead
of returning in specific command handlers, return 0 on entering paths,
move exiting paths out of else branch of entering(tcp) condition.
2017-08-28 02:33:20 +02:00
abc0ad0442 Do not return RVAL_DECODED on exiting path of ioctl decoders
* print_sg_req_info.c (decode_sg_req_info): Return 1 instead of
RVAL_DECODED | 1 on exiting path.
* scsi.c (decode_sg_scsi_id): Likewise.
* sg_io_v3.c (decode_response): Likewise.
* sg_io_v4.c (decode_response): Likewise.
2017-08-28 02:33:20 +02:00
9885c967a4 dm: return RVAL_DECODED instead of 0 if we can't decode command
Return RVAL_DECODED if we can't decode command in order to avoid being
called on exiting.

* dm.c (dm_ioctl): Return RVAL_DECODED instead of 0 if command can't be
decoded.
2017-08-28 02:33:20 +02:00
3de6f8fe8a Return 0 instead of 1 on entering path of ioctl decoders
As returning 1 (without RVAL_DECODED) on entering makes no sense.

* block.c (block_ioctl) <case BLKTRACESETUP>: Replace return 1 with
return 0 on entering path.
* ptp.c (ptp_ioctl) <case PTP_SYS_OFFSET>: Likewise.
* sg_io_v3.c (decode_request): Likewise.
* sg_io_v4.c (decode_request): Likewise.
* sock.c (decode)ifconf, sock_ioctl) <case SIOCGIFMAP>: Likewise.
* ubi.c (ubi_ioctl) <case UBI_IOCMKVOL, case UBI_IOCATT>: Likewise.
* v4l2.c (print_v4l2_ext_controls): Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-28 02:33:20 +02:00
6e4aead09e ioctl: simplify ioctl_decode handling, document its return value semantics
* ioctl.s (SYS_FUNC(ioctl.c)): Unconditionally unset 1, simply print arg
when (ret & RVAL_DECODED) && !(ret & 1).
2017-08-28 02:33:20 +02:00
39f5a9cd2d syscall.c: define personality names for all multi-personality architectures
I see no reason for not having these definitions for SPARC64 and RISC-V.
Also, borrow the check template from supported_personalities.h.

* syscall.c (update_personality) [defined RISCV, defined SPARC64]
<PERSONALITY_NAMES>: Define it for these architectures.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-28 02:32:52 +02:00
f07e8ada33 copyright-year-gen: workaround for old git versions
Apply the same treatment to this script as the one in
v4.18-278-g295cf32.

* copyright-year-gen <year>: Change format to format:%cD, remove --date,
supply output as a -d option argument to date +%Y.
2017-08-28 02:31:33 +02:00
12087b7570 ubi: trim overly long lines 2017-08-27 11:06:14 +00:00
baabc17725 term: use print_quoted_string
* term.c (decode_termios): Use print_quoted_string for printing c_cc field
instead of writing the printing code by hand.
2017-08-27 11:06:14 +00:00
295cf322b1 update_copyright_years.sh: workaround for old git versions
Old git versions (like the one shipped in Debian 8) do not support setting
date format with --date, working this around by processing git log output
with date +%Y.

* main/update_copyright_years.sh (process_file) <first_commit_year,
last_commit_year>: Change format to format:%aD, remove --date, supply
output as a -d option argument to date +%Y.
2017-08-27 11:06:14 +00:00
dbf939d19d syscall: use spaces in tile personality names, de-duplicate definition
As Chris Metcalf, the author of v4.7-40-g0b99a8a, told in private, there
is no strong reason for having tile's personality name different from
personality names on other architectures, so let's use spaces instead of
dashes here. And, while we are here, remove duplication of personality
name definitions for various architectures.

* syscall.c (update_personality) [defined TILE]: Change dashes to spaces
in personality names.
2017-08-27 11:06:14 +00:00
bec0ab989d tests: check decoding of rtmsg netlink attributes
* tests/nlattr_rtmsg.c: Include <netinet/in.h> and <arpa/inet.h>.
(LWTUNNEL_ENCAP_NONE, RTA_ENCAP_TYPE): New macros.
(main): Check decoding of RTA_DST, RTA_OIF, RTA_METRICS, RTA_MULTIPATH,
RTA_CACHEINFO, RTA_MFC_STATS, RTA_VIA, and RTA_ENCAP_TYPE.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-26 23:09:09 +00:00
e8a856f4bd rtnl_route: decode rtmsg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for
rta_mfc_stats and rtvia structures in <linux/rtnetlink.h>.
* nlattr.c (decode_nla_ifindex): New function.
* nlattr.h (decode_nla_ifindex): New prototype.
* rtnl_route.c (decode_route_addr, decode_rta_metrics,
decode_rta_multipath, decode_rta_cacheinfo,
decode_rta_mfc_stats, decode_rtvia,
decode_rta_encap_type): New functions.
(rta_metrics_nla_decoders, rtmsg_nla_decoders): New arrays.
(decode_rtmsg): Use rtmsg_nla_decoders.
* xlat/lwtunnel_encap_types.in: New file.
* xlat/route_nexthop_flags.in: Likewise.
* xlat/rtnl_rta_metrics_attrs.in: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-26 16:45:18 +00:00
5634008d6e s390: wire up s390_guarded_storage syscall
* linux/s390/syscallent.h [378]: Add s390_guarded_storage entry.
* linux/s390x/syscallent.h: Likewise.
2017-08-25 15:57:14 +00:00
194a8bc7fa microblaze: wire up statx syscall
* linux/microblaze/syscallent.h [398]: Add statx entry.
2017-08-25 15:57:14 +00:00
1998f2666a alloc_number_set_array: add ATTRIBUTE_MALLOC
* number_set.h: Include "gcc_compat.h".
(alloc_number_set_array): Add ATTRIBUTE_MALLOC.
2017-08-24 18:24:16 +00:00
ff8e066b3c Add macros for testing QUAL_* flags
* defs.h (traced, raw, inject): Add macros for testing QUAL_TRACE,
QUAL_RAW, and QUAL_INJECT flags.
* syscall.c (syscall_entering_trace, syscall_exiting_trace): Use them.
2017-08-24 18:24:16 +00:00
19cf122dd6 Remove QUAL_SIGNAL, QUAL_READ and QUAL_WRITE
Remove these flags that are unused since commit v4.15~26.
They might be introduced later with a different meaning.

* defs.h (QUAL_SIGNAL, QUAL_READ, QUAL_WRITE): Remove.
2017-08-24 18:24:16 +00:00
7ba0d89c9f xstrdup, xtrndup: allow NULL argument
Accept NULL argument in xstrdup and xtrndup functions to allow use
of "xstrdup(str)" instead of "str ? xstrdup(str) : NULL".

* xmalloc.c (xstrdup, xstrndup): Handle NULL argument.
* xmalloc.h: Add comment regarding this deviation from the behaviour
of the POSIX counterparts of these functions.
2017-08-24 20:06:54 +02:00
2b786e0113 tests: really skip mips o32 scno tampering tests on mips n64
* tests/is_linux_mips_n64.c: New file.
* tests/Makefile.am (check_PROGRAMS): Add it.
* tests/scno_tampering.sh <$STRACE_ARCH == mips>:
In case of mips o32 abi, skip the test if is_linux_mips_n64 says
that the kernel is mips n64, even if "uname -m" claims it's mips.
2017-08-23 18:38:26 +00:00
5d7623a502 Hide struct number_set implementation details from users
* number_set.h (number_slot_t, struct number_set): Move to number_set.c.
(struct number_set): Add forward declaration.
(read_set, write_set, signal_set): Change prototypes from objects
to pointers.
* filter_qualify.c (read_set, write_set, signal_set): Change definitions
from objects to pointers.
(abbrev_set, inject_set, raw_set, trace_set, verbose_set): Change
definitions from arrays to pointers.
(qualify_read): Initialize read_set before first use.
(qualify_write): Initialize write_set before first use.
(qualify_signals): Initialize signal_set before first use.
(qualify_trace): Initialize trace_set before first use.
(qualify_abbrev): Initialize abbrev_set before first use.
(qualify_verbose): Initialize verbose_set before first use.
(qualify_raw): Initialize raw_set before first use.
(qualify_inject_common): Initialize inject_set before first use.
* strace.c (print_signalled, print_stopped): Update signal_set usage.
* syscall.c (dumpio): Update usage of read_set and write_set.
2017-08-22 21:23:49 +00:00
ef7b7a70c1 Extend number_set interface
* number_set.h (number_set_array_is_empty, is_number_in_set_array,
add_number_to_set_array, clear_number_set_array,
invert_number_set_array, alloc_number_set_array, free_number_set_array):
New function prototypes.
* number_set.c (number_set_array_is_empty, is_number_in_set_array,
add_number_to_set_array, clear_number_set_array,
invert_number_set_array, alloc_number_set_array, free_number_set_array):
New functions.
* basic_filters.c (qualify_syscall_number, qualify_syscall_regex,
qualify_syscall_class, qualify_syscall_name): Use
add_number_to_set_array.
(qualify_syscall_tokens, qualify_tokens): Use
clear_number_set_array and invert_number_set_array.
* filter_qualify.c (qualify_inject_common): Use alloc_number_set_array,
number_set_array_is_empty, is_number_in_set_array,
add_number_to_set_array, and free_number_set_array.
(qual_flags): Use is_number_in_set_array.
2017-08-22 21:23:49 +00:00
67c97082ac Move number_set interface to separate files
* number_set.c: New file.
* number_set.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* basic_filters.c: Include "number_set.h".
(number_slot_t, struct number_set): Move to number_set.h.
(BITS_PER_SLOT, number_setbit, number_isset, reallocate_number_set,
add_number_to_set, is_number_in_set): Move to number_set.c.
* defs.h (struct number_set): Remove forward declaration.
(read_set, write_set, signal_set, is_number_in_set): Move to number_set.h.
* filter.h (add_number_to_set): Move to number_set.h.
* filter_qualify.c: Include "number_set.h".
(number_slot_t, struct number_set): Remove.
* strace.c: Include "number_set.h".
* syscall.c: Likewise.
2017-08-22 21:23:49 +00:00
e398011d2b Move SUPPORTED_PERSONALITIES to a separate file
Since the defs.h contains unrelated declarations which are
redundant (and sometimes conflicting) for other binaries included
in the strace package, move SUPPORTED_PERSONALITIES defintions
to a separate file.

* defs.h: Include "supported_personalities.h".
(SUPPORTED_PERSONALITIES): Move ...
* supported_personalities.h: ... to the new file.
* Makefile.am (strace_SOURCES): Add it.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-22 15:24:05 +00:00
b1fab45b47 Move string_to_uint* functions to a separate file
Make string_to_uint* functions available to other binaries
included in the strace package.

* string_to_uint.h: New file.
* defs.h: Include it.
(string_to_uint_ex, string_to_uint_upto, string_to_uint): Move
to string_to_uint.h.
* util.c (string_to_uint_ex, string_to_uint): Move ...
* string_to_uint.c: ... to the new file.
* Makefile.am (strace_SOURCES): Add string_to_uint.h and string_to_uint.c.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-22 15:24:05 +00:00
bc9fd5ffb9 tests: check decoding of ifaddrmsg netlink attributes
* tests/nlattr_ifaddrmsg.c: Include <arpa/inet.h>.
(IFA_FLAGS, SET_IFA_FAMILY): New macros.
(init_ifaddrmsg): Set ifaddrmsg.ifa_family field from ifa_family.
(print_ifaddrmsg): Print ifaddrmsg.ifa_family field using ifa_family_str.
(main): Check decoding of IFA_ADDRESS, IFA_CACHEINFO, and IFA_FLAGS.
2017-08-22 11:39:03 +00:00
f076c78667 rtnl_addr: decode ifaddrmsg netlink attributes
* rtnl_addr.c (decode_ifa_address,
decode_ifa_cacheinfo, decode_ifa_flags): New functions.
(ifaddrmsg_nla_decoders): New array.
(decode_ifaddrmsg): Use it.
2017-08-22 11:39:03 +00:00
89cab1f000 Export decode_inet_addr
* defs.h (decode_inet_addr): New prototype.
* netlink_inet_diag.c (decode_inet_addr): Remove static keyword, move ...
* sockaddr.c: ... here.
2017-08-22 11:39:03 +00:00
7c6f8ad313 netlink_inet_diag: prepare decode_inet_addr for export
* netlink_inet_diag.c (decode_inet_addr): Change return type to bool,
parametrize field name using new var_name argument.
(decode_inet_diag_hostcond): Specify "addr" field name
to decode_inet_addr.
2017-08-22 11:39:03 +00:00
b3cbf90920 print_inet_addr: add support of invocations without field name
Prepare print_inet_addr for use in structureless contexts where
no structure field name is available.

* sockaddr.c (print_inet_addr): Handle var_name == NULL.
2017-08-20 11:10:03 +00:00
6a54605010 print_inet_addr: print address of unsupported family in hex
* sockaddr.c (print_inet_addr): Specify QUOTE_FORCE_HEX
to print_quoted_string.
2017-08-19 11:04:00 +00:00
25f91fd854 mips o32: do not bail out in get_syscall_args if umoven fails
If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3,
both PTRACE_PEEKDATA and process_vm_readv become unavailable when the
process dumpable flag is cleared.  As the first 4 syscall arguments are
still available via registers, do not treat this as get_syscall_args
error.

This condition is triggered and therefore tested by prctl-dumpable test.

* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSO32]:
Do not bail out if umoven fails.
2017-08-18 14:30:08 +00:00
dac32d406f configure: cleanup struct statfs/statfs64 member checks
* configure.ac <AC_CHECK_TYPES([struct statfs])>: Merge several
AC_CHECK_MEMBERS checks of struct statfs members into a single check.
<AC_CHECK_TYPES([struct statfs64])>: Likewise, for checks
of struct statfs64 members.
2017-08-17 12:43:18 +00:00
1cd860cc6c tests: fix a few harmless -Woverflow compilation warnings
Fix the following compilation warnings on platforms where
sizeof(struct timeval.tv_usec) < sizeof(long):

xettimeofday.c: In function ‘main’:
xettimeofday.c:76:16: warning: overflow in implicit constant conversion [-Woverflow]
  tv->tv_usec = (long) 0xbadc0dedfacefeedLL;
xetitimer.c: In function ‘main’:
xetitimer.c:170:28: warning: overflow in implicit constant conversion [-Woverflow]
  p_new->it_value.tv_usec = (long) 0xbadc0dedfacefeedLL;
In file included from utimes.c:38:0:
xutimes.c: In function ‘main’:
xutimes.c:110:18: warning: overflow in implicit constant conversion [-Woverflow]
  tv[1].tv_usec = (long) 0xbadc0dedfacefeedLL;
futimesat.c: In function ‘main’:
futimesat.c:121:18: warning: overflow in implicit constant conversion [-Woverflow]
  tv[1].tv_usec = (long) 0xbadc0dedfacefeedLL;
In file included from _newselect.c:35:0:
xselect.c: In function ‘main’:
xselect.c:94:16: warning: overflow in implicit constant conversion [-Woverflow]
  tv->tv_usec = (long) 0xbadc0dedfacefeedLL;
                ^
* tests/futimesat.c (main): In initialization of struct timeval.tv_usec,
change explicit cast from (long) to (suseconds_t).
* tests/xetitimer.c: Likewise.
* tests/xettimeofday.c: Likewise.
* tests/xselect.c: Likewise.
* tests/xutimes.c: Likewise.

Reported-by: Anatoly Pugachev <matorola@gmail.com>
2017-08-16 17:50:25 +00:00
06c4151a49 tests: fix sigaction.test on sparc
On sparc, the first argument of old sigaction syscall has negated
semantics, compared to other architectures.  While sigaction.test
was aware about this arch-specific detail from the beginning, in one
of many sigaction syscall invocations a non-negative signal number
was erroneously passed on sparc.

* tests/sigaction.c (ADDR_INT, SIGNO_INT): New arch-specific macros.
(signo, addr): Use them.
2017-08-16 16:25:03 +00:00
239418b7f8 nlattr: fix printing of unrecognized attribute data
Do not print more than "nlattr.nla_len - NLA_HDRLEN" bytes
of unrecognized attribute data.

* nlattr.c (decode_nlattr_with_data): Specify "nla_len - NLA_HDRLEN"
instead of "len - NLA_HDRLEN" as the size of unrecognized attribute
data.
* tests/nlattr.c (test_nlattr): Check it.
2017-08-16 02:24:29 +00:00
c7946d380f tests: check decoding of NETLINK_ROUTE rtgenmsg attributes
* tests/nlattr_rtgenmsg.c: New file.
* tests/gen_tests.in (nlattr_rtgenmsg): New entry.
* tests/pure_executables.list: Add nlattr_rtgenmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
b9afb63fd7 netlink: add basic decoding of NETLINK_ROUTE rtgenmsg attributes
* rtnl_nsid.c: Include "nlattr.h" and "xlat/rtnl_nsid_attrs.h".
(decode_rtgenmsg): Call decode_nlattr.
* xlat/rtnl_nsid_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
4c1e85025f tests: check decoding of NETLINK_ROUTE br_port_msg attributes
* tests/nlattr_br_port_msg.c: New file.
* tests/gen_tests.in (nlattr_br_port_msg): New entry.
* tests/pure_executables.list: Add nlattr_br_port_msg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
a4ae112a42 netlink: add basic decoding of NETLINK_ROUTE br_port_msg attributes
* rtnl_mdb.c: Include "netlink.h", "nlattr.h".
and "xlat/rtnl_mdb_attrs.h".
(decode_br_port_msg): Call decode_nlattr.
* xlat/rtnl_mdb_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
ef4feccbad tests: check decoding of NETLINK_ROUTE netconfmsg attributes
* tests/nlattr_netconfmsg.c: New file.
* tests/gen_tests.in (nlattr_netconfmsg): New entry.
* tests/pure_executables.list: Add nlattr_netconfmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
1569f4cfe5 netlink: add basic decoding of NETLINK_ROUTE netconfmsg attributes
* rtnl_netconf.c: Include "netlink.h", "nlattr.h",
and "xlat/rtnl_netconf_attrs.h".
(decode_netconfmsg): Call decode_nlattr.
* xlat/rtnl_netconf_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
3d27e43d82 tests: check decoding of NETLINK_ROUTE dcbmsg attributes
* tests/nlattr_dcbmsg.c: New file.
* tests/gen_tests.in (nlattr_dcbmsg): New entry.
* tests/pure_executables.list: Add nlattr_dcbmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
1c3e1828dc netlink: add basic decoding of NETLINK_ROUTE dcbmsg attributes
* rtnl_dcb.c: Include "netlink.h", "nlattr.h",
and "xlat/rtnl_dcb_attrs.h".
(decode_dcbmsg): Call decode_nlattr.
* xlat/rtnl_dcb_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
a93b5fa242 tests: check decoding of NETLINK_ROUTE ifaddrlblmsg attributes
* tests/nlattr_ifaddrlblmsg.c: New file.
* tests/gen_tests.in (nlattr_ifaddrlblmsg): New entry.
* tests/pure_executables.list: Add nlattr_ifaddrlblmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
52a55f2081 netlink: add basic decoding of NETLINK_ROUTE ifaddrlblmsg attributes
* rtnl_addrlabel.c: Include "netlink.h", "nlattr.h",
and "xlat/rtnl_addrlabel_attrs.h".
(decode_ifaddrlblmsg): Call decode_nlattr.
* xlat/rtnl_addrlabel_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
2795dde450 tests: check decoding of NETLINK_ROUTE tcamsg attributes
* tests/nlattr_tcamsg.c: New file.
* tests/gen_tests.in (nlattr_tcamsg): New entry.
* tests/pure_executables.list: Add nlattr_tcamsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
41d9c32e95 netlink: add basic decoding of NETLINK_ROUTE tcamsg attributes
* rtnl_tc_action.c: Include "nlattr.h" and "xlat/rtnl_tc_action_attrs.h".
(decode_tcamsg): Call decode_nlattr.
* xlat/rtnl_tc_action_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
7506c69c3a tests: check decoding of NETLINK_ROUTE tcmsg attributes
* tests/nlattr_tcmsg.c: New file.
* tests/gen_tests.in (nlattr_tcmsg): New entry.
* tests/pure_executables.list: Add nlattr_tcmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
52eccecda5 netlink: add basic decoding of NETLINK_ROUTE tcmsg attributes
* rtnl_tc.c: Include "nlattr.h" and "xlat/rtnl_tc_attrs.h".
(decode_tcmsg): Call decode_nlattr.
* xlat/rtnl_tc_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
72f13278be tests: check decoding of NETLINK_ROUTE ndtmsg attributes
* tests/nlattr_ndtmsg.c: New file.
* tests/gen_tests.in (nlattr_ndtmsg): New entry.
* tests/pure_executables.list: Add nlattr_ndtmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
46e2c5226a netlink: add basic decoding of NETLINK_ROUTE ndtmsg attributes
* rtnl_neightbl.c: Include "nlattr.h" and "xlat/rtnl_neightbl_attrs.h".
(decode_ndtmsg): Call decode_nlattr.
* xlat/rtnl_neightbl_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
daf21282d1 tests: check decoding of NETLINK_ROUTE ndmsg attributes
* tests/nlattr_ndmsg.c: New file.
* tests/gen_tests.in (nlattr_ndmsg): New entry.
* tests/pure_executables.list: Add nlattr_ndmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
eede641dd2 netlink: add basic decoding of NETLINK_ROUTE ndmsg attributes
* rtnl_neigh.c: Include "nlattr.h" and "xlat/rtnl_neigh_attrs.h".
(decode_ndmsg): Call decode_nlattr.
* xlat/rtnl_neigh_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
848cbc422b tests: check decoding of NETLINK_ROUTE fib_rule_hdr attributes
* tests/nlattr_fib_rule_hdr.c: New file.
* tests/gen_tests.in (nlattr_fib_rule_hdr): New entry.
* tests/pure_executables.list: Add nlattr_fib_rule_hdr.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
4ee22cabea netlink: add basic decoding of NETLINK_ROUTE fib_rule_hdr attributes
* rtnl_rule.c: Include "nlattr.h" and "xlat/rtnl_rule_attrs.h".
(decode_fib_rule_hdr): Call decode_nlattr.
* xlat/rtnl_rule_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
747cdf790d tests: check decoding of NETLINK_ROUTE rtmsg attributes
* tests/nlattr_rtmsg.c: New file.
* tests/gen_tests.in (nlattr_rtmsg): New entry.
* tests/pure_executables.list: Add nlattr_rtmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
955b69cb79 netlink: add basic decoding of NETLINK_ROUTE rtmsg attributes
* rtnl_route.c: Include "nlattr.h" and "xlat/rtnl_route_attrs.h".
(decode_rtmsg): Call decode_nlattr.
* xlat/rtnl_route_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
ea9d07f0bf tests: check decoding of NETLINK_ROUTE ifaddrmsg attributes
* tests/nlattr_ifaddrmsg.c: New file.
* tests/gen_tests.in (nlattr_ifaddrmsg): New entry.
* tests/pure_executables.list: Add nlattr_ifaddrmsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
7e15bde453 netlink: add basic decoding of NETLINK_ROUTE ifaddrmsg attributes
* rtnl_addr.c: Include "nlattr.h" and "xlat/rtnl_addr_attrs.h".
(decode_ifaddrmsg): Call decode_nlattr.
* xlat/rtnl_addr_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
cbe8ddd2db tests: check decoding of NETLINK_ROUTE ifinfomsg attributes
* tests/nlattr_ifinfomsg.c: New file.
* tests/gen_tests.in (nlattr_ifinfomsg): New entry.
* tests/pure_executables.list: Add nlattr_ifinfomsg.
* tests/.gitignore: Likewise.
2017-08-15 22:34:46 +00:00
d15343ad2c netlink: add basic decoding of NETLINK_ROUTE ifinfomsg attributes
* rtnl_link.c: Include "nlattr.h" and "xlat/rtnl_link_attrs.h".
(decode_ifinfomsg): Call decode_nlattr.
* xlat/rtnl_link_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-15 22:34:46 +00:00
a10961a9e1 tests/test_nlattr.h: include <stdint.h>
* tests/test_nlattr.h: Include <stdint.h> for definition of uint16_t
used by init_nlattr.
2017-08-15 22:34:46 +00:00
77edc3a42e tests: use ifindex_lo and IFINDEX_LO_STR
* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_compat.c: Do not check
for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(init_inet_diag_req_v2, print_inet_diag_req_v2,
test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
use IFINDEX_LO_STR instead of hardcoded string.
* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
(if_nametoindex, IFINDEX_LO): Remove.
(main): Use ifindex_lo instead of if_nametoindex.
(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
string.
2017-08-15 20:08:39 +00:00
579d1c69da tests/net-sockaddr: use ifindex_lo and IFINDEX_LO_STR
* tests/net-sockaddr.c (if_nametoindex): Remove declaration.
(check_in6_linklocal, check_ll): Remove HAVE_IF_INDEXTONAME checks,
Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR instead
of hardcoded string.
2017-08-15 20:08:39 +00:00
e72d776a77 tests/msg_control: use ifindex_lo and IFINDEX_LO_STR
* tests/msg_control.c (test_ip_pktinfo): Use ifindex_lo instead
of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
2017-08-15 20:08:39 +00:00
4e82a67f5f tests/inet-cmsg: use IFINDEX_LO_STR
* tests/inet-cmsg.c (print_pktinfo): Use IFINDEX_LO_STR instead
of hardcoded string.
2017-08-15 20:08:39 +00:00
0891e131c7 tests/ip_mreq: use ifindex_lo and IFINDEX_LO_STR
* tests/ip_mreq.c: Do not check for HAVE_IF_INDEXTONAME.
(main): Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR
instead of hardcoded string.
2017-08-15 20:08:39 +00:00
a9660f8eb1 tests/group_req: use ifindex_lo and IFINDEX_LO_STR
* tests/group_req.c: Do not check for HAVE_IF_INDEXTONAME.
(main): Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR
instead of hardcoded string.
2017-08-15 20:08:39 +00:00
23d470d3c0 tests: add ifindex_lo function and IFINDEX_LO_STR macro to libtests
* tests/ifindex.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (ifindex_lo): New prototype.
(IFINDEX_LO_STR): New macro.
2017-08-15 20:08:39 +00:00
ca2e93ec05 configure.ac: remove redundant linux/dcbnl.h header check
* configure.ac (AC_CHECK_HEADERS): Remove linux/dcbnl.h.
* rtnl_dcb.c: Replace HAVE_LINUX_DCBNL_H with HAVE_STRUCT_DCBMSG.
* tests/netlink_route.c: Likewise.
2017-08-15 09:13:19 +00:00
c743483805 pathtrace: fix typo in comment 2017-08-14 11:33:26 +00:00
456c95cdc2 pathtrace: limit amount of checked poll fds similarly to select limit
* pathtrace.c (pathtrace_match_set): Limit the maximum descriptor number
checked for fd match in poll family syscalls to 1024 * 1024.
2017-08-14 11:33:26 +00:00
b94e67bddc pathtrace: fail poll path match on first failed umove
* pathtrace.c (pathtrace_match_set): When checking descriptors of poll
family syscalls for fd match, break the loop on first failed umove call.
2017-08-14 11:33:26 +00:00
418dd0e7db Update NEWS 2017-08-14 01:10:33 +00:00
a95799f95d tests: check decoding of rtnetlink nsid messages
* tests/netlink_route.c (test_rtnl_nsid): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:10:33 +00:00
40cc373702 netlink: add a basic rtnetlink parser of nsid messages
* rtnl_nsid.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_rtgenmsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_DELNSID, RTM_GETNSID,
and RTM_NEWNSID.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:10:21 +00:00
bc8e89fbb8 tests: check decoding of rtnetlink mdb messages
* tests/netlink_route.c: Include <netinet/in.h>
and <linux/if_bridge.h>.
(test_rtnl_mdb): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:10:21 +00:00
063ff93846 netlink: add a basic rtnetlink parser of mdb messages
* rtnl_mdb.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_br_port_msg): New prototype.
* configure.ac (AC_CHECK_TYPES): Check for struct br_port_msg
in <linux/if_bridge.h>.
* netlink_route.c (route_decoders): Add RTM_DELMDB, RTM_GETMDB,
and RTM_NEWMDB.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:59 +00:00
6d4f3fc075 tests: check decoding of rtnetlink netconf messages
* tests/netlink_route.c: Include <linux/netconf.h>.
(test_rtnl_netconf): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:59 +00:00
b51ed22cee netlink: add a basic rtnetlink parser of netconf messages
* rtnl_netconf.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_netconfmsg): New prototype.
* configure.ac (AC_CHECK_TYPES): Check for struct netconfmsg
in <linux/netconf.h>.
* netlink_route.c (route_decoders): Add RTM_GETNETCONF
and RTM_NEWNETCONF.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:51 +00:00
9120212f66 tests: check decoding of rtnetlink dcb messages
* tests/netlink_route.c: Include <linux/dcbnl.h>.
(test_rtnl_dcb): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:51 +00:00
b658e89812 netlink: add a basic rtnetlink parser of dcb messages
* rtnl_dcb.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_dcbmsg): New prototype.
* configure.ac (AC_CHECK_HEADERS): Add linux/dcbnl.h.
(AC_CHECK_TYPES): Check for struct dcbmsg in <linux/dcbnl.h>.
* netlink_route.c (route_decoders): Add RTM_GETDCB and RTM_SETDCB.
* xlat/dcb_commands.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:44 +00:00
32c12cbe03 tests: check decoding of rtnetlink addrlabel messages
* tests/netlink_route.c: Include <linux/if_addrlabel.h>.
(test_rtnl_addrlabel): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:44 +00:00
e14b4df304 netlink: add a basic rtnetlink parser of addrlabel messages
* rtnl_addrlabel.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_ifaddrlblmsg): New prototype.
* configure.ac (AC_CHECK_TYPES): Check for struct ifaddrlblmsg
in <linux/if_addrlabel.h>.
* netlink_route.c (route_decoders): Add RTM_DELADDRLABEL,
RTM_GETADDRLABEL, and RTM_NEWADDRLABEL.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:16 +00:00
e729e3f0d0 tests: check decoding of rtnetlink tc action messages
* tests/netlink_route.c (test_rtnl_tca): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:16 +00:00
a144fd0287 netlink: add a basic rtnetlink parser of tc action messages
* rtnl_tc_action.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_tcamsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_DELACTION, RTM_GETACTION,
and RTM_NEWACTION.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:11 +00:00
49e09c5cb9 tests: check decoding of rtnetlink tc messages
* tests/netlink_route.c (test_rtnl_tc): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:10 +00:00
88f9942407 netlink: add a basic rtnetlink parser of tc messages
* rtnl_tc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_tcmsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_DELQDISC,
RTM_GETQDISC, RTM_NEWQDISC, RTM_DELTCLASS, RTM_GETTCLASS,
RTM_NEWTCLASS, RTM_DELTFILTER, RTM_GETTFILTER, and RTM_NEWTFILTER.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:02 +00:00
e87297d102 tests: check decoding of rtnetlink neightbl messages
* tests/netlink_route.c (test_rtnl_neightbl): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:09:02 +00:00
00e48349a9 netlink: add a basic rtnetlink parser of neightbl messages
* rtnl_neightbl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_ndtmsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_GETNEIGHTBL,
RTM_NEWNEIGHTBL, and RTM_SETNEIGHTBL.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:59 +00:00
9f22c62767 tests: check decoding of rtnetlink neigh messages
* tests/netlink_route.c: Include <linux/neighbour.h>.
(test_rtnl_neigh): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:59 +00:00
8f3b3e6578 netlink: add a basic rtnetlink parser of neigh messages
* rtnl_neigh.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_ndmsg, decode_rtm_getneigh): New prototypes.
* configure.ac (AC_CHECK_HEADERS): Add linux/neighbour.h.
* netlink_route.c (route_decoders): Add RTM_DELNEIGH, RTM_DELNEIGH,
and RTM_NEWNEIGH.
* xlat/nda_types.in: New file.
* xlat/neighbor_cache_entry_flags.in: Likewise.
* xlat/neighbor_cache_entry_states.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:07 +00:00
50b2249877 tests: check decoding of rtnetlink rule messages
* tests/netlink_route.c: Include <linux/fib_rules.h>.
(test_rtnl_rule): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:07:07 +00:00
a0d3f258d0 netlink: add a basic rtnetlink parser of rule messages
* defs.h (routing_table_ids): New xlat prototype.
* rtnl_rule.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (ip_type_of_services, routing_table_ids): New xlat prototypes.
* netlink_route.h (decode_fib_rule_hdr): New prototype.
* configure.ac (AC_CHECK_HEADERS): Add linux/fib_rules.h.
* netlink_route.c (route_decoders): Add RTM_DELRULE, RTM_GETRULE,
and RTM_NEWRULE.
* xlat/fib_rule_actions.in: New file.
* xlat/fib_rule_flags.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:59 +00:00
a114dd92fe tests: check decoding of rtnetlink route messages
* tests/netlink_route.c: Include <linux/ip.h>.
(test_rtnl_route): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:59 +00:00
0ca787b5ba netlink: add a basic rtnetlink parser of route messages
* defs.h (routing_scopes): New xlat prototype.
* rtnl_route.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* netlink_route.h (decode_rtmsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_DELROUTE, RTM_GETROUTE,
and RTM_NEWROUTE.
* xlat/ip_type_of_services.in: New file.
* xlat/routing_flags.in: Likewise.
* xlat/routing_protocols.in: Likewise.
* xlat/routing_table_ids.in: Likewise.
* xlat/routing_types.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:38 +00:00
0a3ebb0443 tests: check decoding of rtnetlink addr messages
* tests/netlink_route.c: Include <linux/if_addr.h>.
(test_rtnl_addr): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-14 01:06:38 +00:00
3226d22ffc netlink: add a basic rtnetlink parser of addr messages
* rtnl_addr.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Add linux/if_addr.h.
* netlink_route.h (decode_ifaddrmsg): New prototype.
* netlink_route.c (route_decoders): Add RTM_DELADDR,
RTM_GETADDR, RTM_GETANYCAST, RTM_GETMULTICAST, and RTM_NEWADDR.
* xlat/ifaddrflags.in: New file.
* xlat/routing_scopes.in: Likewise.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-13 23:01:46 +00:00
d720877b1f Make description of discrepancies between libc and kernel APIs more relevant
Looks like this part was untouched since the days strace supported OSes
other than Linux. Well, it's time to make it more contemporary.

* strace.1.in (.SH NOTES): Use faccessat(2) and setrlimit(2)/prlimit(2)
instead of time(2) and stat(2)/xstat(2) as examples of libc/kernel API
discrepancies.
2017-08-14 00:29:15 +02:00
7d216d508e tests: check decoding of NLMSG_DONE messages of NETLINK_ROUTE
* tests/netlink_route.c (test_nlmsg_done): New function.
(main): Use it.
2017-08-11 15:50:14 +00:00
86259ebb47 Add TF flag to inotify_add_watch syscall entries
The second argument of the inotify_add_watch syscall is a file name,
but inotify_add_watch has no TF flag set.

* linux/32/syscallent.h (inotify_add_watch): Add TF flag.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2017-08-11 10:48:38 +00:00
71712fea8b pathtrace: fix matching of execveat syscall
* pathtrace.c (pathtrace_match_set): Add testing of SEN_execveat.
2017-08-11 10:48:38 +00:00
87fd823df9 strace.1: add indentation to examples
* strace.1 (.de CW): Add .in +4n.
(.de CE): Add .in.
2017-08-10 21:36:01 +02:00
23bd66bfee Generate date for the man page
* Makefile.am (dist-hook): Add .strace.1.in.date generation.
* strace.spec.in (%setup): Likewise.
* configure.ac (manpage_date): New m4 define.
(MANPAGE_DATE): New define/subst.
* strace.1 (.TH): Add manpage date and strace's version.
2017-08-10 21:36:01 +02:00
189320c6c7 Add script for generating date of the last commit for specific file
* file-date-gen: New auxiliary script.
2017-08-10 21:36:01 +02:00
4f9270f0c5 Make strace.1 generated
* .gitignore (/strace.1): New entry.
* configure.ac (AC_CONFIG_FILES): Add strace.1.
* strace.1.in: Rename from strace.1.
2017-08-10 21:36:01 +02:00
e552b7b765 strace.1: format synopsis using .SY/.OP macros
Also, add .OM and .OR macros and use { ... | ... } syntax for indicating
possible options regarding mandatory arguments.

* strace.1 (.OM, .OR): New macro definitions, based on .OP
(.SH SYNOPSYS): Format using .SY/.OP/.OM/.OR. Put -p/command inside
{ ... | ... } block.
2017-08-10 21:36:01 +02:00
718804ae95 strace.1: remove date from .TH, as it is no longer relevant
* strace.1 (.TH): Remove date.
2017-08-10 21:33:33 +02:00
59bbc6507b strace.1: remove .IX definition
It is present in groff macros nowadays.

* strace.1 (.de IX): Remove.
2017-08-10 21:33:27 +02:00
edd2189a05 strace.1: replace .TP with .TQ between command-line option variants
In order to eliminate unneeded space between them.

* strace.1 (Filtering): Replace .TP with .TQ between different variants
of the same option.
2017-08-10 20:51:22 +02:00
c81ad544ae rtnl_link: include "netlink.h" before <linux/rtnetlink.h>
<sys/socket.h> has to be included before <linux/netlink.h> because
the latter used to be incomplete in older kernel headers.

As a local wrapper file called netlink.h was introduced earlier
to workaround this and related portability issues, include it before
<linux/rtnetlink.h> that in turn includes <linux/netlink.h>.

This fixes build on systems with older kernel headers.

* rtnl_link.c: Include "netlink.h" before <linux/rtnetlink.h>.
2017-08-09 13:24:13 +00:00
fc15305b9f tests: check decoding of rtnetlink link messages
* tests/netlink_route.c: Include <linux/if_arp.h>.
(TEST_NL_ROUTE): New macro.
(test_rtnl_link): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 00:43:49 +00:00
b955f683f4 netlink: add a basic rtnetlink parser of link messages
* netlink_route.h: New file.
* rtnl_link.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* defs.h (arp_hardware_types, iffflags): New xlat prototypes.
* netlink_route.c: Include "netlink_route.h"
and <linux/rtnetlink.h>.
(netlink_route_decoder_t): New typedef.
(route_decoders): New array.
(decode_netlink_route): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 00:43:49 +00:00
4c437e1856 Move nl_route_types definition from netlink.c to netlink_route.c
The side effect of #include "xlat/nl_route_types.h" is
RTM_* constants properly defined in that header file.
While netlink.c does not use these constants itself,
netlink_route.c is going to need them soon.

* defs.h (nl_route_types): New xlat prototype.
* netlink.c: Move inclusion of "xlat/nl_route_types.h" ...
* netlink_route.c: ... here.
2017-08-09 08:43:49 +08:00
7f95ee6017 tests: check netlink family specific decoder of NETLINK_ROUTE
* tests/netlink_route.c: Include <stdint.h>,
include "test_netlink.h" instead of "netlink.h".
(test_rtnl_unspec): New function.
(main): Use it.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 08:43:34 +08:00
670390ac71 netlink: introduce family specific decoder of NETLINK_ROUTE
* netlink_route.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink_route): New prototype.
* netlink.c (netlink_decoders): Add NETLINK_ROUTE.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-08-09 08:18:43 +08:00
474031e41b tests: check decoding of NETLINK_KOBJECT_UEVENT messages
* tests/netlink_kobject_uevent.c: New file.
* tests/gen_tests.in (netlink_kobject_uevent): New entry.
* tests/pure_executables.list: Add netlink_kobject_uevent.
* tests/.gitignore: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-08 16:36:59 +00:00
6555267d92 netlink: add decoding of NETLINK_KOBJECT_UEVENT messages
* netlink.c (decode_netlink): Print NETLINK_KOBJECT_UEVENT messages
as a string using printstrn.
2017-08-08 16:36:59 +00:00
338f0592ae netlink: call get_fd_nl_family before nlmsghdr decoding
Prepare for decoding of NETLINK_KOBJECT_UEVENT.  Messages of the latter,
unlike traditional netlink families, don't contain a header at all.

* netlink.c (NL_FAMILY_*): Remove enum.
(get_fd_nl_family): Replace NL_FAMILY_ERROR with -1.
(decode_nlmsg_type): Update the comment.
Skip family specific type decoders for type < NLMSG_MIN_TYPE.
(decode_nlmsghdr_with_payload): Skip family specific decoders
for type < NLMSG_MIN_TYPE && type != NLMSG_DONE.
(print_nlmsghdr): Move get_fd_nl_family invocation ...
(decode_nlmsghdr_with_payload): ... here.
2017-08-08 16:36:59 +00:00
15cc2f5364 Make sysent_shorthand_defs.h suitable for tests
* sysent_shorthand_defs.h [STRACE_TESTS_H]: Add shorthand notations from
tests/ksysent.c and tests/nsyscalls.c.
* tests/ksysent.c: Remove shorthand notations.
* tests/nsyscalls.c: Likewise.
2017-08-07 12:49:44 +00:00
3d565ef25a Move sysent shorthand notations to separate files
Avoid proliferation of exactly the same definitions of shorthand
notations for macros defined in sysent.h by moving definitions
and undefs of these shorthand notations to separate files.

* sysent_shorthand_defs.h: New file.
* sysent_shorthand_undefs.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* syscall.c: Use them.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-07 12:49:44 +00:00
f9638667ee netlink.c: fix indentation
* netlink.c (print_cookie): Fix indentation.
2017-08-07 12:48:20 +00:00
b4f16886e7 Move err/mem subroutines to separate files
In order to allow usage of utility functions by other binaries
included in the strace package (like the upcoming asinfo utility),
these functions should be moved to separate files.

* error_prints.h: New file.
* xmalloc.h: Likewise.
* defs.h: Include "xmalloc.h" and "error_prints.h".
(error_msg, error_msg_and_die, error_msg_and_help, perror_msg,
perror_msg_and_die): Move to error_prints.h.
(xcalloc, xmalloc, xreallocarray, xstrdup, xstrndup): Move to xmalloc.h.
* strace.c (die): Remove static quialifier to make visible
by error_prints.c.
(error_msg, error_msg_and_die, error_msg_and_help, perror_msg,
perror_msg_and_die, verror_msg): Move ...
* error_prints.c: ... to the new file.
* xmalloc.c: Include "config.h", <stdlib.h>, <string.h>,
"error_prints.h", and "xmalloc.h" instead of "defs.h".
Use int instead of bool.  Fix codestyle.
* Makefile.am (strace_SOURCES): Add error_prints.c, error_prints.h,
and xmalloc.h.

Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2017-08-07 10:59:22 +00:00
35c006d93c tests: move check_* functions from options-syntax.test to separate file
* tests/options-syntax.test: Move check_* functions to ...
* tests/syntax.sh: ... new file.
* tests/Makefile.am (EXTRA_DIST): Add syntax.sh.
2017-08-07 03:22:26 +00:00
b75c5b14e7 Split qualify.c into basic_filters.c and filter_qualify.c
This change also exports add_number_to_set, qualify_tokens,
and qualify_syscall_tokens.

* basic_filters.c: New file, part of qualify.c.
* filter_qualify.c: Likewise.
* filter.h: New file.
* qualify.c: Remove.
* Makefile.am (strace_SOURCES): Add new files, remove qualify.c.
2017-08-07 03:01:30 +00:00
330f4633d5 Simplify handling of unexpected tracees
* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
Remove the dance around possible re-injection of WSTOPSIG(status)
as the only observable stop here is the initial ptrace-stop.
2017-08-06 15:10:56 +00:00
7a35b711df Fix handling of unexpected tracees when PTRACE_SEIZE is not in use
* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
The expected ptrace stop signal in case of !use seize is not
syscall_trap_sig but SIGSTOP.  An idea of using PTRACE_GETSIGINFO to
distinguish signal stops that should be re-injected from other kinds
of stops didn't work out due to kernel implementation peculiarities
of initial ptrace-stop.
2017-08-06 13:27:07 +00:00
10360644ca pathtrace: fix matching of symlinkat syscall
* pathtrace.c (pathtrace_match_set) <SEN_symlinkat>: The first argument
of symlinkat syscall is not a path but an arbitrary string, ignore it.
2017-08-06 12:39:56 +00:00
f027d33049 pathtrace: fix missing syscalls
* pathtrace.c (pathtrace_match_set): Fix symlink decoding,
disable pathtracing for inotify_init.
2017-08-06 12:39:56 +00:00
255bc6fded Enhance fflush error diagnostics
* strace.c (flush_tcp_output): New function.
(line_ended, droptcb, print_event_exit): Use it to flush tcp->outf.
* tests/fflush.c: New file.
* tests/fflush.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
* tests/.gitignore: Add fflush.
* tests/pure_executables.list: Likewise.
2017-08-06 11:26:52 +00:00
a93e2de99e tests: check handling of CLONE_PARENT'ed and CLONE_PTRACE'ed processes
* tests/clone_parent.c: New file.
* tests/clone_ptrace.c: Likewise.
* tests/clone_parent.test: New test.
* tests/clone_ptrace.test: Likewise.
* tests/.gitignore: Add clone_parent and clone_ptrace.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add clone_parent.test and clone_ptrace.test.
2017-08-06 00:23:20 +00:00
d874bbf61e tests: export a path to the trace executable to check_PROGRAMS
* tests/init.sh (STRACE_EXE): Initialize from $STRACE and export.
2017-08-06 00:23:20 +00:00
7d56c3d808 Makefile.am: build top directory first
This solves potential issues when tests run first and strace is rebuilt
only after they have finished.  As noted in [1], providing the current
directory explicitly should help.

[1] https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html

* Makefile.am (SUBDIRS): Prepend the current directory.
2017-08-05 21:26:35 +00:00
1b93f4032a Improve handling of unexpected tracees
When receiving a ptrace stop of an unexpected child, handle it
in the most transparent way possible:
- detach it instead of PTRACE_CONT'ing;
- send it the signal with which it has been stopped.
This should hopefully help to deal with processes that have been created
with misused CLONE_PTRACE flag set.

* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
Calculate the signal similarly to the way next_event does,
forward it to the unexpected tracee, and detach the tracee.
2017-08-05 21:26:35 +00:00
17f095a945 tests: fix unaligned access in nlattr.test
* tests/nlattr.c (test_nlattr): Use SET_STRUCT
to initialize potentially unaligned struct nlattr.
2017-08-04 19:08:27 +00:00
8bf63c5ec7 tests: fix unaligned access in nlattr_packet_diag_msg.test
* tests/nlattr_packet_diag_msg.c (init_packet_diag_msg): Use SET_STRUCT
to initialize potentially unaligned struct packet_diag_msg.
2017-08-04 19:06:49 +00:00
9284ce55f0 sparc64: do not bail out in get_scno if PTRACE_PEEKTEXT fails
If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3,
PTRACE_PEEKTEXT becames unavailable when the process dumpable flag is
cleared.  As this is not a fatal condition for get_scno, do not bail out
if PTRACE_PEEKTEXT fails.

This condition is triggered and therefore tested by prctl-dumpable test.

* linux/sparc64/get_scno.c (arch_get_scno): Do not bail out
if PTRACE_PEEKTEXT fails.
2017-08-04 18:47:59 +00:00
92ac75f6f4 tests: enhance test coverage of printstrn and umoven
* tests/printstrn-umoven.c: New file.
* tests/printstrn-umoven-peekdata.c: Likewise.
* tests/printstrn-umoven-undumpable.c: Likewise.
* tests/printstrn-umoven-legacy.test: New test.
* tests/Makefile.am (MISC_TESTS): Add printstrn-umoven-legacy.test.
* tests/gen_tests.in (printstrn-umoven, printstrn-umoven-peekdata,
printstrn-umoven-undumpable): New entries.
* tests/pure_executables.list: Add printstrn-umoven,
printstrn-umoven-peekdata, and printstrn-umoven-undumpable.
* tests/.gitignore: Likewise.
2017-08-02 00:45:47 +00:00
4341074ee1 tests: add test_printstrn function to libtests
* tests/test_ucopy.h (test_printstrn): New prototype.
* tests/test_printstrn.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2017-08-02 00:44:28 +00:00
336691583e tests: enhance test coverage of printpath and umovestr
* tests/init.sh (TIMEOUT_DURATION): Raise from 300 to 600.
* tests/printpath-umovestr.c: New file.
* tests/printpath-umovestr-peekdata.c: Likewise.
* tests/printpath-umovestr-undumpable.c: Likewise.
* tests/printpath-umovestr-legacy.test: New test.
* tests/Makefile.am (MISC_TESTS): Add printpath-umovestr-legacy.test.
* tests/gen_tests.in (printpath-umovestr, printpath-umovestr-peekdata,
printpath-umovestr-undumpable): New entries.
* tests/pure_executables.list: Add printpath-umovestr,
printpath-umovestr-peekdata, and printpath-umovestr-undumpable.
* tests/.gitignore: Likewise.
2017-08-01 20:59:48 +00:00
7a9eea94ee tests: add test_printpath function to libtests
* tests/test_ucopy.h (test_printpath): New prototype.
* tests/test_printpath.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2017-08-01 20:59:48 +00:00
4f03dc3fc6 tests: add test_process_vm_readv and test_ptrace_peekdata to libtests
* tests/test_ucopy.c: New file.
* tests/test_ucopy.h: Likewise.
* tests/Makefile.am (libtests_a_SOURCES): Add them.
2017-08-01 20:59:48 +00:00
d7a45f8dcc printpath: do not fetch more than PATH_MAX bytes from tracee's memory
The kernel does not copy more than PATH_MAX bytes from userspace
pathnames, treating non-NUL-terminated pathnames as ENAMETOOLONG.

* util.c (printpathn): Decrease buffer size to PATH_MAX.
(printpath): Specify PATH_MAX - 1 as the maximum pathname length
to match the kernel behaviour.  The underlying umovestr call will fetch
up to PATH_MAX bytes from tracee's memory, but no more than first
PATH_MAX - 1 bytes will be printed.
2017-08-01 20:59:48 +00:00
ce822389af ucopy: cleanup umoven_peekdata and umovestr_peekdata
* ucopy.c (umoven_peekdata, umovestr_peekdata): Merge aligned
and unaligned tracee address cases.
2017-07-31 18:25:00 +00:00
9688f6a30d ucopy: move legacy fallbacks of umoven and umovestr to separate functions
Move legacy PTRACE_PEEKDATA-based support to separate functions.

* ucopy.c (umoven_peekdata, umovestr_peekdata): New functions.
(umoven, umovestr): Use them.
2017-07-31 18:25:00 +00:00
5edeed4295 ucopy: move process_vm_readv ENOSYS check to vm_read_mem
* ucopy.c (vm_read_mem): Set process_vm_readv_not_supported in case
of ENOSYS.
* ucopy.c (umoven, umovestr): Do not set process_vm_readv_not_supported.
2017-07-31 18:21:56 +00:00
66731fe8fe Print enabled optional features in strace version output
In order to provide information to user what optionally built features
are available.

* strace.c (print_version): New variable "features".  Print features string
after non-liability disclaimer (or "(none)" in case it is empty).
(print_version) [USE_LIBUNWIND]: Concatenate "stack-unwind" into features
string.
* tests/strace-V.tests (getoption): New function.
Update check in accordance with updated output.
2017-07-31 18:04:22 +00:00
ec7a06501d tests/strace-V.test: rename getval to getstr
As this name is more suitable.

* tests/strace-V (getval): Rename to getstr, update all call sites.
2017-07-31 17:29:41 +00:00
5fe47894af ucopy: refactor the check for invalid tracee addresses
* ucopy.c (tracee_addr_is_invalid): New function.
* ucopy.c (umoven, umovestr): Use it.
2017-07-30 23:40:24 +00:00
5f96feb9b7 ucopy: enhance vm_read_mem error diagnostics
* ucopy.c (umoven, umovestr): Enhance vm_read_mem error diagnostics
to match PTRACE_PEEKDATA case.
2017-07-30 23:28:12 +00:00
ccba47d80a ucopy: skip redundant tracee address truncation check
* ucopy.c (vm_read_mem): Skip raddr != truncated_raddr check
if these variables have the same data size.
2017-07-29 23:27:52 +00:00
429c08130b util: move umoven and umovestr to a separate file
These functions are more kernel-specific compared to all other functions
defined in util.c.

* ucopy.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* util.c (umoven, umovestr): Move to ucopy.c.
2017-07-28 10:24:35 +00:00
805d6ea570 bpf: enhance decoding of BPF_MAP_LOOKUP_ELEM and BPF_MAP_GET_NEXT_KEY
Print union bpf_attr.value field of BPF_MAP_LOOKUP_ELEM command
and union bpf_attr.next_key field of BPF_MAP_GET_NEXT_KEY command
on entering syscall.  These fields are addresses specified to the
kernel from userspace.  The amount of data written by the kernel
to these addresses is specified at the map creation time
by BPF_MAP_CREATE command and is not available at this point.

* bpf.c (decode_BPF_MAP_LOOKUP_ELEM): Print union bpf_attr.value
on entering syscall.
(decode_BPF_MAP_GET_NEXT_KEY): Print union bpf_attr.next_key
on entering syscall.
(bpf_map_io): Remove.
* tests/bpf.c (print_BPF_MAP_DELETE_ELEM_first,
print_BPF_MAP_DELETE_ELEM_attr, print_BPF_MAP_GET_NEXT_KEY_first,
print_BPF_MAP_GET_NEXT_KEY_attr): Replace macro redirects with
new functions.
(print_BPF_MAP_LOOKUP_ELEM_first, print_BPF_MAP_LOOKUP_ELEM_attr,
2017-07-27 20:11:33 +00:00
269e7d2a2c bpf: update BPF_MAP_CREATE decoding
Implement decoding of map_flags and inner_map_fd fields of union bpf_attr
for BPF_MAP_CREATE command introduced by linux kernel commits
v4.6-rc1~91^2~108^2~6 and v4.12-rc1~64^3~373^2~2, respectively.

* configure.ac: Check for inner_map_fd member of union bpf_attr
instead of max_entries.
* xlat/bpf_map_flags.in: New file.
* bpf.c: Include "xlat/bpf_map_flags.h".
(decode_BPF_MAP_CREATE): Add map_flags and inner_map_fd fields
to the structure, print them.
* tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test.
(init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected
output.
(init_BPF_MAP_CREATE_attr): Initialize map_flags and inner_map_fd
fields, update offset.
2017-07-27 00:44:31 +00:00
c024f1a60f bpf: update BPF_PROG_LOAD decoding
Implement decoding of union bpf_attr.prog_flags field for BPF_PROG_LOAD
command introduced by linux kernel commit v4.12-rc2~34^2~29^2~2.

* configure.ac: Check for prog_flags member of union bpf_attr
instead of kern_version.
* xlat/bpf_prog_flags.in: New file.
* bpf.c: Include "xlat/bpf_prog_flags.h".
(decode_BPF_PROG_LOAD): Add prog_flags field to the structure, print it.
* tests/bpf.c: Update macro guards of BPF_PROG_LOAD decoder test.
(init_BPF_PROG_LOAD_first, print_BPF_PROG_LOAD_attr): Update expected
output.
(init_BPF_PROG_LOAD_attr): Initialize prog_flags field, update offset.
2017-07-27 00:44:31 +00:00
a1e8d312ed tests: enhance test coverage of bpf syscall parser
* configure.ac: Update union bpf_attr member checks.
* tests/bpf.c: Rewrite.
* tests/bpf-v.c: New file.
* tests/gen_tests.in (bpf-v): New entry.
* tests/pure_executables.list: Add bpf-v.
* tests/.gitignore: Likewise.
2017-07-26 10:28:25 +00:00
4577bb6c89 m4: macroize union bpf_attr field checks
* m4/st_bpf.m4: New file.
* configure.ac: Use st_CHECK_UNION_BPF_ATTR.
2017-07-26 10:28:25 +00:00
a300de56c1 Move offsetofend from defs.h to macros.h
* defs.h (offsetofend): Move ...
* macros.h: ... here.
2017-07-26 10:28:25 +00:00
78de224180 bpf: print unused fields of union bpf_attr if one of them is non-zero
When the size argument specifies more data than necessary for the given
command, kernel checks that all unused fields of union bpf_attr are
zero.  Print this extra data when it contains non-zero bytes to enhance
debugging experience.

* bpf.c (decode_attr_extra_data): New function.
(decode_BPF_MAP_CREATE, decode_BPF_MAP_UPDATE_ELEM,
decode_BPF_MAP_DELETE_ELEM, bpf_map_io, decode_BPF_PROG_LOAD,
decode_BPF_OBJ_PIN, decode_BPF_OBJ_GET, decode_BPF_PROG_ATTACH,
decode_BPF_PROG_DETACH): Use it to print extra data passed
via bpf_attr pointer.
(bpf_obj_manage, bpf_prog_attach_detach): Remove.
* tests/bpf.c (map_delete_elem): New function.
(main): Use it.
2017-07-26 10:28:25 +00:00
26b3867cef bpf: change handling of big and unaccessible data to match the kernel
When the size argument exceeds PAGE_SIZE, the kernel fails with E2BIG
without parsing union bpf_attr.
When the whole chunk of memory specified by addr and size arguments is
not readable, the kernel fails with EFAULT.

* bpf.c (DECL_BPF_CMD_DECODER) <bpf_cmd_decoder>: Add const qualifier
to size argument, add data argument.
(decode_BPF_MAP_CREATE, decode_BPF_MAP_UPDATE_ELEM,
decode_BPF_MAP_DELETE_ELEM, bpf_map_io, decode_BPF_PROG_LOAD,
bpf_obj_manage, bpf_prog_attach_detach): Move size argument check and
memory fetching ...
(SYS_FUNC(bpf)) ... here, add PAGE_SIZE check, pass fetched memory
to command-specific parsers.
2017-07-26 10:28:25 +00:00
055e9527bf bpf: replace big switch statement with a dispatch table
* bpf.c (DECL_BPF_CMD_DECODER, DEF_BPF_CMD_DECODER, BPF_CMD_ENTRY):
New macros.
(bpf_cmd_decoder_t): New typedef.
Rename static parser functions using DEF_BPF_CMD_DECODER.
(decode_BPF_MAP_LOOKUP_ELEM, decode_BPF_MAP_GET_NEXT_KEY): New proxy
functions.
(SYS_FUNC(bpf)): Replace big switch statement with a dispatch table.
2017-07-25 12:47:19 +00:00
63ea6d172d bpf: use PRINT_FIELD_* macros
* print_fields.h (PRINT_FIELD_STR, PRINT_FIELD_PATH): New macros.
* bpf.c: Include "print_fields.h".
(bpf_map_create): Use PRINT_FIELD_U and PRINT_FIELD_XVAL.
(bpf_map_update_elem): Use PRINT_FIELD_FD, PRINT_FIELD_X, and
PRINT_FIELD_XVAL.
(bpf_map_delete_elem, bpf_map_io): Use PRINT_FIELD_FD and PRINT_FIELD_X.
(bpf_prog_load): Use PRINT_FIELD_STR, PRINT_FIELD_U, PRINT_FIELD_X,
and PRINT_FIELD_XVAL.
(bpf_obj_manage): Use PRINT_FIELD_FD and PRINT_FIELD_PATH.
(bpf_prog_attach_detach): Use PRINT_FIELD_FD, PRINT_FIELD_FLAGS,
and PRINT_FIELD_XVAL.
2017-07-25 12:47:19 +00:00
861e50b6df Add terminating comment after each DECL_* macro definition
In an attempt to improve readability.

* defs.h (DECL_IOCTL, DECL_NETLINK, DECL_PRINTNUM, DECL_PRINTNUM_ADDR,
ATTRIBUTE_FORMAT): Add comment that marks end of macro definition.
* netlink_sock_diag (DECL_NETLINK_DIAG_DECODER): Likewise.
* nlattr.h (DECL_NLA): Likewise.
2017-07-25 14:26:10 +02:00
de484eced5 Introduce print_quoted_cstring
In many places where kernel expects a NUL-terminated string of length
up to a known fixed limit, e.g. when a NUL-terminated string is
a fixed-size field of a structure, strace does not print the last byte
assuming it is NUL, which is not always the case.

Change output format for such strings to distinguish NUL-terminated
strings from non-NUL-terminated ones: append ellipsis to the output
when the string is not NUL-terminated.

* defs.h (print_quoted_cstring): New prototype.
* util.c (print_quoted_cstring): New function.
(printpathn): Use it instead of print_quoted_string with
QUOTE_0_TERMINATED argument.
* print_fields.h (PRINT_FIELD_CSTRING): Likewise.
* btrfs.c (btrfs_ioctl): Likewise.
* dirent.c (SYS_FUNC(getdents)): Likewise.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* print_ifindex.c (print_ifindex): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* ubi.c (ubi_ioctl): Likewise.
* tests/tests.h (print_quoted_cstring): New prototype.
* tests/print_quoted_string.c (print_quoted_cstring): New function.
* tests/ioctl_block.c (main): Update expected output.
* tests/ioctl_dm.c (main): Likewise.
* tests/ioctl_loop.c (print_loop_info, print_loop_info64): Likewise.
* tests/netlink_crypto.c (test_crypto_msg_newalg): Likewise.
2017-07-24 12:10:54 +00:00
53a56aa0d8 tests: check decoding of NETLINK_CRYPTO crypto_user_alg attributes
* tests/nlattr_crypto_user_alg.c: New file.
* tests/gen_tests.in (nlattr_crypto_user_alg): New entry.
* tests/pure_executables.list: Add nlattr_crypto_user_alg.
* tests/.gitignore: Likewise.
2017-07-24 11:18:43 +00:00
3acb11230c tests: extend TEST_NLATTR_OBJECT macro
* tests/test_nlattr.h (TEST_NLATTR_OBJECT_EX_,
TEST_NLATTR_OBJECT_EX): New macros.
(TEST_NLATTR_OBJECT): Use TEST_NLATTR_OBJECT_EX_.
2017-07-24 11:18:43 +00:00
e4b90f7bbf netlink: decode NETLINK_CRYPTO crypto_user_alg netlink attributes
* configure.ac (AC_CHECK_TYPES): Check for crypto_report_aead,
crypto_report_blkcipher, crypto_report_cipher, crypto_report_hash,
and crypto_report_rng structures in <linux/cryptouser.h>.
* netlink_crypto.c (decode_crypto_report_generic,
decode_crypto_report_hash, decode_crypto_report_blkcipher,
decode_crypto_report_aead, decode_crypto_report_rng,
decode_crypto_report_cipher): New functions.
(crypto_user_alg_nla_decoders): New array.
(decode_crypto_user_alg): Use it.
* xlat/crypto_nl_attrs.in: New file.
* NEWS: Mention this.
2017-07-24 11:18:43 +00:00
540d2f50fe tests: check decoding of NETLINK_CRYPTO messages
* tests/netlink_crypto.c: Include "test_netlink.h"
instead of "netlink.h".
(test_crypto_msg_newalg, test_crypto_msg_unspec): New functions.
(main): Use them.
2017-07-24 11:18:43 +00:00
67ebfac6c2 tests: extend TEST_NETLINK_OBJECT macro
As the first field of NETLINK_CRYPTO messages is a string, print
unrecognized data as a string.  Extend TEST_NETLINK_OBJECT macro
to test this case.

* tests/test_netlink.h (TEST_NETLINK_OBJECT_EX_,
TEST_NETLINK_OBJECT_EX): New macros.
(TEST_NETLINK_OBJECT): Use TEST_NETLINK_OBJECT_EX_.
2017-07-24 10:51:30 +00:00
9da72b5251 netlink: add a basic parser of NETLINK_CRYPTO messages
* netlink_crypto.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink_crypto): New prototype.
* netlink.c (netlink_decoders): Add NETLINK_CRYPTO.
* NEWS: Mention this.
2017-07-24 10:47:19 +00:00
3754255061 Unify PRINT_FIELD_XVAL and PRINT_FIELD_XVAL64
* print_fields.h (PRINT_FIELD_XVAL64): Unify with PRINT_FIELD_XVAL.
2017-07-23 11:16:23 +00:00
8c1c2066f8 Unify PRINT_FIELD_FLAGS and PRINT_FIELD_FLAGS64
* print_fields.h (PRINT_FIELD_FLAGS64): Unify with PRINT_FIELD_FLAGS.
* userfaultfd.c (uffdio_ioctl): Replace PRINT_FIELD_FLAGS64 with
PRINT_FIELD_FLAGS.
2017-07-23 11:16:23 +00:00
f996207331 pathtrace: fix fanotify_mark path tracing on 32-bit architectures
The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
architectures it is split up into two syscall arguments.

* pathtrace.c (pathtrace_match_set): Use getllval to properly decode
arguments after mask.
2017-07-23 11:16:23 +00:00
725e0fdd1d travis: add valgrind check support
* travis-build.sh [CHECK == valgrind]: Pass --enable-valgrind
to configure and appropriate check-valgrind-* to make.
* travis-install.sh [CHECK == valgrind]: Install valgrind.
2017-07-22 18:46:16 +00:00
d6a94e0bcd netlink_sock_diag: replace NLA_ALIGN with NLMSG_ALIGN
In several netlink_sock_diag parsers NLA_ALIGN was used instead of
NLMSG_ALIGN to align the length of netlink messages.  Fortunately,
both macros round the given length to the closest multiple of 4,
so technically there is no difference, but the use of wrong macro
is misleading.

* netlink_inet_diag.c (decode_inet_diag_req_compat,
decode_inet_diag_req_v2, decode_inet_diag_msg): Replace
NLA_ALIGN with NLMSG_ALIGN.
* netlink_netlink_diag.c (decode_netlink_diag_msg): Likewise.
* netlink_packet_diag.c (decode_packet_diag_msg): Likewise.
* netlink_smc_diag.c (decode_smc_diag_msg): Likewise.
2017-07-22 15:31:09 +00:00
184b09d450 travis: configure build with dependency tracking disabled
Dependency tracking is completely useless for one-time builds,
so configure build with dependency tracking disabled.

* travis-build.sh (DISTCHECK_CONFIGURE_FLAGS): Add
--disable-dependency-tracking.
2017-07-22 02:14:14 +00:00
6f90837382 m4: remove equal sign from define directive in ax_valgrind_check.m4
Support for providing equal sign in define directives has been added
only in GNU Make 3.82 [1] and it provides the same semantics (variables
should be recursively expanded) as when it is omitted at all, so let's
remove it in order to preserve compatibility with older GNU Make
versions (like the one used on Travis).

[1] https://git.savannah.gnu.org/cgit/make.git/tree/ChangeLog?h=3.82#n766

* m4/ax_valgrind_check.m4 <define valgrind_tool_rule>: Remove equal
sign.
2017-07-22 02:09:56 +02:00
6f51a6d00d keyctl: add support for KEYCTL_RESTRICT_KEYRING operation
* keyctl.c (keyctl_restrict_keyring): New function.
(SYS_FUNC(keyctl)): Use it to implement KEYCTL_RESTRICT_KEYRING support.
* NEWS: Mention this.
* tests/keyctl.c (main): Check KEYCTL_RESTRICT_KEYRING decoding.
2017-07-21 11:07:55 +00:00
5112bb0083 tests: robustify strace-t.test
If strace -t is running too long, it might happen that time stamps
before and after its invocation differ for more than a second.
Adjust expected output to handle this rare but possible case.

* tests/strace-t.test: Allow any time stamp between start and finish
of strace invocation.
2017-07-21 02:49:24 +00:00
8d2dd76323 x86: wire up arch_prctl syscall
* linux/i386/syscallent.h [384]: Add arch_prctl entry.
* xlat/archvals.in: Add fallback definitions for constants.
* prctl.c: Stop including <asm/prctl.h>.
(SYS_FUNC(arch_prctl)): Enable for [I386].
* NEWS: Mention this.
2017-07-21 01:30:26 +00:00
f62e2d39ec tests: tweak strace-ff.test for slow startup case
strace starts up much slower when invoked under valgrind control.
Increase the tracee's sleep delay to let strace more time to attach.

* tests/strace-ff.test: Increase sleep delay.
2017-07-21 01:30:26 +00:00
b1173d058c tests: update valgrind suppressions
* tests/strace.supp: Add a suppression for the memleak before
error_msg_and_die in qualify_tokens.
2017-07-21 01:30:26 +00:00
30861c9321 Do not copy optarg unnecessarily
There is no need to copy the optarg string since it is a pointer
into the original argv array, not into a static area
that might be overwritten.

* strace.c (username, outfname): Add const qualifier.
(init): Do not xstrdup optarg to initialize outfname and username.
2017-07-21 01:30:26 +00:00
d523a339fd travis: add build environment information to the travis log
* travis-build.sh: Print build environment information.
2017-07-20 22:03:31 +00:00
6ed39c0fc8 build: add check-valgrind-* to recursive targets
As make -j$N check-valgrind cannot parallelize properly, add
recursive targets for each of valgrind checks.  This way one can run
	for t in $valgrind_enabled_tools; do
		make -k check-valgrind-$n || rc=$?
	done
in $top_builddir.

* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Remove.
* m4/ax_valgrind_check.m4 (AX_VALGRIND_CHECK): Add check-valgrind
and check-valgrind-* to AM_EXTRA_RECURSIVE_TARGETS.
2017-07-20 22:03:31 +00:00
802f46e3b6 tests: add check-valgrind-local make rule
This guarantees that $(check_LIBRARIES) and $(check_PROGRAMS)
are made on 'make check-valgrind' before its recipe is processed.

* tests/Makefile.am (check-valgrind-local): New rule.
(.PHONY): Add it.
2017-07-20 00:06:06 +00:00
bcf04aba1b Add ksysent.h and scno.h to BUILT_SOURCES
This guarantees that ksysent.h and scno.h, along with other targets
listed in BUILT_SOURCES, are made on 'make all', 'make check',
and 'make check-valgrind' before other targets are processed.

* scno.am (BUILT_SOURCES): Add scno.h.
* tests/Makefile.am (BUILT_SOURCES): Add ksysent.h.
2017-07-20 00:06:06 +00:00
24c6681d39 tests: fix valgrind suppression file path
* tests/Makefile.am (VALGRIND_SUPPRESSIONS_FILES): Replace srcdir
with abs_srcdir.

Fixes: v4.16-74-g16036030 ("tests: run every test except ksysent.test in its own subdirectory")
2017-07-20 00:06:06 +00:00
129c1af897 Update AX_VALGRIND_CHECK
* m4/ax_valgrind_check.m4: Update to serial 15.  In particular,
this version does not eat check-valgrind errors.
2017-07-19 21:29:33 +00:00
acd867117c Update AX_CODE_COVERAGE
* m4/ax_code_coverage.m4: Update to serial 24.  In particular,
this version has no lcov version check.
* Makefile.am (strace_LDADD): Rename CODE_COVERAGE_LDFLAGS
to CODE_COVERAGE_LIBS.
2017-07-19 21:29:33 +00:00
886a7966b1 Update input event KEY_* constants
* xlat/evdev_keycode.in: Add KEY_ASSISTANT introduced by linux kernel
commit v4.13-rc1~13^2~1^2~1.
* NEWS: Mention this.
2017-07-19 20:41:15 +00:00
3e1ed8cf62 Update fs *_MAGIC constants
* xlat/fsmagic.in: Add AAFS_MAGIC introduced by linux kernel commit
v4.13-rc1~161^2~87.
* NEWS: Mention this.
2017-07-19 20:41:15 +00:00
bf24770d91 Move family-specific NETLINK_SOCK_DIAG parsers to separate files
Split netlink_sock_diag.c that grew too big.

* defs.h (tcp_states, tcp_state_flags): New xlat prototypes.
* netlink_sock_diag.h: New file.
* netlink_inet_diag.c: Likewise.
* netlink_netlink_diag.c: Likewise.
* netlink_packet_diag.c: Likewise.
* netlink_smc_diag.c: Likewise.
* netlink_unix_diag.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* netlink_sock_diag.c: Move family-specific parsers and associated
header includes to separate files.
* nlattr.h (DECL_NLA(meminfo)): New prototype.
* nlattr.c: Include <linux/sock_diag.h>.
(print_meminfo, decode_nla_meminfo): New functions from
netlink_sock_diag.c.
2017-07-19 10:07:34 +00:00
c56a3c361c Adjust prototypes of netlink parsing functions
Change the type of "len" argument that is based
on struct nlmsghdr.nlmsg_len from kernel_ulong_t to unsigned int.

* defs.h (netlink_decoder_t, DECL_NETLINK): Change "len" argument type
from kernel_ulong_t to unsigned int.
* netlink.c (decode_nlmsgerr_attr_cookie, decode_nlmsgerr,
decode_payload): Likewise.
* netlink_selinux.c (decode_netlink_selinux): Likewise.
* netlink_sock_diag.c (decode_family, decode_unix_diag_req,
decode_meminfo, decode_unix_diag_vfs, decode_unix_diag_inode,
decode_unix_diag_rqlen, decode_unix_diag_msg, decode_netlink_diag_req,
print_group, decode_netlink_diag_ring, decode_netlink_diag_flags,
decode_netlink_diag_msg, decode_packet_diag_req,
decode_packet_diag_info, decode_packet_diag_mclist,
decode_packet_diag_ring, decode_packet_diag_filter,
decode_packet_diag_msg, decode_inet_addr, decode_inet_diag_hostcond,
decode_inet_diag_markcond, decode_bytecode_data, decode_inet_diag_bc_op,
decode_inet_diag_req_compat, decode_inet_diag_req_v2,
decode_inet_diag_req, decode_inet_diag_meminfo, decode_tcpvegas_info,
decode_tcp_dctcp_info, decode_tcp_bbr_info, decode_inet_diag_msg,
decode_smc_diag_req, decode_smc_diag_conninfo, decode_smc_diag_lgrinfo,
decode_smc_diag_msg, netlink_diag_decoder_t, decode_netlink_sock_diag):
Likewise.
* nlattr.c (fetch_nlattr, decode_nlattr_with_data, decode_nlattr,
decode_nla_str, decode_nla_strn, DECODE_NLA_INTEGER): Likewise.
* nlattr.h (nla_decoder_t, DECL_NLA, decode_nlattr): Likewise.
2017-07-19 10:07:34 +00:00
a950e13865 tests: check decoding of nlmsgerr attributes
* tests/nlattr_nlmsgerr.c: New file.
* tests/gen_tests.in (nlattr_nlmsgerr): New entry.
* tests/pure_executables.list: Add nlattr_nlmsgerr.
* tests/.gitignore: Likewise.
2017-07-19 09:25:58 +00:00
3bfaa0f744 netlink: decode nlmsgerr attributes
* netlink.c: Include "nlattr.h" and "xlat/nlmsgerr_attrs.h".
(print_cookie, decode_nlmsgerr_attr_cookie): New functions.
(nlmsgerr_nla_decoders): New array.
(decode_nlmsgerr): Use it.
* xlat/nlmsgerr_attrs.in: New file.
* NEWS: Mention this.
2017-07-19 09:25:58 +00:00
9c9e061536 netlink: adjust decode_nlmsgerr for extended ACK reporting
Extended ACK reporting introduced by linux kernel commit
v4.11-rc5-1382-g2d4bc93.

* netlink.h (NLM_F_CAPPED): New macro.
* netlink.c (decode_payload): Pass
nlmsghdr->nlmsg_flags & NLM_F_CAPPED to decode_nlmsgerr.
(decode_nlmsgerr): Adjust the length pass to
decode_nlmsghdr_with_payload.
2017-07-19 09:25:58 +00:00
9ec9ad9c0f netlink: decode netlink message ack flags
* netlink.c: Include "xlat/netlink_ack_flags.h".
(decode_nlmsg_flags): Decode ack flags when type == NLMSG_ERROR.
* xlat/netlink_ack_flags.in: New file.
* NEWS: Mention this.
* tests/netlink_protocol.c (test_ack_flags): New function, check this.
(main): Use it.
2017-07-19 09:25:58 +00:00
f8444b32f3 tests: enhance error diagnostics
* tests/init.sh (dump_log_and_fail_with): Dump $LOG to stderr instead
of stdout as the latter is more likely to be redirected to a temporary
file in the context where this function is called.
2017-07-19 08:59:50 +00:00
741dadd12d tests: enhance timeout diagnostics
* tests/init.sh: Trap SIGXCPU.
* tests/run.sh: Send SIGXCPU instead of SIGKILL in case of timeout, send
SIGKILL if the command is still running 5 seconds after SIGXCPU.
2017-07-19 02:38:37 +00:00
6644e1f4e1 userfaultfd: decode struct uffdio_api.features as flags
* xlat/uffd_api_features.in: New file.
* userfaultfd.c: Include "xlat/uffd_api_features.h".
(uffdio_ioctl): Print struct uffdio_api.features using
PRINT_FIELD_FLAGS64 and uffd_api_features.
* NEWS: Mention this.
* tests/ioctl_uffdio.c: Include "xlat.h" and "xlat/uffd_api_features.h".
(main): Update expected output.
2017-07-19 00:33:56 +00:00
16eded4c4b userfaultfd: enhance decoding of struct uffdio_api.features
As struct uffdio_api.features has read-write semantics,
print the value returned by the kernel only when it differs
from the value passed to the kernel.

* userfaultfd.c (uffdio_ioctl) <UFFDIO_API>: On entering syscall,
save the value of struct uffdio_api.features.  On exiting syscall, do
not print struct uffdio_api.features when it's the same as on entering.
* tests/ioctl_uffdio.c (main): Update expected output.
2017-07-19 00:33:56 +00:00
88af5e4cf5 userfaultfd: use PRINT_FIELD_* macros
This also fixes output correctness for struct uffdio_api.features.

* userfaultfd.c: Include "print_fields.h".
(tprintf_uffdio_range): Use PRINT_FIELD_X.
(PRINT_FIELD_UFFDIO_RANGE): New macro.
(uffdio_ioctl): Use it, PRINT_FIELD_FLAGS64, and PRINT_FIELD_X.
* tests/ioctl_uffdio.c (main): Update expected output.
2017-07-18 21:54:38 +00:00
58dbb36efa Introduce PRINT_FIELD_FLAGS64 and PRINT_FIELD_XVAL64
* print_fields.h (PRINT_FIELD_FLAGS64, PRINT_FIELD_XVAL64): New macros.
2017-07-18 21:54:38 +00:00
8d62a6072d Update NEWS 2017-07-17 19:55:17 +00:00
b4f790e9ac aio: change struct iocb.aio_lio_opcode output format
* aio.c (tprint_lio_opcode): Change opcode output format to match
the kernel.
* tests/aio.c (main): Update expected output.
2017-07-17 11:59:26 +00:00
6fe6c27917 aio: use PRINT_FIELD_* macros
This also fixes output correctness for struct iocb.

* aio.c: Include "print_fields.h".
(print_common_flags, print_iocb_header, print_iocb, print_io_event):
Use PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_FD,
and PRINT_FIELD_STRN.
* tests/aio.c (main): Update expected output.
2017-07-17 11:59:26 +00:00
844c15975b Introduce PRINT_FIELD_FD and PRINT_FIELD_STRN
* print_fields.h (PRINT_FIELD_FD, PRINT_FIELD_STRN): New macros.
2017-07-17 11:59:26 +00:00
695beba6b7 Update BPF_* constants
* xlat/bpf_commands.in: Add BPF_PROG_TEST_RUN, BPF_PROG_GET_NEXT_ID,
BPF_MAP_GET_NEXT_ID, BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID,
and BPF_OBJ_GET_INFO_BY_FD introduced by linux kernel commits
v4.12-rc1~64^3~287^2~5, v4.13-rc1~157^2~271^2~5,
v4.13-rc1~157^2~271^2~4, v4.13-rc1~157^2~271^2~3, and
v4.13-rc1~157^2~271^2~1, respectively.
* xlat/bpf_attach_type.in: Add BPF_CGROUP_SOCK_OPS introduced
by linux kernel commit v4.13-rc1~157^2~37^2~15.
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_SOCK_OPS introduced
by the same commit.
2017-07-16 22:40:16 +00:00
5e7babab2b Update SO_* constants
* xlat/sockoptions.in: Add SO_PEERGROUPS introduced by linux kernel
commit v4.13-rc1~157^2~124.
2017-07-16 22:24:54 +00:00
99da3633bd Update SCM_* constants
* xlat/scmvals.in: Add SCM_TIMESTAMPING_PKTINFO introduced
by linux kernel commit v4.13-rc1~157^2~405^2~3.
2017-07-16 22:21:34 +00:00
8ff8c5422d tests: check decoding of NETLINK_SELINUX protocol
* test_netlink.h (TEST_NETLINK_OBJECT): New macro.
* tests/netlink_selinux.c: Include "test_netlink.h"
instead of "netlink.h".
(test_selnl_msg_unspec, test_selnl_msg_setenforce,
test_selnl_msg_policyload): New functions.
(main): Use them.
2017-07-16 18:26:10 +00:00
37dfe8c769 netlink: decode NETLINK_SELINUX protocol
* netlink_selinux.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink_selinux): New prototype.
* netlink.c (netlink_decoders): Add NETLINK_SELINUX.
2017-07-16 18:26:10 +00:00
836f4a1592 sg_io_v3: use PRINT_FIELD_* macros
* sg_io_v3.c: Include "print_fields.h".
(PRINT_FIELD_SG_IO_BUFFER): New macro.
(decode_request, decode_response): Use it, PRINT_FIELD_D, PRINT_FIELD_U,
PRINT_FIELD_X, PRINT_FIELD_PTR, PRINT_FIELD_FLAGS, and PRINT_FIELD_XVAL.
2017-07-15 00:08:12 +00:00
5bafd10074 Introduce PRINT_FIELD_PTR
* print_fields.h (PRINT_FIELD_PTR): New macro.
2017-07-15 00:08:12 +00:00
ba7d84b679 Provide mpers_ptr_t definition for non-mpers case
In mpers case, mpers_ptr_t is already defined by DEF_MPERS_TYPE(...).
This allows use of mpers_ptr_t regardless of IN_MPERS state.

* mpers_type.h [!IN_MPERS] (mpers_ptr_t): New typedef.
2017-07-15 03:08:12 +03:00
72aba2be32 Move is_negated_errno() to new header negated_errno.h
Move is_negated_errno() to a separate new header file negated_errno.h
and include it just for architectures which require it.

is_negated_errno() is not used on those architectures
that have a dedicated register to signal a syscall error.

The issue was raised when compiling with clang, which is more
strict regarding semantics of unused static inline functions
defined in C files and will issue a -Wunused-function warrning
if they are not used anywhere.

* syscall.c (is_negated_errno): Move to ...
* negated_errno.h: ... new file.
* Makefile.am (strace_SOURCES): Add it.
* linux/aarch64/get_error.c: Include it.
* linux/arc/get_error.c: Likewise.
* linux/arm/get_error.c: Likewise.
* linux/avr32/get_error.c: Likewise.
* linux/bfin/get_error.c: Likewise.
* linux/crisv10/get_error.c: Likewise.
* linux/hppa/get_error.c: Likewise.
* linux/i386/get_error.c: Likewise.
* linux/ia64/get_error.c: Likewise.
* linux/m68k/get_error.c: Likewise.
* linux/metag/get_error.c: Likewise.
* linux/microblaze/get_error.c: Likewise.
* linux/or1k/get_error.c: Likewise.
* linux/riscv/get_error.c: Likewise.
* linux/s390/get_error.c: Likewise.
* linux/sh/get_error.c: Likewise.
* linux/sh64/get_error.c: Likewise.
* linux/tile/get_error.c: Likewise.
* linux/x86_64/get_error.c: Likewise.
* linux/xtensa/get_error.c: Likewise.
2017-07-14 23:55:23 +00:00
eb4467d09b sg_io_v4: use PRINT_FIELD_* macros
* sg_io_v4.c: Include "print_fields.h".
(PRINT_FIELD_SG_IO_BUFFER): New macro.
(decode_request, decode_response): Use it, PRINT_FIELD_D, PRINT_FIELD_U,
PRINT_FIELD_X, PRINT_FIELD_FLAGS, and PRINT_FIELD_XVAL.
2017-07-14 03:59:13 +00:00
c468637dba dm: use PRINT_FIELD_* macros
* dm.c (dm_decode_values, dm_decode_dm_target_spec,
dm_decode_dm_target_deps, dm_decode_dm_target_msg, dm_known_ioctl): Use
PRINT_FIELD_D, PRINT_FIELD_U, and PRINT_FIELD_FLAGS.
2017-07-14 03:59:13 +00:00
14c2dca9e1 Move macros related to kernel types to kernel_types.h
Some macros related to kernel types are defined both in defs.h and
tests/tests.h.  Avoid this redundancy by moving these definitions
to kernel_types.h.

* defs.h (PRI_kl, PRI_kld, PRI_klu, PRI_klx, PRI__64, PRI__d64,
PRI__u64, PRI__x64): Move ...
* kernel_types.h: ... here.
* tests/tests.h (PRI__64, PRI__d64, PRI__u64, PRI__x64): Remove.
2017-07-13 21:56:29 +00:00
5c34fd9162 mips64: fix PRI__64 macro definition when compiled for Android
By default for MIPS64 in Android __u64 type is exported
as unsigned long long.  This caused compilation -Wformat warnings
and would break the build if -Werror is used.

* defs.h [SIZEOF_LONG != 4 && MIPS && __ANDROID__] (PRI__64): Change
from "l" to "ll".
2017-07-13 21:15:21 +00:00
07eae54d08 block: use PRINT_FIELD_* macros
This also fixes output correctness for struct blkpg_ioctl_arg.

* block.c (print_blkpg_req): Use PRINT_FIELD_D and PRINT_FIELD_XVAL.
(block_ioctl): Use PRINT_FIELD_U.
* tests/ioctl_block.c (main): Update expected output.
2017-07-13 12:38:51 +00:00
dc16e68bc5 netlink_sock_diag: enhance decoding of long meminfo arrays
Print trailing dots instead of silent truncation if the array
is too long.

* netlink_sock_diag.c (decode_meminfo): Do not apply SK_MEMINFO_VARS
limit to nmemb, specify element count to print_array instead.
(print_meminfo): Check element count and terminate printing
if the element count exceeds SK_MEMINFO_VARS.
* tests/nlattr_inet_diag_msg.c (main): Check it.
2017-07-12 21:08:03 +00:00
4102bc0a37 tests: extend coverage of netlink_diag_req decoder
Add one more NETLINK_SOCK_DIAG check to ressurrect full coverage
of netlink_diag_req decoder that was lost after commit
v4.18-58-g37ef2d0d.

* tests/netlink_sock_diag.c (test_netlink_diag_req): Add a check for
sdiag_protocol != NDIAG_PROTO_ALL.
2017-07-12 21:08:03 +00:00
51cb1e7a8a tests: check decoding of NETLINK_CRYPTO nlmsg_flags
* tests/netlink_crypto.c (test_nlmsg_flags): New function.
(main): Use it.
2017-07-12 21:08:03 +00:00
c4d14b4457 netlink: add decoding of NETLINK_CRYPTO nlmsg_flags
* netlink.c (decode_nlmsg_flags): Add NETLINK_CRYPTO.
2017-07-12 21:08:03 +00:00
854a12954f tests: check decoding of NETLINK_CRYPTO message types
* configure.ac (AC_CHECK_HEADERS): Add linux/cryptouser.h.
* tests/netlink_crypto.c: New file.
* tests/gen_tests.in (netlink_crypto): New entry.
* tests/pure_executables.list: Add netlink_crypto.
* tests/.gitignore: Likewise.
2017-07-12 21:08:03 +00:00
771c6be31a netlink: add decoding of NETLINK_CRYPTO message types
* xlat/nl_crypto_types.in: New file.
* netlink.c: Include "xlat/nl_crypto_types.h".
(nlmsg_types): Add NETLINK_CRYPTO.
2017-07-12 21:08:03 +00:00
c254454365 tests: introduce TEST_NETLINK and TEST_NETLINK_ macros
* tests/test_netlink.h: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/netlink_sock_diag.c: Include "test_netlink.h"
instead of "netlink.h".
(TEST_SOCK_DIAG): New macro.
(test_unix_diag_req, test_unix_diag_msg,
test_netlink_diag_req, test_netlink_diag_msg,
test_packet_diag_req, test_packet_diag_msg,
test_inet_diag_req, test_inet_diag_req_v2,
test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Use it.
(test_odd_family_req, test_odd_family_msg,
test_inet_diag_sockid): Use TEST_NETLINK macro.
2017-07-12 21:08:03 +00:00
9f40073dc1 tests: check decoding of nlattr_inet_diag_req_v2 attributes
* tests/nlattr_inet_diag_req_v2.c: New file.
* tests/gen_tests.in (nlattr_inet_diag_req_v2): New entry.
* tests/pure_executables.list: Add nlattr_inet_diag_req_v2.
* tests/.gitignore: Likewise.
2017-07-11 22:24:03 +00:00
de79458f09 tests: check decoding of nlattr_inet_diag_req_compat attributes
* tests/nlattr_inet_diag_req_compat.c: New file.
* tests/gen_tests.in (nlattr_inet_diag_req_compat): New entry.
* tests/pure_executables.list: Add nlattr_inet_diag_req_compat.
* tests/.gitignore: Likewise.
2017-07-11 22:24:03 +00:00
fe03478755 netlink: decode AF_INET inet_diag_req_* attributes
* linux/inet_diag.h (inet_diag_bc_op, inet_diag_hostcond,
inet_diag_markcond): New structures.
(INET_DIAG_BC_*): New enum.
* netlink_sock_diag.c: Include "xlat/inet_diag_bytecodes.h".
(decode_inet_addr, decode_inet_diag_hostcond,
print_inet_diag_bc_op, decode_inet_diag_markcond,
decode_bytecode_data, decode_inet_diag_bc_op): New functions.
(inet_diag_req_nla_decoders): New array.
(decode_inet_diag_req_compat, decode_inet_diag_req_v2): Use it.
* xlat/inet_diag_bytecodes.in: New file.
2017-07-11 22:24:03 +00:00
837a76f4ee Introduce PRINT_FIELD_CSTRING
* print_fields.h (PRINT_FIELD_CSTRING): New macro.
* block.c (print_blkpg_req, block_ioctl): Use PRINT_FIELD_CSTRING
instead of print_quoted_string.
* btrfs.c (btrfs_ioctl): Likewise.
* dm.c (dm_decode_device, dm_decode_dm_target_spec): Likewise.
* loop.c (decode_loop_info, decode_loop_info64): Likewise.
* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc,
print_v4l2_standard, print_v4l2_input, print_v4l2_tuner,
print_v4l2_queryctrl): Likewise.
* netlink_sock_diag.c (decode_smc_diag_lgrinfo): Use PRINT_FIELD_CSTRING
instead of PRINT_FIELD_STRING.
* uname.c (PRINT_UTS_MEMBER): Remove.
(SYS_FUNC(uname)): Use PRINT_FIELD_CSTRING instead of PRINT_UTS_MEMBER.
2017-07-11 00:20:54 +00:00
8d3bd017a5 Rename PRINT_FIELD_QUOTED_STRING to PRINT_FIELD_STRING
As string fields are always qouted when printed, choose a shorter name
for the helper macro.

* print_fields.h (PRINT_FIELD_QUOTED_STRING): Rename
to PRINT_FIELD_STRING.  All callers updated.
2017-07-11 00:20:54 +00:00
04bbe9d130 Update RWF_* constants
* xlat/rwf_flags.in: Add RWF_NOWAIT introduced by linux kernel
commit v4.12-rc5-150-gb745fafa.
2017-07-10 15:27:51 +00:00
2d727ee3d2 Intorduce PRINT_FIELD_0X
* print_fields.h (PRINT_FIELD_0X): New macro.
* sockaddr.c (print_sockaddr_data_ipx, print_sockaddr_data_nl): Use it
instead of manual tprintf statements.
* netlink_sock_diag.c (PRINT_FIELD_SMC_DIAG_CONNINFO_FLAGS): Remove.
(decode_smc_diag_conninfo): Replace it with PRINT_FIELD_0X.
2017-07-10 02:23:00 +00:00
d4f2e8b94f print_inet_addr: use inet_addr-based output format for IPv4
* sockaddr.c (print_inet_addr): Remove af_name variable.
<AF_INET>: Use inet_addr-based output format.
* tests/netlink_sock_diag.c (test_inet_diag_sockid, test_inet_diag_req,
test_inet_diag_req_v2, test_inet_diag_msg, test_smc_diag_req,
test_smc_diag_msg): Update expected output.
* tests/nlattr_inet_diag_msg.c (print_inet_diag_msg): Likewise.
* tests/nlattr_smc_diag_msg.c (print_smc_diag_msg): Likewise.
2017-07-10 02:23:00 +00:00
03a08d8357 tests: check decoding of netlink smc_diag_msg attributes
* tests/nlattr_smc_diag_msg.c: New file.
* tests/gen_tests.in (nlattr_smc_diag_msg): New entry.
* tests/pure_executables.list: Add nlattr_smc_diag_msg.
* tests/.gitignore: Likewise.
2017-07-10 01:15:57 +00:00
10d206613f netlink: decode AF_SMC smc_diag_msg attributes
* linux/smc_diag.h (smc_diag_cursor, smc_diag_conninfo
smc_diag_linkinfo, smc_diag_lgrinfo): New structures.
* netlink_sock_diag.c: Include "xlat/smc_link_group_roles.h".
(decode_smc_diag_conninfo, decode_smc_diag_lgrinfo): New functions.
(smc_diag_msg_nla_decoders): New array.
(decode_smc_diag_msg): Use it.
* xlat/smc_link_group_roles.in: New file.
2017-07-10 01:15:57 +00:00
09c781b184 pathtrace.c: introduce user-provided sets of paths
* defs.h (struct path_set): New structure.
(global_path_set): New variable prototype.
(tracing_paths): Change macro body to use global_path_set variable.
(pathtrace_select_set): Add "struct path_set *" argument.
(pathtrace_match_set): Likewise.  Change return type to bool.
(pathtrace_select, pathtrace_match): Change into thin macro wrappers
around pathtrace_select_set and pathtrace_match_set, repsectively.
* pathtrace.c (global_path_set): New variable.
(storepath, pathtrace_select_set): Add "struct path_set *" argument.
(pathmatch, upathmatch, fdmatch, pathtrace_match_set): Likewise.
Change return type to bool.
2017-07-10 00:10:50 +00:00
b53552b2d8 tests: check decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP
* tests/group_req.c: New file.
* tests/gen_tests.in (group_req): New entry.
* tests/pure_executables.list: Add group_req.
* tests/.gitignore: Likewise.
2017-07-09 18:43:34 +00:00
106a76ce81 Mpersify struct group_req
The size of struct group_req depends on alignment of long and therefore
has to be mpersified.

* print_group_req.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* net.c (print_group_req): Move to print_group_req.c, wrap into
MPERS_PRINTER_DECL.
2017-07-09 18:43:34 +00:00
7bcb1dcdbc net: enhance decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP
* net.c (print_group_req): Allow option length greater than
sizeof(struct group_req) to match the kernel behaviour.
When the option length is invalid, print the address.
* NEWS: Mention this.
2017-07-09 18:43:34 +00:00
92fa2ce23c net: hook up MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP decoding for SOL_IPV6
As multicast socket options are shared between IPv4 and IPv6,
they should be decoded both for SOL_IP and SOL_IPV6.

* net.c (print_setsockopt) <SOL_IPV6> [MCAST_JOIN_GROUP]: Handle
MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP.
2017-07-09 18:43:34 +00:00
a03c9c40de xlat: add MCAST_* to sockipv6options
Multicast socket options are shared between IPv4 and IPv6.

* xlat/sockipv6options.in: Add MCAST_JOIN_GROUP, MCAST_BLOCK_SOURCE,
MCAST_UNBLOCK_SOURCE, MCAST_LEAVE_GROUP, MCAST_JOIN_SOURCE_GROUP,
MCAST_LEAVE_SOURCE_GROUP, and MCAST_MSFILTER.
2017-07-09 18:43:34 +00:00
492517e35f net: enhance decoding of IP_ADD_MEMBERSHIP et al socket options
* net.c (print_mreq, print_mreq6): Treat negative option length
as invalid to match the kernel behaviour.  When the option length
is invalid, print the address.
* NEWS: Mention it.
* tests/ip_mreq.c (main): Check it.  Update expected output.
2017-07-09 18:43:34 +00:00
b5f7cde8a5 net: enhance decoding of setsockopt's SO_LINGER negative option length
* net.c (print_set_linger): Treat negative option length as invalid
to match the kernel behaviour.
* tests/so_linger.c (main): Check it.
2017-07-09 18:43:34 +00:00
989744583d msghdr: use PRINT_FIELD_* macros
* msghdr.c (print_scm_creds): Use PRINT_FIELD_U and PRINT_FIELD_UID.
(print_cmsg_ip_recverr): Use PRINT_FIELD_U.
(print_struct_msghdr): Use PRINT_FIELD_U and PRINT_FIELD_FLAGS.
2017-07-09 18:43:34 +00:00
ce1f4d12aa Intorduce PRINT_FIELD_SOCKADDR
* print_fields.h (PRINT_FIELD_SOCKADDR): New macro.
* msghdr.c (print_cmsg_ip_recverr): Use it instead of print_sockaddr.
* net.c (print_group_req): Likewise.
* sock.c (PRINT_IFREQ_ADDR): Remove.
(print_ifreq, print_ifconf_ifreq): Use PRINT_FIELD_SOCKADDR
instead of PRINT_IFREQ_ADDR.
2017-07-09 18:43:34 +00:00
6cc2b5c039 print_sockaddr: remove "struct tcb *" argument
print_sockaddr does not use its first argument, remove it.

* defs.h (print_sockaddr): Remove argument.
* sockaddr.c (print_sockaddr): Remove argument.  All callers updated.
* sock.c (PRINT_IFREQ_ADDR): Likewise.
2017-07-09 18:43:34 +00:00
befb2b3952 net: use PRINT_FIELD_* macros
* net.c (print_tpacket_stats, print_tpacket_req): Use PRINT_FIELD_U.
(print_group_req): Use PRINT_FIELD_IFINDEX.
(print_packet_mreq): Use PRINT_FIELD_IFINDEX, PRINT_FIELD_U,
and PRINT_FIELD_XVAL.
2017-07-09 18:43:34 +00:00
571aa19eb0 netlink_sock_diag: introduce PRINT_FIELD_INET_DIAG_SOCKID
* netlink_sock_diag.c (PRINT_FIELD_INET_DIAG_SOCKID): New macro.
(decode_inet_diag_req_compat, decode_inet_diag_req_v2,
decode_inet_diag_msg, decode_smc_diag_req, decode_smc_diag_msg): Use it
instead of print_inet_diag_sockid.
2017-07-09 18:43:34 +00:00
c1506a0ca6 Intorduce PRINT_FIELD_DEV
* print_fields.h (PRINT_FIELD_DEV): New macro.
* dm.c (dm_decode_device, dm_decode_dm_name_list): Use it
instead of print_dev_t.
* loop.c (decode_loop_info, decode_loop_info64): Likewise.
* netlink_sock_diag.c (decode_unix_diag_vfs): Likewise.
2017-07-09 18:43:34 +00:00
cb0ce38988 Intorduce PRINT_FIELD_INET4_ADDR
* print_fields.h (PRINT_FIELD_INET4_ADDR): New macro.
* msghdr.c (print_cmsg_ip_pktinfo): Use it instead of manual
tprintf statements.
* net.c (print_mreq): Likewise.
* sockaddr.c (print_sockaddr_data_in): Likewise.
2017-07-09 18:43:34 +00:00
c3d63a580f Intorduce PRINT_FIELD_NET_PORT
* print_fields.h (PRINT_FIELD_NET_PORT): New macro.
* netlink_sock_diag.c (print_inet_diag_sockid): Use it
instead of a manual tprintf statement.
* sockaddr.c (print_sockaddr_data_in, print_sockaddr_data_in6,
print_sockaddr_data_ipx): Likewise.
2017-07-09 18:43:34 +00:00
4652a842a9 Intorduce PRINT_FIELD_IFINDEX
* print_fields.h (PRINT_FIELD_IFINDEX): New macro.
* msghdr.c (print_cmsg_ip_pktinfo): Use it instead of print_ifindex.
* net.c (print_mreq6): Likewise.
* netlink_sock_diag.c (print_packet_diag_mclist,
print_inet_diag_sockid): Likewise.
* sockaddr.c (print_sockaddr_data_in6, print_sockaddr_data_ll):
Likewise.
2017-07-09 18:43:34 +00:00
b63dc54a1d Intorduce PRINT_FIELD_INET_ADDR
* print_fields.h (PRINT_FIELD_INET_ADDR): New macro.
* net.c (print_mreq6): Use it instead of print_inet_addr.
* netlink_sock_diag.c (print_inet_diag_sockid): Likewise.
* sockaddr.c (print_sockaddr_data_in6): Likewise.
2017-07-09 18:43:34 +00:00
70d8b32108 net: move print_ifindex to a separate file
* print_ifindex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* net.c (print_ifindex): Move to print_ifindex.c.
2017-07-09 18:43:34 +00:00
fdb4415f06 net: move parsers of bind, listen, and shutdown to separate files
* bind.c: New file.
* listen.c: Likewise.
* shutdown.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* net.c (SYS_FUNC(bind)): Move to bind.c.
(SYS_FUNC(listen)): Move to listen.c.
(SYS_FUNC(shutdown)): Move to shutdown.c.
2017-07-09 13:54:01 +00:00
a0470d7848 tests: check decoding of packet_diag_msg attributes
* tests/netlink_sock_diag-v.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/nlattr_packet_diag_msg.c: New file.
* tests/gen_tests.in (nlattr_packet_diag_msg): New entry.
* tests/pure_executables.list: Add nlattr_packet_diag_msg.
* tests/.gitignore: Likewise.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-09 00:21:02 +00:00
f8ce9d580c netlink: decode AF_PACKET packet_diag_msg attributes
* linux/packet_diag.h (packet_diag_info, packet_diag_mclist,
packet_diag_ring): New structures.
(PDI_*): New macros.
* netlink_sock_diag.c: Include <linux/filter.h>
and "xlat/packet_diag_info_flags.h".
(decode_packet_diag_info, decode_packet_diag_mclist,
decode_packet_diag_ring, decode_packet_diag_filter): New functions.
(packet_diag_msg_nla_decoders): New array.
(decode_packet_diag_msg): Use it.
* print_fields.h (PRINT_FIELD_QUOTED_STRING): New macro.
* xlat/packet_diag_info_flags.in: New file.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2017-07-09 00:21:02 +00:00
fd817962f9 tests: fix TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects
commit v4.17-161-gdbd0605 that adjusted TEST_NLATTR_OBJECT and
TEST_NLATTR_ARRAY for large objects, only changed the pattern
print length, large length still can be specified as nla_data_len,
resulting to output mismatch.

* tests/test_nlattr.h (TEST_NLATTR_OBJECT): Pass "plen"
both as nla_data_len and slen arguments of TEST_NLATTR_
in len < sizeof(object) case.
(TEST_NLATTR_ARRAY): Likewise, Pass "plen" both as nla_data_len
and slen arguments of TEST_NLATTR_ in len < sizeof(object[0]) case.
2017-07-09 00:14:20 +00:00
3d30063836 tests: introduce TEST_NLATTR_nla macro in test_nlattr.h
Explicitly make struct nlattr * pointer which is internal
to TEST_NLATTR_ macro available to its varadic arguments.

* tests/test_nlattr.h (TEST_NLATTR_): Rename nla to TEST_NLATTR_nla.
2017-07-09 00:06:29 +00:00
dd95f5ae69 tests: check decoding of SO_PEERCRED socket option
* tests/so_peercred.c: New file.
* tests/gen_tests.in (so_peercred): New entry.
* tests/pure_executables.list: Add so_peercred.
* tests/.gitignore: Likewise.
2017-07-08 19:27:26 +00:00
0c4052b9ca net: accept arbitrary option length for getsockopt's SO_PEERCRED
* print_fields.h (PRINT_FIELD_UID): New macro.
* net.c (print_ucred): Rewrite to match the kernel behaviour.
* NEWS: Mention this.
2017-07-08 19:27:26 +00:00
004a776777 tests: check decoding of socket filters
* tests/sock_filter-v.c: New file.
* tests/gen_tests.in (sock_filter-v): New entry.
* tests/pure_executables.list: Add sock_filter-v.
* tests/.gitignore: Likewise.
2017-07-08 14:57:44 +00:00
bc515c7f54 Implement decoding of linux socket filter programs
* bpf_sock_filter.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/skf_ad.in: New file.
* defs.h (decode_sock_fprog, print_sock_fprog): New prototypes.
* fetch_bpf_fprog.c (get_bpf_fprog_size): New mpers printer.
* net.c (print_getsockopt): Use decode_sock_fprog to print
socket filter programs for SO_GET_FILTER socket option.
(print_setsockopt): Use decode_sock_fprog and get_bpf_fprog_size
to print socket filter programs for SO_ATTACH_FILTER
and SO_ATTACH_REUSEPORT_CBPF socket options.
* NEWS: Mention this.
2017-07-08 14:57:44 +00:00
e19354d350 tests: check decoding of SO_LINGER socket option
* tests/so_linger.c: New file.
* tests/gen_tests.in (so_linger): New entry.
* tests/pure_executables.list: Add so_linger.
* tests/.gitignore: Likewise.
2017-07-08 14:57:44 +00:00
17d002a252 tests: fix print_quoted_hex output of bytes with high bit set
* tests/tests.h (print_quoted_memory, print_quoted_hex): Change the type
of first argument from "const char *" to "const void *".
* tests/print_quoted_string.c: Likewise.
(print_quoted_hex): Print bytes as unsigned char objects to avoid
unwanted sign extension.
* tests/netlink_protocol.c (send_query): Remove the cast of print_quoted_hex
first argument which is now redundant.
2017-07-08 14:57:44 +00:00
4c14d39332 net: accept arbitrary option length for getsockopt's SO_LINGER
* net.c (print_linger): Rename to print_set_linger.
(print_setsockopt): Replace print_linger with print_set_linger.
(print_get_linger): New function that accepts arbitrary option length
to match the kernel behaviour.
(print_getsockopt): Replace print_linger with print_get_linger.
* NEWS: Mention this.
2017-07-08 14:57:44 +00:00
2ccd886706 net: accept large option length for SO_LINGER
* net.c (print_linger): Allow len > sizeof(struct linger) to match
the kernel behaviour.
2017-07-08 14:57:44 +00:00
6314e1d0f1 net: fix printing of struct linger's field names
* net.c: Include "print_fields.h".
(print_linger): Print fields of struct linger using PRINT_FIELD_D.
2017-07-08 14:57:44 +00:00
657b04b83b net: enhance decoding of getsockopt's optlen argument
As the last argument of getsockopt syscall has read-write semantics,
print both user and kernel values when they differ.

* net.c (SYS_FUNC(getsockopt)): On entering syscall, fetch and save
the length specified to the kernel.  On error, print the length saved
on entering.  When the saved length and the length returned by the
kernel differ, print both values.
* NEWS: Mention this.
* tests/net-icmp_filter.c (main): Update expected output.
2017-07-08 14:57:44 +00:00
bec9f165be net: move printing of [gs]etsockopt's socklen argument to toplevel parsers
* net.c (print_getsockopt, print_setsockopt): Remove "done" label,
replace "goto done" statement with "return".
Move printing of "len" argument ...
(SYS_FUNC(getsockopt), SYS_FUNC(setsockopt)): ... here.
2017-07-08 14:57:44 +00:00
899220d28d Generalize seccomp filter parser
Linux socket filter uses almost the same classic BPF as seccomp filter,
The only difference noticeable from strace PoV is the meaning of generic
multiuse field.

Transform the parser of seccomp filters to a more generic parser
of classic BPF, parametrized with a method of parsing the generic
multiuse field in BPF_STMT.

* bpf_filter.c: New file.
* bpf_filter.h: Likewise.
* bpf_fprog.h: Likewise.
* bpf_seccomp_filter.c: Likewise.
* fetch_bpf_fprog.c: Likewise.
* fetch_seccomp_fprog.c: Remove.
* seccomp_fprog.h: Likewise.
* Makefile.am (strace_SOURCES): Add bpf_filter.c, bpf_filter.h,
bpf_fprog.h, bpf_seccomp_filter.c, and fetch_bpf_fprog.c.
Remove fetch_seccomp_fprog.c and seccomp_fprog.h.
* seccomp.c: Do not include linux/filter.h and xlat header files.
Do not define SECCOMP_RET_ACTION.
(bpf_filter, decode_bpf_code, decode_bpf_stmt, decode_bpf_jump,
print_bpf_filter, print_seccomp_fprog, print_seccomp_filter): Remove.
* defs.h (print_seccomp_filter): Rename to decode_seccomp_fprog.
(SYS_FUNC(seccomp)): Replace print_seccomp_filter
with decode_seccomp_fprog.
* prctl.c (SYS_FUNC(prctl)): Likewise.
2017-07-08 01:49:00 +00:00
cc5db1c893 Assume that <linux/filter.h> is always available
<linux/filter.h> was introduced in linux 2.1.75, way before
the minimal kernel version supported by strace.

* configure.ac (AC_CHECK_HEADERS): Remove linux/filter.h.
* seccomp.c: Assume HAVE_LINUX_FILTER_H.
* tests/prctl-seccomp-filter-v.c: Likewise.
* tests/seccomp-filter-v.c: Likewise.
* tests/seccomp-filter.c: Likewise.
2017-07-08 01:49:00 +00:00
e8eaee3563 xlat: add BPF_END to BPF_ALU opcode list
BPF_END is one of three eBPF-only opcodes for BPF_ALU class.
Other two (BPF_MOV and BPF_ARSH) has been added earlier.

* xlat/bpf_op_alu.in: Add BPF_END.
2017-07-07 16:43:41 +00:00
bf319c4f51 netlink_sock_diag: print unrecognized data in hex
* netlink_sock_diag.c (decode_family): Replace printstrn with
printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/netlink_sock_diag.c (test_odd_family_req,
test_odd_family_msg): Update expected output.
2017-07-07 16:43:41 +00:00
d331383d7d netlink: print unrecognized nlattr in hex
* nlattr.c (fetch_nlattr): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/nlattr.c (test_nlattr): Update expected output.
2017-07-07 16:43:41 +00:00
5626a08061 netlink: print unrecognized netlink messages in hex
* netlink.c (fetch_nlmsghdr): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/netlink_protocol.c (send_query): Update expected output.
2017-07-07 16:43:41 +00:00
b61dfe9a37 netlink: print unrecognized netlink payload in hex
* netlink.c (decode_payload): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/netlink_protocol.c (send_query, test_nlmsgerr,
test_nlmsg_done): Update expected output.
* tests/netlink_generic.c (test_nlmsg_type): Likewise.
2017-07-07 16:43:41 +00:00
dbb622c061 netlink: print unrecognized nlmsgerr in hex
* netlink.c (decode_nlmsgerr): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/netlink_protocol.c (test_nlmsgerr): Update expected output.
2017-07-07 16:43:41 +00:00
73698eb8f1 netlink: print unrecognized attribute data in hex
* nlattr.c (decode_nlattr_with_data): Replace printstrn
with printstr_ex and set QUOTE_FORCE_HEX flag.
* tests/tests.h (print_quoted_hex): New prototype.
* tests/print_quoted_string.c (print_quoted_hex): New function.
* tests/test_nlattr.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY): Use it
for updated expected output.  Change the type of "plen" variable
to unsigned int.
* tests/nlattr.c (test_nlattr): Update expected output.
2017-07-07 16:43:41 +00:00
8d71474ea1 tests: print quotation marks in print_quoted_memory
* tests/print_quoted_string.c (print_quoted_memory): Print opening
and closing quotation marks.
* tests/getcwd.c (main): Do not print quotation marks around
print_quoted_string.
* tests/uname.c (main): Likewise.
* tests/keyctl.c (print_quoted_string_limit): Do not print quotation
marks around print_quoted_memory.
* tests/netlink_protocol.c (send_query): Likewise.
* tests/xattr.c (main): Likewise.
2017-07-07 16:43:41 +00:00
735c2ad872 strace.1: remove misleading remark that -i option is weakly supported
Given that -i functionality is covered by pc.test, the remark that
it is weakly supported is wrong.

* strace.1 (BUGS): Remove the remark about weakly supported -i option.
2017-07-06 12:52:54 +00:00
1e4f54cd28 Post-release administrivia
* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.18-1.
* strace.spec.in: Likewise.
2017-07-06 12:50:55 +00:00
371 changed files with 17103 additions and 5537 deletions

1
.gitignore vendored
View File

@ -56,6 +56,7 @@
/strace
/strace-*.tar.gz
/strace-*.tar.xz
/strace.1
/strace.dsc
/strace.spec
/sys_func.h

View File

@ -8,4 +8,5 @@
<schwab@linux-m68k.org> <schwab@suse.de>
<thomas.de.schampheleire@gmail.com> <thomas.de_schampheleire@nokia.com>
<vda.linux@googlemail.com> <dvlasenk@redhat.com>
Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com> <edos@linux.com>
Eugene Syromyatnikov <evgsyr@gmail.com>

View File

@ -35,7 +35,7 @@ endif
if HAVE_MX32_RUNTIME
TESTS_MX32 = tests-mx32
endif
SUBDIRS = tests $(TESTS_M32) $(TESTS_MX32)
SUBDIRS = . tests $(TESTS_M32) $(TESTS_MX32)
bin_PROGRAMS = strace
man_MANS = strace.1
@ -86,9 +86,16 @@ strace_SOURCES = \
affinity.c \
aio.c \
alpha.c \
basic_filters.c \
bind.c \
bjm.c \
block.c \
bpf.c \
bpf_filter.c \
bpf_filter.h \
bpf_fprog.h \
bpf_seccomp_filter.c \
bpf_sock_filter.c \
btrfs.c \
cacheflush.c \
capability.c \
@ -107,6 +114,8 @@ strace_SOURCES = \
dyxlat.c \
empty.h \
epoll.c \
error_prints.c \
error_prints.h \
evdev.c \
eventfd.c \
execve.c \
@ -115,8 +124,9 @@ strace_SOURCES = \
fanotify.c \
fchownat.c \
fcntl.c \
fetch_seccomp_fprog.c \
fetch_bpf_fprog.c \
fetch_struct_flock.c \
fetch_struct_keyctl_kdf_params.c \
fetch_struct_mmsghdr.c \
fetch_struct_msghdr.c \
fetch_struct_stat.c \
@ -124,9 +134,11 @@ strace_SOURCES = \
fetch_struct_statfs.c \
file_handle.c \
file_ioctl.c \
fs_x_ioctl.c \
filter_qualify.c \
filter.h \
flock.c \
flock.h \
fs_x_ioctl.c \
futex.c \
gcc_compat.h \
get_robust_list.c \
@ -151,11 +163,13 @@ strace_SOURCES = \
kernel_types.h \
kexec.c \
keyctl.c \
keyctl_kdf_params.h \
ldt.c \
link.c \
linux/asm_stat.h \
linux/x32/asm_stat.h \
linux/x86_64/asm_stat.h \
listen.c \
lookup_dcookie.c \
loop.c \
lseek.c \
@ -172,16 +186,29 @@ strace_SOURCES = \
msghdr.h \
mtd.c \
native_defs.h \
negated_errno.h \
net.c \
netlink.c \
netlink.h \
netlink_crypto.c \
netlink_sock_diag.h \
netlink_inet_diag.c \
netlink_netlink_diag.c \
netlink_packet_diag.c \
netlink_route.c \
netlink_route.h \
netlink_selinux.c \
netlink_smc_diag.c \
netlink_sock_diag.c \
netlink_unix_diag.c \
nlattr.c \
nlattr.h \
nsfs.c \
nsfs.h \
nsig.h \
numa.c \
number_set.c \
number_set.h \
oldstat.c \
open.c \
or1k_atomic.c \
@ -193,7 +220,9 @@ strace_SOURCES = \
poll.c \
prctl.c \
print_dev_t.c \
print_group_req.c \
print_fields.h \
print_ifindex.c \
print_mq_attr.c \
print_msgbuf.c \
print_sg_req_info.c \
@ -212,7 +241,6 @@ strace_SOURCES = \
process_vm.c \
ptp.c \
ptrace.h \
qualify.c \
quota.c \
readahead.c \
readlink.c \
@ -223,14 +251,27 @@ strace_SOURCES = \
rt_sigframe.c \
rt_sigreturn.c \
rtc.c \
rtnl_addr.c \
rtnl_addrlabel.c \
rtnl_dcb.c \
rtnl_link.c \
rtnl_mdb.c \
rtnl_neigh.c \
rtnl_neightbl.c \
rtnl_netconf.c \
rtnl_nsid.c \
rtnl_route.c \
rtnl_rule.c \
rtnl_tc.c \
rtnl_tc_action.c \
sched.c \
sched_attr.h \
scsi.c \
seccomp.c \
seccomp_fprog.h \
sendfile.c \
sg_io_v3.c \
sg_io_v4.c \
shutdown.c \
sigaltstack.c \
sigevent.h \
signal.c \
@ -247,10 +288,15 @@ strace_SOURCES = \
statx.c \
statx.h \
strace.c \
string_to_uint.h \
string_to_uint.c \
supported_personalities.h \
swapon.c \
syscall.c \
sysctl.c \
sysent.h \
sysent_shorthand_defs.h \
sysent_shorthand_undefs.h \
sysinfo.c \
syslog.c \
sysmips.c \
@ -259,6 +305,7 @@ strace_SOURCES = \
times.c \
truncate.c \
ubi.c \
ucopy.c \
uid.c \
uid16.c \
umask.c \
@ -275,6 +322,7 @@ strace_SOURCES = \
xlat.c \
xlat.h \
xmalloc.c \
xmalloc.h \
# end of strace_SOURCES
if USE_LIBUNWIND
@ -291,7 +339,7 @@ CODE_COVERAGE_GENHTML_OPTIONS = $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) \
CODE_COVERAGE_IGNORE_PATTERN = '/usr/include/*'
strace_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
strace_CFLAGS += $(CODE_COVERAGE_CFLAGS)
strace_LDADD += $(CODE_COVERAGE_LDFLAGS)
strace_LDADD += $(CODE_COVERAGE_LIBS)
# Enable this to get link map generated
#strace_LDFLAGS += -Wl,-Map=strace.mapfile
@ -855,6 +903,7 @@ sen.h: $(patsubst %,$(srcdir)/%,$(syscallent_files))
dist-hook:
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
${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)
version_regexp = $(subst .,\.,$(VERSION))

70
NEWS
View File

@ -1,3 +1,73 @@
Noteworthy changes in release 4.19 (2017-09-05)
===============================================
* Changes in behaviour
* Changed formatting of personality names on tile architecture in order
to make it in line with other multi-personality architectures.
* Changed field output order in struct v4l2_requestbuffers to improve in/out
field formatting.
* Changed handling of multiple signal= specifications in an injection
expression: multiple specification now leads to error instead of implicit
usage the last specification.
* Improvements
* Enhanced decoding of optlen argument of getsockopt syscall.
* Enhanced decoding of SO_LINGER option of getsockopt and setsockopt syscalls.
* Enhanced decoding of SO_PEERCRED option of getsockopt syscall.
* Enhanced decoding of IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP,
IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_JOIN_ANYCAST,
IPV6_LEAVE_ANYCAST, MCAST_JOIN_GROUP, and MCAST_LEAVE_GROUP options
of setsockopt syscall.
* Enhanced decoding of KEYCTL_DH_COMPUTE operation of keyctl syscall
(KDF parameters decoding).
* Implemented decoding of KEYCTL_RESTRICT_KEYRING operation of keyctl syscall.
* Enhanced decoding of UFFDIO_API ioctl command.
* Enhanced decoding of BPF_PROG_LOAD, BPF_MAP_CREATE, BPF_MAP_LOOKUP_ELEM,
and BPF_MAP_GET_NEXT_KEY commands of bpf syscall.
* Implemented decoding of linux socket filter programs specified
for SO_ATTACH_FILTER and SO_ATTACH_REUSEPORT_CBPF socket options.
* Implemented decoding of inet_diag_req_v2, inet_diag_req_compat,
packet_diag_msg, and smc_diag_msg netlink attributes of NETLINK_SOCK_DIAG.
* Implemented NETLINK_SELINUX protocol specific decoding.
* Implemented decoding of netlink message ack flags.
* Implemented decoding of nlmsgerr netlink attributes.
* Implemented basic protocol specific decoding of NETLINK_CRYPTO.
* Implemented decoding of crypto_user_alg netlink attributes
of NETLINK_CRYPTO.
* Implemented basic protocol specific decoding of addr, addrlabel, dcb, link,
mdb, neigh, neightbl, netconf, nsid, route, rule, tc, and tca messages
of NETLINK_ROUTE.
* Implemented decoding of NETLINK_KOBJECT_UEVENT messages.
* Improved handling of unexpected tracees (the ones that cloned with
CLONE_PARENT/CLONE_PTRACE or called PTRACE_TRACEME on themselves): they
are now PTRACE_DETACH'ed instead of PTRACE_CONT'ed.
* Updated lists of BPF_*, KEY_*, RWF_*, SCM_*, SO_*, and *_MAGIC constants.
* Added decoding of arch_prctl syscall on x86.
* Added decoding of seccomp, bpf, userfaultfd, membarrier, mlock2,
copy_file_range, preadv2, pwritev2, and statx on alpha.
* Added decoding of statx syscall on microblaze.
* Added decoding of s390_guarded_storage syscall on s390.
* Updated lists of ioctl commands from Linux 4.13.
* Enhanced manual page.
* Bug fixes
* Fixed printing of group_req structure on non-native personalities.
* Fixed output formatting of blkpg_ioctl_arg, dm_name_list, and iocb
structures.
* Fixed formatting of nul-terminated strings which have kernel-imposed size
limit.
* Fixed printing of paths that hit PATM_MAX limit in order to match kernel's
behaviour.
* Fixed build warnings on Android mips64.
* Fixed unused function "is_negated_errno" build warning when built
with clang.
* Fixed syscall number and arguments retrieval behaviour on sparc64 and
mips o32 after prctl(PR_SET_DUMPABLE, 0) makes PTRACE_PEEKTEXT impossible
to use if Linux kernel has commit v4.10-rc1~114^2~2.
* Fixed path tracing for execveat, symlink, symlinkat, inotify_add_watch,
and inotify_init syscalls.
* Fixed personality switch printing on sparc64 and risc-v.
Noteworthy changes in release 4.18 (2017-07-05)
===============================================

79
aio.c
View File

@ -30,6 +30,7 @@
*/
#include "defs.h"
#include "print_fields.h"
#include <linux/aio_abi.h>
SYS_FUNC(io_setup)
@ -53,21 +54,21 @@ enum iocb_sub {
};
static enum iocb_sub
tprint_lio_opcode(unsigned cmd)
tprint_lio_opcode(unsigned int cmd)
{
static const struct {
const char *name;
enum iocb_sub sub;
} cmds[] = {
{ "pread", SUB_COMMON },
{ "pwrite", SUB_COMMON },
{ "fsync", SUB_NONE },
{ "fdsync", SUB_NONE },
{ "preadx", SUB_NONE },
{ "poll", SUB_NONE },
{ "noop", SUB_NONE },
{ "preadv", SUB_VECTOR },
{ "pwritev", SUB_VECTOR },
{ "IOCB_CMD_PREAD", SUB_COMMON },
{ "IOCB_CMD_PWRITE", SUB_COMMON },
{ "IOCB_CMD_FSYNC", SUB_NONE },
{ "IOCB_CMD_FDSYNC", SUB_NONE },
{ "IOCB_CMD_PREADX", SUB_NONE },
{ "IOCB_CMD_POLL", SUB_NONE },
{ "IOCB_CMD_NOOP", SUB_NONE },
{ "IOCB_CMD_PREADV", SUB_VECTOR },
{ "IOCB_CMD_PWRITEV", SUB_VECTOR },
};
if (cmd < ARRAY_SIZE(cmds)) {
@ -75,7 +76,7 @@ tprint_lio_opcode(unsigned cmd)
return cmds[cmd].sub;
}
tprintf("%u", cmd);
tprints_comment("SUB_???");
tprints_comment("IOCB_CMD_???");
return SUB_NONE;
}
@ -84,12 +85,11 @@ print_common_flags(struct tcb *tcp, const struct iocb *cb)
{
/* IOCB_FLAG_RESFD is available since v2.6.22-rc1~47 */
#ifdef IOCB_FLAG_RESFD
if (cb->aio_flags & IOCB_FLAG_RESFD) {
tprints(", resfd=");
printfd(tcp, cb->aio_resfd);
}
if (cb->aio_flags & IOCB_FLAG_RESFD)
PRINT_FIELD_FD(", ", *cb, aio_resfd, tcp);
if (cb->aio_flags & ~IOCB_FLAG_RESFD)
tprintf(", flags=%#x", cb->aio_flags);
PRINT_FIELD_X(", ", *cb, aio_flags);
#endif
}
@ -106,19 +106,22 @@ print_iocb_header(struct tcb *tcp, const struct iocb *cb)
{
enum iocb_sub sub;
if (cb->aio_data)
tprintf("data=%#" PRIx64 ", ",
(uint64_t) cb->aio_data);
if (cb->aio_data){
PRINT_FIELD_X("", *cb, aio_data);
tprints(", ");
}
if (cb->aio_key)
tprintf("key=%u, ", cb->aio_key);
if (cb->aio_key) {
PRINT_FIELD_U("", *cb, aio_key);
tprints(", ");
}
tprints("aio_lio_opcode=");
sub = tprint_lio_opcode(cb->aio_lio_opcode);
if (cb->aio_reqprio)
tprintf(", reqprio=%hd", cb->aio_reqprio);
PRINT_FIELD_D(", ", *cb, aio_reqprio);
tprints(", fildes=");
printfd(tcp, cb->aio_fildes);
PRINT_FIELD_FD(", ", *cb, aio_fildes, tcp);
return sub;
}
@ -131,28 +134,27 @@ print_iocb(struct tcb *tcp, const struct iocb *cb)
switch (sub) {
case SUB_COMMON:
if (cb->aio_lio_opcode == 1 && iocb_is_valid(cb)) {
tprints(", str=");
printstrn(tcp, cb->aio_buf, cb->aio_nbytes);
PRINT_FIELD_STRN(", ", *cb, aio_buf,
cb->aio_nbytes, tcp);
} else {
tprintf(", buf=%#" PRIx64, (uint64_t) cb->aio_buf);
PRINT_FIELD_X(", ", *cb, aio_buf);
}
tprintf(", nbytes=%" PRIu64 ", offset=%" PRId64,
(uint64_t) cb->aio_nbytes, (int64_t) cb->aio_offset);
PRINT_FIELD_U(", ", *cb, aio_nbytes);
PRINT_FIELD_D(", ", *cb, aio_offset);
print_common_flags(tcp, cb);
break;
case SUB_VECTOR:
if (iocb_is_valid(cb)) {
tprints(", iovec=");
tprints(", aio_buf=");
tprint_iov(tcp, cb->aio_nbytes, cb->aio_buf,
cb->aio_lio_opcode == 8
? IOV_DECODE_STR
: IOV_DECODE_ADDR);
} else {
tprintf(", buf=%#" PRIx64 ", nbytes=%" PRIu64,
(uint64_t) cb->aio_buf,
(uint64_t) cb->aio_nbytes);
PRINT_FIELD_X(", ", *cb, aio_buf);
PRINT_FIELD_U(", ", *cb, aio_nbytes);
}
tprintf(", offset=%" PRId64, (int64_t) cb->aio_offset);
PRINT_FIELD_D(", ", *cb, aio_offset);
print_common_flags(tcp, cb);
break;
case SUB_NONE:
@ -204,10 +206,11 @@ print_io_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
struct io_event *event = elem_buf;
tprintf("{data=%#" PRIx64 ", obj=%#" PRIx64
", res=%" PRId64 ", res2=%" PRId64 "}",
(uint64_t) event->data, (uint64_t) event->obj,
(int64_t) event->res, (int64_t) event->res2);
PRINT_FIELD_X("{", *event, data);
PRINT_FIELD_X(", ", *event, obj);
PRINT_FIELD_D(", ", *event, res);
PRINT_FIELD_D(", ", *event, res2);
tprints("}");
return true;
}

321
basic_filters.c Normal file
View File

@ -0,0 +1,321 @@
/*
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 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 "number_set.h"
#include "filter.h"
#include <regex.h>
static bool
qualify_syscall_number(const char *s, struct number_set *set)
{
int n = string_to_uint(s);
if (n < 0)
return false;
unsigned int p;
bool done = false;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
if ((unsigned) n >= nsyscall_vec[p]) {
continue;
}
add_number_to_set_array(n, set, p);
done = true;
}
return done;
}
static void
regerror_msg_and_die(int errcode, const regex_t *preg,
const char *str, const char *pattern)
{
char buf[512];
regerror(errcode, preg, buf, sizeof(buf));
error_msg_and_die("%s: %s: %s", str, pattern, buf);
}
static bool
qualify_syscall_regex(const char *s, struct number_set *set)
{
regex_t preg;
int rc;
if ((rc = regcomp(&preg, s, REG_EXTENDED | REG_NOSUB)) != 0)
regerror_msg_and_die(rc, &preg, "regcomp", s);
unsigned int p;
bool found = false;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
unsigned int i;
for (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)
continue;
else if (rc)
regerror_msg_and_die(rc, &preg, "regexec", s);
add_number_to_set_array(i, set, p);
found = true;
}
}
regfree(&preg);
return found;
}
static unsigned int
lookup_class(const char *s)
{
static const struct {
const char *name;
unsigned int value;
} syscall_class[] = {
{ "desc", TRACE_DESC },
{ "file", TRACE_FILE },
{ "memory", TRACE_MEMORY },
{ "process", TRACE_PROCESS },
{ "signal", TRACE_SIGNAL },
{ "ipc", TRACE_IPC },
{ "network", TRACE_NETWORK },
{ "%desc", TRACE_DESC },
{ "%file", TRACE_FILE },
{ "%memory", TRACE_MEMORY },
{ "%process", TRACE_PROCESS },
{ "%signal", TRACE_SIGNAL },
{ "%ipc", TRACE_IPC },
{ "%network", TRACE_NETWORK },
{ "%stat", TRACE_STAT },
{ "%lstat", TRACE_LSTAT },
{ "%fstat", TRACE_FSTAT },
{ "%%stat", TRACE_STAT_LIKE },
{ "%statfs", TRACE_STATFS },
{ "%fstatfs", TRACE_FSTATFS },
{ "%%statfs", TRACE_STATFS_LIKE },
};
unsigned int i;
for (i = 0; i < ARRAY_SIZE(syscall_class); ++i) {
if (strcmp(s, syscall_class[i].name) == 0) {
return syscall_class[i].value;
}
}
return 0;
}
static bool
qualify_syscall_class(const char *s, struct number_set *set)
{
const unsigned int n = lookup_class(s);
if (!n)
return false;
unsigned int p;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name
|| (sysent_vec[p][i].sys_flags & n) != n) {
continue;
}
add_number_to_set_array(i, set, p);
}
}
return true;
}
static bool
qualify_syscall_name(const char *s, struct number_set *set)
{
unsigned int p;
bool found = false;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name
|| strcmp(s, sysent_vec[p][i].sys_name)) {
continue;
}
add_number_to_set_array(i, set, p);
found = true;
}
}
return found;
}
static bool
qualify_syscall(const char *token, struct number_set *set)
{
bool ignore_fail = false;
while (*token == '?') {
token++;
ignore_fail = true;
}
if (*token >= '0' && *token <= '9')
return qualify_syscall_number(token, set) || ignore_fail;
if (*token == '/')
return qualify_syscall_regex(token + 1, set) || ignore_fail;
return qualify_syscall_class(token, set)
|| qualify_syscall_name(token, set)
|| ignore_fail;
}
/*
* Add syscall numbers to SETs for each supported personality
* according to STR specification.
*/
void
qualify_syscall_tokens(const char *const str, struct number_set *const set,
const char *const name)
{
/* Clear all sets. */
clear_number_set_array(set, SUPPORTED_PERSONALITIES);
/*
* Each leading ! character means inversion
* of the remaining specification.
*/
const char *s = str;
handle_inversion:
while (*s == '!') {
invert_number_set_array(set, SUPPORTED_PERSONALITIES);
++s;
}
if (strcmp(s, "none") == 0) {
/*
* No syscall numbers are added to sets.
* Subsequent is_number_in_set* invocations
* will return set[p]->not.
*/
return;
} else if (strcmp(s, "all") == 0) {
s = "!none";
goto handle_inversion;
}
/*
* Split the string into comma separated tokens.
* For each token, call qualify_syscall that will take care
* if adding appropriate syscall numbers to sets.
* The absence of tokens or a negative return code
* from qualify_syscall is a fatal error.
*/
char *copy = xstrdup(s);
char *saveptr = NULL;
const char *token;
bool done = false;
for (token = strtok_r(copy, ",", &saveptr); token;
token = strtok_r(NULL, ",", &saveptr)) {
done = qualify_syscall(token, set);
if (!done) {
error_msg_and_die("invalid %s '%s'", name, token);
}
}
free(copy);
if (!done) {
error_msg_and_die("invalid %s '%s'", name, str);
}
}
/*
* Add numbers to SET according to STR specification.
*/
void
qualify_tokens(const char *const str, struct number_set *const set,
string_to_uint_func func, const char *const name)
{
/* Clear the set. */
clear_number_set_array(set, 1);
/*
* Each leading ! character means inversion
* of the remaining specification.
*/
const char *s = str;
handle_inversion:
while (*s == '!') {
invert_number_set_array(set, 1);
++s;
}
if (strcmp(s, "none") == 0) {
/*
* No numbers are added to the set.
* Subsequent is_number_in_set* invocations
* will return set->not.
*/
return;
} else if (strcmp(s, "all") == 0) {
s = "!none";
goto handle_inversion;
}
/*
* Split the string into comma separated tokens.
* For each token, find out the corresponding number
* by calling FUNC, and add that number to the set.
* The absence of tokens or a negative answer
* from FUNC is a fatal error.
*/
char *copy = xstrdup(s);
char *saveptr = NULL;
const char *token;
int number = -1;
for (token = strtok_r(copy, ",", &saveptr); token;
token = strtok_r(NULL, ",", &saveptr)) {
number = func(token);
if (number < 0) {
error_msg_and_die("invalid %s '%s'", name, token);
}
add_number_to_set(number, set);
}
free(copy);
if (number < 0) {
error_msg_and_die("invalid %s '%s'", name, str);
}
}

43
bind.c Normal file
View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 1999-2017 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"
SYS_FUNC(bind)
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
const int addrlen = tcp->u_arg[2];
decode_sockaddr(tcp, tcp->u_arg[1], addrlen);
tprintf(", %d", addrlen);
return RVAL_DECODED;
}

48
block.c
View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2011-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -66,6 +67,8 @@ typedef struct blk_user_trace_setup {
#include MPERS_DEFS
#include "print_fields.h"
#ifndef BLKPG
# define BLKPG _IO(0x12, 105)
#endif
@ -123,21 +126,17 @@ print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg)
{
struct_blkpg_partition p;
tprints("{");
printxval(blkpg_ops, blkpg->op, "BLKPG_???");
tprintf(", flags=%d, datalen=%d, data=",
blkpg->flags, blkpg->datalen);
PRINT_FIELD_XVAL("{", *blkpg, op, blkpg_ops, "BLKPG_???");
PRINT_FIELD_D(", ", *blkpg, flags);
PRINT_FIELD_D(", ", *blkpg, datalen);
tprints(", data=");
if (!umove_or_printaddr(tcp, ptr_to_kulong(blkpg->data), &p)) {
tprintf("{start=%" PRId64 ", length=%" PRId64
", pno=%d, devname=",
p.start, p.length, p.pno);
print_quoted_string(p.devname, sizeof(p.devname),
QUOTE_0_TERMINATED);
tprints(", volname=");
print_quoted_string(p.volname, sizeof(p.volname),
QUOTE_0_TERMINATED);
PRINT_FIELD_D("{", p, start);
PRINT_FIELD_D(", ", p, length);
PRINT_FIELD_D(", ", p, pno);
PRINT_FIELD_CSTRING(", ", p, devname);
PRINT_FIELD_CSTRING(", ", p, volname);
tprints("}");
}
tprints("}");
@ -240,21 +239,18 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
tprints(", ");
if (umove_or_printaddr(tcp, arg, &buts))
break;
tprintf("{act_mask=%u, buf_size=%u, "
"buf_nr=%u, start_lba=%" PRIu64 ", "
"end_lba=%" PRIu64 ", pid=%u",
(unsigned)buts.act_mask, buts.buf_size,
buts.buf_nr, buts.start_lba,
buts.end_lba, buts.pid);
return 1;
PRINT_FIELD_U("{", buts, act_mask);
PRINT_FIELD_U(", ", buts, buf_size);
PRINT_FIELD_U(", ", buts, buf_nr);
PRINT_FIELD_U(", ", buts, start_lba);
PRINT_FIELD_U(", ", buts, end_lba);
PRINT_FIELD_U(", ", buts, pid);
return 0;
} else {
struct_blk_user_trace_setup buts;
if (!syserror(tcp) && !umove(tcp, arg, &buts)) {
tprints(", name=");
print_quoted_string(buts.name, sizeof(buts.name),
QUOTE_0_TERMINATED);
}
if (!syserror(tcp) && !umove(tcp, arg, &buts))
PRINT_FIELD_CSTRING(", ", buts, name);
tprints("}");
break;
}
@ -270,5 +266,5 @@ MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp,
return RVAL_DECODED;
}
return RVAL_DECODED | 1;
return RVAL_IOCTL_DECODED;
}

468
bpf.c
View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2017 Quentin Monnet <quentin.monnet@6wind.com>
* All rights reserved.
*
@ -27,6 +27,7 @@
*/
#include "defs.h"
#include "print_fields.h"
#ifdef HAVE_LINUX_BPF_H
# include <linux/bpf.h>
@ -34,39 +35,101 @@
#include "xlat/bpf_commands.h"
#include "xlat/bpf_map_types.h"
#include "xlat/bpf_map_flags.h"
#include "xlat/bpf_prog_types.h"
#include "xlat/bpf_prog_flags.h"
#include "xlat/bpf_map_update_elem_flags.h"
#include "xlat/bpf_attach_type.h"
#include "xlat/bpf_attach_flags.h"
#define DECL_BPF_CMD_DECODER(bpf_cmd_decoder) \
int \
bpf_cmd_decoder(struct tcb *const tcp, \
const kernel_ulong_t addr, \
const unsigned int size, \
void *const data) \
/* End of DECL_BPF_CMD_DECODER definition. */
#define DEF_BPF_CMD_DECODER(bpf_cmd) \
static DECL_BPF_CMD_DECODER(decode_ ## bpf_cmd)
#define BPF_CMD_ENTRY(bpf_cmd) \
[bpf_cmd] = decode_ ## bpf_cmd
typedef DECL_BPF_CMD_DECODER((*bpf_cmd_decoder_t));
static int
bpf_map_create(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
decode_attr_extra_data(struct tcb *const tcp,
const char *data,
unsigned int size,
const size_t attr_size)
{
if (size <= attr_size)
return 0;
data += attr_size;
size -= attr_size;
unsigned int i;
for (i = 0; i < size; ++i) {
if (data[i]) {
tprints(", ");
if (abbrev(tcp))
tprints("...");
else
print_quoted_string(data, size,
QUOTE_FORCE_HEX);
return RVAL_DECODED;
}
}
return 0;
}
DEF_BPF_CMD_DECODER(BPF_MAP_CREATE)
{
struct {
uint32_t map_type, key_size, value_size, max_entries;
uint32_t map_type, key_size, value_size, max_entries,
map_flags, inner_map_fd;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
if (!size) {
printaddr(addr);
return RVAL_DECODED | RVAL_FD;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED | RVAL_FD;
memcpy(&attr, data, len);
tprints("{map_type=");
printxval(bpf_map_types, attr.map_type, "BPF_MAP_TYPE_???");
tprintf(", key_size=%u, value_size=%u, max_entries=%u}",
attr.key_size, attr.value_size, attr.max_entries);
PRINT_FIELD_XVAL("{", 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);
PRINT_FIELD_FLAGS(", ", attr, map_flags, bpf_map_flags, "BPF_F_???");
PRINT_FIELD_FD(", ", attr, inner_map_fd, tcp);
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED | RVAL_FD;
}
static void
bpf_map_update_elem(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
DEF_BPF_CMD_DECODER(BPF_MAP_LOOKUP_ELEM)
{
struct bpf_io_elem_struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key, value;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
memcpy(&attr, data, len);
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
PRINT_FIELD_X(", ", attr, value);
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED;
}
DEF_BPF_CMD_DECODER(BPF_MAP_UPDATE_ELEM)
{
struct {
uint32_t map_fd;
@ -74,233 +137,192 @@ bpf_map_update_elem(struct tcb *const tcp, const kernel_ulong_t addr,
uint64_t ATTRIBUTE_ALIGNED(8) value;
uint64_t flags;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
if (!size) {
printaddr(addr);
return;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return;
memcpy(&attr, data, len);
tprints("{map_fd=");
printfd(tcp, attr.map_fd);
tprintf(", key=%#" PRIx64 ", value=%#" PRIx64 ", flags=",
attr.key, attr.value);
printxval64(bpf_map_update_elem_flags, attr.flags, "BPF_???");
tprints("}");
}
static void
bpf_map_delete_elem(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
} attr = {};
if (!size) {
printaddr(addr);
return;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return;
tprints("{map_fd=");
printfd(tcp, attr.map_fd);
tprintf(", key=%#" PRIx64 "}", attr.key);
}
static int
bpf_map_io(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int size,
const char *const text)
{
struct bpf_io_elem_struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
uint64_t ATTRIBUTE_ALIGNED(8) value;
} attr = {};
if (exiting(tcp)) {
if (!syserror(tcp) && !umove_or_printaddr(tcp, addr, &attr))
tprintf(", %s=%#" PRIx64, text, attr.value);
tprints("}");
return RVAL_DECODED;
}
if (!size) {
printaddr(addr);
return RVAL_DECODED;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED;
tprints("{map_fd=");
printfd(tcp, attr.map_fd);
tprintf(", key=%#" PRIx64, attr.key);
return 0;
}
static int
bpf_prog_load(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint32_t prog_type, insn_cnt;
uint64_t ATTRIBUTE_ALIGNED(8) insns, license;
uint32_t log_level, log_size;
uint64_t ATTRIBUTE_ALIGNED(8) log_buf;
uint32_t kern_version;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED | RVAL_FD;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED | RVAL_FD;
tprints("{prog_type=");
printxval(bpf_prog_types, attr.prog_type, "BPF_PROG_TYPE_???");
tprintf(", insn_cnt=%u, insns=%#" PRIx64 ", license=",
attr.insn_cnt, attr.insns);
printstr(tcp, attr.license);
tprintf(", log_level=%u, log_size=%u, log_buf=%#" PRIx64 ", kern_version=%u}",
attr.log_level, attr.log_size, attr.log_buf, attr.kern_version);
return RVAL_DECODED | RVAL_FD;
}
static int
bpf_obj_manage(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
{
struct {
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
uint32_t bpf_fd;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED | RVAL_FD;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED | RVAL_FD;
tprints("{pathname=");
printpath(tcp, attr.pathname);
tprints(", bpf_fd=");
printfd(tcp, attr.bpf_fd);
tprints("}");
return RVAL_DECODED | RVAL_FD;
}
static int
bpf_prog_attach_detach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size, bool print_attach)
{
struct {
uint32_t target_fd, attach_bpf_fd, attach_type, attach_flags;
} attr = {};
if (!size) {
printaddr(addr);
return RVAL_DECODED;
}
if (size > sizeof(attr))
size = sizeof(attr);
if (umoven_or_printaddr(tcp, addr, size, &attr))
return RVAL_DECODED;
tprints("{target_fd=");
printfd(tcp, attr.target_fd);
if (print_attach) {
tprints(", attach_bpf_fd=");
printfd(tcp, attr.attach_bpf_fd);
}
tprints(", attach_type=");
printxval(bpf_attach_type, attr.attach_type, "BPF_???");
if (print_attach) {
tprints(", attach_flags=");
printflags(bpf_attach_flags, attr.attach_flags, "BPF_F_???");
}
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_???");
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED;
}
static int
bpf_prog_attach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
DEF_BPF_CMD_DECODER(BPF_MAP_DELETE_ELEM)
{
return bpf_prog_attach_detach(tcp, addr, size, true);
struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
memcpy(&attr, data, len);
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED;
}
static int
bpf_prog_detach(struct tcb *const tcp, const kernel_ulong_t addr,
unsigned int size)
DEF_BPF_CMD_DECODER(BPF_MAP_GET_NEXT_KEY)
{
return bpf_prog_attach_detach(tcp, addr, size, false);
struct bpf_io_elem_struct {
uint32_t map_fd;
uint64_t ATTRIBUTE_ALIGNED(8) key, next_key;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
memcpy(&attr, data, len);
PRINT_FIELD_FD("{", attr, map_fd, tcp);
PRINT_FIELD_X(", ", attr, key);
PRINT_FIELD_X(", ", attr, next_key);
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED;
}
DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)
{
struct bpf_prog_load {
uint32_t prog_type, insn_cnt;
uint64_t ATTRIBUTE_ALIGNED(8) insns, license;
uint32_t log_level, log_size;
uint64_t ATTRIBUTE_ALIGNED(8) log_buf;
uint32_t kern_version, prog_flags;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
memcpy(&attr, data, len);
PRINT_FIELD_XVAL("{", attr, prog_type, bpf_prog_types,
"BPF_PROG_TYPE_???");
PRINT_FIELD_U(", ", attr, insn_cnt);
PRINT_FIELD_X(", ", attr, insns);
PRINT_FIELD_STR(", ", attr, license, tcp);
PRINT_FIELD_U(", ", attr, log_level);
PRINT_FIELD_U(", ", attr, log_size);
PRINT_FIELD_X(", ", attr, log_buf);
PRINT_FIELD_U(", ", attr, kern_version);
PRINT_FIELD_FLAGS(", ", attr, prog_flags, bpf_prog_flags, "BPF_F_???");
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED | RVAL_FD;
}
DEF_BPF_CMD_DECODER(BPF_OBJ_PIN)
{
struct bpf_obj {
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
uint32_t bpf_fd;
} attr = {};
const size_t attr_size =
offsetofend(struct bpf_obj, bpf_fd);
const unsigned int len = size < attr_size ? size : attr_size;
memcpy(&attr, data, len);
PRINT_FIELD_PATH("{", attr, pathname, tcp);
PRINT_FIELD_FD(", ", attr, bpf_fd, tcp);
decode_attr_extra_data(tcp, data, size, attr_size);
tprints("}");
return RVAL_DECODED | RVAL_FD;
}
#define decode_BPF_OBJ_GET decode_BPF_OBJ_PIN
DEF_BPF_CMD_DECODER(BPF_PROG_ATTACH)
{
struct {
uint32_t target_fd, attach_bpf_fd, attach_type, attach_flags;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
memcpy(&attr, data, len);
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_FLAGS(", ", attr, attach_flags, bpf_attach_flags,
"BPF_F_???");
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED;
}
DEF_BPF_CMD_DECODER(BPF_PROG_DETACH)
{
struct {
uint32_t target_fd, dummy, attach_type;
} attr = {};
const unsigned int len = size < sizeof(attr) ? size : sizeof(attr);
memcpy(&attr, data, len);
PRINT_FIELD_FD("{", attr, target_fd, tcp);
PRINT_FIELD_XVAL(", ", attr, attach_type, bpf_attach_type, "BPF_???");
decode_attr_extra_data(tcp, data, size, sizeof(attr));
tprints("}");
return RVAL_DECODED;
}
SYS_FUNC(bpf)
{
static const bpf_cmd_decoder_t bpf_cmd_decoders[] = {
BPF_CMD_ENTRY(BPF_MAP_CREATE),
BPF_CMD_ENTRY(BPF_MAP_LOOKUP_ELEM),
BPF_CMD_ENTRY(BPF_MAP_UPDATE_ELEM),
BPF_CMD_ENTRY(BPF_MAP_DELETE_ELEM),
BPF_CMD_ENTRY(BPF_MAP_GET_NEXT_KEY),
BPF_CMD_ENTRY(BPF_PROG_LOAD),
BPF_CMD_ENTRY(BPF_OBJ_PIN),
BPF_CMD_ENTRY(BPF_OBJ_GET),
BPF_CMD_ENTRY(BPF_PROG_ATTACH),
BPF_CMD_ENTRY(BPF_PROG_DETACH),
};
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 = RVAL_DECODED;
int rc;
if (entering(tcp)) {
static size_t page_size;
static char *buf;
if (!buf) {
page_size = get_pagesize();
buf = xmalloc(page_size);
}
printxval(bpf_commands, cmd, "BPF_???");
tprints(", ");
}
switch (cmd) {
case BPF_MAP_CREATE:
rc = bpf_map_create(tcp, addr, size);
break;
case BPF_MAP_LOOKUP_ELEM:
rc = bpf_map_io(tcp, addr, size, "value");
break;
case BPF_MAP_UPDATE_ELEM:
bpf_map_update_elem(tcp, addr, size);
break;
case BPF_MAP_DELETE_ELEM:
bpf_map_delete_elem(tcp, addr, size);
break;
case BPF_MAP_GET_NEXT_KEY:
rc = bpf_map_io(tcp, addr, size, "next_key");
break;
case BPF_PROG_LOAD:
rc = bpf_prog_load(tcp, addr, size);
break;
case BPF_OBJ_PIN:
rc = bpf_obj_manage(tcp, addr, size);
break;
case BPF_OBJ_GET:
rc = bpf_obj_manage(tcp, addr, size);
break;
case BPF_PROG_ATTACH:
rc = bpf_prog_attach(tcp, addr, size);
break;
case BPF_PROG_DETACH:
rc = bpf_prog_detach(tcp, addr, size);
break;
default:
printaddr(addr);
break;
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;
}
} else {
rc = bpf_cmd_decoders[cmd](tcp, addr, size, NULL) | RVAL_DECODED;
}
if (rc & RVAL_DECODED)

170
bpf_filter.c Normal file
View File

@ -0,0 +1,170 @@
/*
* Decoder of classic BPF programs.
*
* Copyright (c) 2015-2017 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.
*/
#include "defs.h"
#include "bpf_filter.h"
#include "bpf_fprog.h"
#include <linux/filter.h>
#include "xlat/bpf_class.h"
#include "xlat/bpf_miscop.h"
#include "xlat/bpf_mode.h"
#include "xlat/bpf_op_alu.h"
#include "xlat/bpf_op_jmp.h"
#include "xlat/bpf_rval.h"
#include "xlat/bpf_size.h"
#include "xlat/bpf_src.h"
static void
print_bpf_filter_code(const uint16_t code)
{
uint16_t i = code & ~BPF_CLASS(code);
printxval(bpf_class, BPF_CLASS(code), "BPF_???");
switch (BPF_CLASS(code)) {
case BPF_LD:
case BPF_LDX:
tprints("|");
printxval(bpf_size, BPF_SIZE(code), "BPF_???");
tprints("|");
printxval(bpf_mode, BPF_MODE(code), "BPF_???");
break;
case BPF_ST:
case BPF_STX:
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
}
break;
case BPF_ALU:
tprints("|");
printxval(bpf_src, BPF_SRC(code), "BPF_???");
tprints("|");
printxval(bpf_op_alu, BPF_OP(code), "BPF_???");
break;
case BPF_JMP:
tprints("|");
printxval(bpf_src, BPF_SRC(code), "BPF_???");
tprints("|");
printxval(bpf_op_jmp, BPF_OP(code), "BPF_???");
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);
if (i) {
tprintf("|%#x", i);
tprints_comment("BPF_???");
}
break;
}
}
static void
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);
tprints(", ");
if (!print_k || !print_k(filter))
tprintf("%#x", filter->k);
tprints(")");
}
static void
print_bpf_filter_jump(const struct bpf_filter_block *const filter)
{
tprints("BPF_JUMP(");
print_bpf_filter_code(filter->code);
tprintf(", %#x, %#x, %#x)", filter->k, filter->jt, filter->jf);
}
struct bpf_filter_block_data {
const print_bpf_filter_fn fn;
unsigned int count;
};
static bool
print_bpf_filter_block(struct tcb *const tcp, void *const elem_buf,
const size_t elem_size, void *const data)
{
const struct bpf_filter_block *const filter = elem_buf;
struct bpf_filter_block_data *const fbd = data;
if (fbd->count++ >= BPF_MAXINSNS) {
tprints("...");
return false;
}
if (filter->jt || filter->jf)
print_bpf_filter_jump(filter);
else
print_bpf_filter_stmt(filter, fbd->fn);
return true;
}
void
print_bpf_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned short len, const print_bpf_filter_fn print_k)
{
if (abbrev(tcp)) {
printaddr(addr);
} else {
struct bpf_filter_block_data fbd = { .fn = print_k };
struct bpf_filter_block filter;
print_array(tcp, addr, len, &filter, sizeof(filter),
umoven_or_printaddr, print_bpf_filter_block, &fbd);
}
}
void
decode_bpf_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
const print_bpf_filter_fn print_k)
{
struct bpf_fprog fprog;
if (fetch_bpf_fprog(tcp, addr, &fprog)) {
tprintf("{len=%hu, filter=", fprog.len);
print_bpf_fprog(tcp, fprog.filter, fprog.len, print_k);
tprints("}");
}
}

50
bpf_filter.h Normal file
View File

@ -0,0 +1,50 @@
/*
* Classic BPF filter block.
*
* Copyright (c) 2015-2017 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_BPF_FILTER_H
#define STRACE_BPF_FILTER_H
struct bpf_filter_block {
uint16_t code;
uint8_t jt;
uint8_t jf;
uint32_t k;
};
typedef bool (*print_bpf_filter_fn)(const struct bpf_filter_block *);
extern void
print_bpf_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned short len, const print_bpf_filter_fn print_k);
extern void
decode_bpf_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
const print_bpf_filter_fn print_k);
#endif /* !STRACE_BPF_FILTER_H */

9
bpf_fprog.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef STRACE_BPF_FPROG_H
#define STRACE_BPF_FPROG_H
struct bpf_fprog {
unsigned short len;
kernel_ulong_t filter;
};
#endif /* !STRACE_BPF_FPROG_H */

71
bpf_seccomp_filter.c Normal file
View File

@ -0,0 +1,71 @@
/*
* Decoder of seccomp filter programs.
*
* Copyright (c) 2015-2017 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.
*/
#include "defs.h"
#include "bpf_filter.h"
#include <linux/filter.h>
#ifdef HAVE_LINUX_SECCOMP_H
# include <linux/seccomp.h>
#endif
#ifndef SECCOMP_RET_ACTION
# define SECCOMP_RET_ACTION 0x7fff0000U
#endif
#include "xlat/seccomp_ret_action.h"
static bool
print_seccomp_filter_k(const struct bpf_filter_block *const fp)
{
if (BPF_CLASS(fp->code) == BPF_RET) {
unsigned int action = SECCOMP_RET_ACTION & fp->k;
unsigned int data = fp->k & ~action;
printxval(seccomp_ret_action, action, "SECCOMP_RET_???");
if (data)
tprintf("|%#x", data);
return true;
}
return false;
}
void
print_seccomp_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned short len)
{
print_bpf_fprog(tcp, addr, len, print_seccomp_filter_k);
}
void
decode_seccomp_fprog(struct tcb *const tcp, const kernel_ulong_t addr)
{
decode_bpf_fprog(tcp, addr, print_seccomp_filter_k);
}

71
bpf_sock_filter.c Normal file
View File

@ -0,0 +1,71 @@
/*
* Decoder of socket filter programs.
*
* Copyright (c) 2017 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.
*/
#include "defs.h"
#include "bpf_filter.h"
#include <linux/filter.h>
#include "xlat/skf_ad.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+");
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);
return true;
} else if (fp->k >= (unsigned int) SKF_LL_OFF) {
tprintf("%s+%u", "SKF_LL_OFF",
fp->k - (unsigned int) SKF_LL_OFF);
return true;
}
}
return false;
}
void
print_sock_fprog(struct tcb *const tcp, const kernel_ulong_t addr,
const unsigned short len)
{
print_bpf_fprog(tcp, addr, len, print_sock_filter_k);
}
void
decode_sock_fprog(struct tcb *const tcp, const kernel_ulong_t addr)
{
decode_bpf_fprog(tcp, addr, print_sock_filter_k);
}

32
btrfs.c
View File

@ -52,6 +52,7 @@ typedef struct btrfs_ioctl_vol_args_v2
#ifdef HAVE_LINUX_BTRFS_H
#include "print_fields.h"
#include <linux/fs.h>
/*
@ -646,10 +647,9 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
if (valid)
tprintf("uuid=%s, ", uuid);
tprintf("bytes_used=%" PRI__u64
", total_bytes=%" PRI__u64 ", path=",
", total_bytes=%" PRI__u64,
args.bytes_used, args.total_bytes);
print_quoted_string((const char *)args.path, sizeof(args.path),
QUOTE_0_TERMINATED);
PRINT_FIELD_CSTRING(", ", args, path);
tprints("}");
break;
}
@ -680,14 +680,12 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
(uint64_t) args.start.cont_reading_from_srcdev_mode);
str = (const char *) args.start.srcdev_name;
print_quoted_string(str,
sizeof(args.start.srcdev_name),
QUOTE_0_TERMINATED);
print_quoted_cstring(str,
sizeof(args.start.srcdev_name));
tprints(", tgtdev_name=");
str = (const char *) args.start.tgtdev_name;
print_quoted_string(str,
sizeof(args.start.tgtdev_name),
QUOTE_0_TERMINATED);
print_quoted_cstring(str,
sizeof(args.start.tgtdev_name));
tprints("}");
}
@ -901,9 +899,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints(", ");
}
tprints("name=");
print_quoted_string(args.name, sizeof(args.name),
QUOTE_0_TERMINATED);
PRINT_FIELD_CSTRING("", args, name);
tprints("}");
break;
}
@ -1279,9 +1275,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints("{fd=");
printfd(tcp, args.fd);
tprints(", name=");
print_quoted_string(args.name, sizeof(args.name),
QUOTE_0_TERMINATED);
PRINT_FIELD_CSTRING(", ", args, name);
tprints("}");
break;
}
@ -1313,9 +1307,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
btrfs_print_qgroup_inherit(tcp,
ptr_to_kulong(args.qgroup_inherit));
}
tprints(", name=");
print_quoted_string(args.name, sizeof(args.name),
QUOTE_0_TERMINATED);
PRINT_FIELD_CSTRING(", ", args, name);
tprints("}");
return 0;
}
@ -1333,7 +1325,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
tprints(", ");
if (umove_or_printaddr(tcp, arg, &label))
break;
print_quoted_string(label, sizeof(label), QUOTE_0_TERMINATED);
print_quoted_cstring(label, sizeof(label));
break;
}
@ -1353,6 +1345,6 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
default:
return RVAL_DECODED;
};
return RVAL_DECODED | 1;
return RVAL_IOCTL_DECODED;
}
#endif /* HAVE_LINUX_BTRFS_H */

View File

@ -37,12 +37,12 @@ AC_INIT([strace],
[strace],
[https://strace.io])
m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year]))
m4_define([manpage_date], m4_esyscmd([./file-date-gen strace.1.in]))
AC_COPYRIGHT([Copyright (c) 1999-]copyright_year[ The strace developers.])
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests])
AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests 1.13])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
@ -64,6 +64,9 @@ AX_CODE_COVERAGE
AC_DEFINE([COPYRIGHT_YEAR], "[copyright_year]", [Current copyright year.])
AC_SUBST([COPYRIGHT_YEAR], [copyright_year])
AC_DEFINE([MANPAGE_DATE], "[manpage_date]", [Date])
AC_SUBST([MANPAGE_DATE], [manpage_date])
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
@ -265,6 +268,7 @@ AC_TYPE_UID_T
AC_CHECK_FUNCS(m4_normalize([
accept4
be64toh
fallocate
fanotify_mark
fopen64
@ -321,6 +325,18 @@ AC_CHECK_TYPES(m4_normalize([
[#include <sys/types.h>
#include <linux/fcntl.h>])
AC_CHECK_TYPES(m4_normalize([
struct crypto_report_aead,
struct crypto_report_blkcipher,
struct crypto_report_cipher,
struct crypto_report_hash,
struct crypto_report_rng
]),,, [#include <linux/cryptouser.h>])
AC_CHECK_TYPES(m4_normalize([
struct keyctl_kdf_params
]),,, [#include <linux/keyctl.h>])
AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
@ -362,17 +378,21 @@ AC_CHECK_HEADERS(m4_normalize([
elf.h
inttypes.h
linux/bsg.h
linux/cryptouser.h
linux/dm-ioctl.h
linux/dqblk_xfs.h
linux/falloc.h
linux/fib_rules.h
linux/fiemap.h
linux/filter.h
linux/genetlink.h
linux/hiddev.h
linux/if_addr.h
linux/if_link.h
linux/ip_vs.h
linux/ipc.h
linux/mmtimer.h
linux/msg.h
linux/neighbour.h
linux/netfilter/nfnetlink.h
linux/nsfs.h
linux/perf_event.h
@ -421,61 +441,59 @@ AC_CHECK_HEADERS([linux/input.h], [
])
AC_CHECK_HEADERS([linux/bpf.h], [
AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
[st_cv_have_union_bpf_attr_log_buf],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .log_buf = 0 };]])],
[st_cv_have_union_bpf_attr_log_buf=yes],
[st_cv_have_union_bpf_attr_log_buf=no])])
if test $st_cv_have_union_bpf_attr_log_buf = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
[Define to 1 if union bpf_attr.log_buf initialization works])
fi
AC_CACHE_CHECK([whether union bpf_attr.bpf_fd initialization works],
[st_cv_have_union_bpf_attr_bpf_fd],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .bpf_fd = 0 };]])],
[st_cv_have_union_bpf_attr_bpf_fd=yes],
[st_cv_have_union_bpf_attr_bpf_fd=no])])
if test $st_cv_have_union_bpf_attr_bpf_fd = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_BPF_FD, [1],
[Define to 1 if union bpf_attr.bpf_fd initialization works])
fi
AC_CACHE_CHECK([whether union bpf_attr.attach_flags initialization works],
[st_cv_have_union_bpf_attr_attach_flags],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
[[union bpf_attr a = { .attach_flags = 0 };]])],
[st_cv_have_union_bpf_attr_attach_flags=yes],
[st_cv_have_union_bpf_attr_attach_flags=no])])
if test $st_cv_have_union_bpf_attr_attach_flags = yes; then
AC_DEFINE(HAVE_UNION_BPF_ATTR_ATTACH_FLAGS, [1],
[Define to 1 if union bpf_attr.attach_flags initialization works])
fi
st_CHECK_UNION_BPF_ATTR([attach_flags])
st_CHECK_UNION_BPF_ATTR([bpf_fd])
st_CHECK_UNION_BPF_ATTR([flags])
st_CHECK_UNION_BPF_ATTR([inner_map_fd])
st_CHECK_UNION_BPF_ATTR([prog_flags])
])
AC_CHECK_TYPES([struct br_port_msg],,, [#include <linux/if_bridge.h>])
AC_CHECK_TYPES([struct dcbmsg],,, [#include <linux/dcbnl.h>])
AC_CHECK_TYPES([struct ifaddrlblmsg],,, [#include <linux/if_addrlabel.h>])
AC_CHECK_TYPES([struct netconfmsg],,, [#include <linux/netconf.h>])
AC_CHECK_TYPES(m4_normalize([
struct rta_mfc_stats,
struct rtvia
]),,, [#include <linux/rtnetlink.h>])
AC_CHECK_MEMBERS([struct ndt_stats.ndts_table_fulls],,, [#include <linux/neighbour.h>])
AC_CHECK_TYPES(m4_normalize([
struct ndt_config,
struct ndt_stats
]),,, [#include <linux/neighbour.h>])
AC_CHECK_TYPES(m4_normalize([
struct ifla_bridge_id,
struct ifla_port_vsi,
struct rtnl_link_stats64
]),,, [#include <linux/if_link.h>])
AC_CHECK_MEMBERS(m4_normalize([
struct rtnl_link_stats.rx_nohandler,
struct rtnl_link_stats64.rx_nohandler
]),,, [#include <linux/if_link.h>])
AC_CHECK_TYPES([struct fib_rule_uid_range],,, [#include <linux/fib_rules.h>])
AC_CHECK_TYPES([struct statfs], [
AC_CHECK_MEMBERS([struct statfs.f_frsize],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs.f_flags],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs.f_fsid.val],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,, [#include <linux/types.h>
AC_CHECK_MEMBERS(m4_normalize([
struct statfs.f_frsize,
struct statfs.f_flags,
struct statfs.f_fsid.val,
struct statfs.f_fsid.__val
]),,, [#include <linux/types.h>
#include <asm/statfs.h>])
],, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_TYPES([struct statfs64], [
AC_CHECK_MEMBERS([struct statfs64.f_frsize],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs64.f_flags],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs64.f_fsid.val],,, [#include <linux/types.h>
#include <asm/statfs.h>])
AC_CHECK_MEMBERS([struct statfs64.f_fsid.__val],,, [#include <linux/types.h>
AC_CHECK_MEMBERS(m4_normalize([
struct statfs64.f_frsize,
struct statfs64.f_flags,
struct statfs64.f_fsid.val,
struct statfs64.f_fsid.__val
]),,, [#include <linux/types.h>
#include <asm/statfs.h>])
],, [#include <linux/types.h>
#include <asm/statfs.h>])
@ -835,6 +853,7 @@ AC_CONFIG_FILES([Makefile
tests/Makefile
tests-m32/Makefile
tests-mx32/Makefile
strace.1
strace.spec
debian/changelog])
AC_OUTPUT

View File

@ -13,7 +13,7 @@ year=
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
[ -n "${year}" ] ||
year="$(git show --format=format:%cd --no-patch --date=format:%Y)"
year="$(date +%Y -d "$(git show --format=format:%cD --no-patch)")"
[ -n "${year}" ] || year="${DEFAULT_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.18-1) unstable; urgency=medium
* New upstream version.
-- Dmitry V. Levin <ldv@altlinux.org> Wed, 05 Jul 2017 07:08:09 +0000
strace (4.17-1) unstable; urgency=medium
* New upstream version.

186
defs.h
View File

@ -53,11 +53,15 @@
#include <time.h>
#include <sys/time.h>
#include "kernel_types.h"
#include "error_prints.h"
#include "gcc_compat.h"
#include "kernel_types.h"
#include "macros.h"
#include "mpers_type.h"
#include "string_to_uint.h"
#include "supported_personalities.h"
#include "sysent.h"
#include "xmalloc.h"
#ifndef HAVE_STRERROR
const char *strerror(int);
@ -71,11 +75,6 @@ const char *strerror(int);
extern char *stpcpy(char *dst, const char *src);
#endif
#ifndef offsetofend
# define offsetofend(type, member) \
(offsetof(type, member) + sizeof(((type *)NULL)->member))
#endif
/* macros */
#ifndef MAX
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
@ -139,27 +138,6 @@ extern char *stpcpy(char *dst, const char *src);
# define ERESTART_RESTARTBLOCK 516
#endif
#if defined X86_64
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY2_WORDSIZE 4
# define PERSONALITY2_KLONGSIZE PERSONALITY0_KLONGSIZE
#elif defined AARCH64 \
|| defined POWERPC64 \
|| defined RISCV \
|| defined SPARC64 \
|| defined TILE \
|| defined X32
# define SUPPORTED_PERSONALITIES 2
#else
# define SUPPORTED_PERSONALITIES 1
#endif
#if defined TILE && defined __tilepro__
# define DEFAULT_PERSONALITY 1
#else
# define DEFAULT_PERSONALITY 0
#endif
#define PERSONALITY0_WORDSIZE SIZEOF_LONG
#define PERSONALITY0_KLONGSIZE SIZEOF_KERNEL_LONG_T
#define PERSONALITY0_INCLUDE_PRINTERS_DECLS "native_printer_decls.h"
@ -170,6 +148,11 @@ extern char *stpcpy(char *dst, const char *src);
# define PERSONALITY1_KLONGSIZE PERSONALITY1_WORDSIZE
#endif
#if SUPPORTED_PERSONALITIES > 2
# define PERSONALITY2_WORDSIZE 4
# define PERSONALITY2_KLONGSIZE PERSONALITY0_KLONGSIZE
#endif
#if SUPPORTED_PERSONALITIES > 1 && defined HAVE_M32_MPERS
# define PERSONALITY1_INCLUDE_PRINTERS_DECLS "m32_printer_decls.h"
# define PERSONALITY1_INCLUDE_PRINTERS_DEFS "m32_printer_defs.h"
@ -197,15 +180,22 @@ typedef struct ioctlent {
unsigned int code;
} struct_ioctlent;
struct inject_opts {
uint16_t first;
uint16_t step;
#define INJECT_F_SIGNAL 1
#define INJECT_F_RETVAL 2
struct inject_data {
uint16_t flags;
uint16_t signo;
int rval;
};
struct inject_opts {
uint16_t first;
uint16_t step;
struct inject_data data;
};
#define MAX_ERRNO_VALUE 4095
#define INJECT_OPTS_RVAL_DEFAULT (-(MAX_ERRNO_VALUE + 1))
/* Trace Control Block */
struct tcb {
@ -270,38 +260,47 @@ struct tcb {
#define QUAL_VERBOSE 0x004 /* decode the structures of this syscall */
#define QUAL_RAW 0x008 /* print all args in hex for this syscall */
#define QUAL_INJECT 0x010 /* tamper with this system call on purpose */
#define QUAL_SIGNAL 0x100 /* report events with this signal */
#define QUAL_READ 0x200 /* dump data read from this file descriptor */
#define QUAL_WRITE 0x400 /* dump data written to this file descriptor */
#define DEFAULT_QUAL_FLAGS (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE)
#define entering(tcp) (!((tcp)->flags & TCB_INSYSCALL))
#define exiting(tcp) ((tcp)->flags & TCB_INSYSCALL)
#define syserror(tcp) ((tcp)->u_error != 0)
#define traced(tcp) ((tcp)->qual_flg & QUAL_TRACE)
#define verbose(tcp) ((tcp)->qual_flg & QUAL_VERBOSE)
#define abbrev(tcp) ((tcp)->qual_flg & QUAL_ABBREV)
#define raw(tcp) ((tcp)->qual_flg & QUAL_RAW)
#define inject(tcp) ((tcp)->qual_flg & QUAL_INJECT)
#define filtered(tcp) ((tcp)->flags & TCB_FILTERED)
#define hide_log(tcp) ((tcp)->flags & TCB_HIDE_LOG)
#include "xlat.h"
extern const struct xlat addrfams[];
extern const struct xlat arp_hardware_types[];
extern const struct xlat at_flags[];
extern const struct xlat clocknames[];
extern const struct xlat dirent_types[];
extern const struct xlat ethernet_protocols[];
extern const struct xlat evdev_abs[];
extern const struct xlat iffflags[];
extern const struct xlat inet_protocols[];
extern const struct xlat ip_type_of_services[];
extern const struct xlat msg_flags[];
extern const struct xlat netlink_protocols[];
extern const struct xlat nl_route_types[];
extern const struct xlat open_access_modes[];
extern const struct xlat open_mode_flags[];
extern const struct xlat resource_flags[];
extern const struct xlat routing_scopes[];
extern const struct xlat routing_table_ids[];
extern const struct xlat routing_types[];
extern const struct xlat setns_types[];
extern const struct xlat sg_io_info[];
extern const struct xlat socketlayers[];
extern const struct xlat socktypes[];
extern const struct xlat tcp_state_flags[];
extern const struct xlat tcp_states[];
extern const struct xlat whence_codes[];
/* Format of syscall return values */
@ -316,6 +315,8 @@ extern const struct xlat whence_codes[];
#define RVAL_NONE 040 /* Print nothing */
#define RVAL_DECODED 0100 /* syscall decoding finished */
#define RVAL_IOCTL_DECODED 0200 /* ioctl sub-parser successfully decoded
the argument */
#define IOCTL_NUMBER_UNKNOWN 0
#define IOCTL_NUMBER_HANDLED 1
@ -370,8 +371,11 @@ extern unsigned int qflag;
extern bool not_failing_only;
extern unsigned int show_fd_path;
/* are we filtering traces based on paths? */
extern const char **paths_selected;
#define tracing_paths (paths_selected != NULL)
extern struct path_set {
const char **paths_selected;
unsigned int num_selected;
} global_path_set;
#define tracing_paths (global_path_set.num_selected != 0)
extern unsigned xflag;
extern unsigned followfork;
#ifdef USE_LIBUNWIND
@ -384,23 +388,6 @@ extern unsigned os_release;
#undef KERNEL_VERSION
#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void error_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void error_msg_and_help(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void perror_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
void *xcalloc(size_t nmemb, size_t size)
ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1, 2));
void *xreallocarray(void *ptr, size_t nmemb, size_t size)
ATTRIBUTE_ALLOC_SIZE((2, 3));
char *xstrdup(const char *str) ATTRIBUTE_MALLOC;
char *xstrndup(const char *str, size_t n) ATTRIBUTE_MALLOC;
extern int read_int_from_file(const char *, int *);
extern void set_sortby(const char *);
@ -497,8 +484,12 @@ extern long getrval2(struct tcb *);
#endif
extern const char *signame(const int);
extern void pathtrace_select(const char *);
extern int pathtrace_match(struct tcb *);
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)
extern int getfdpath(struct tcb *, int, char *, unsigned);
extern unsigned long getfdinode(struct tcb *, int);
extern enum sock_proto getfdproto(struct tcb *, int);
@ -515,15 +506,6 @@ void dyxlat_add_pair(struct dyxlat *, uint64_t val, const char *str, size_t len)
const struct xlat *genl_families_xlat(void);
extern unsigned long get_pagesize(void);
extern int
string_to_uint_ex(const char *str, char **endptr,
unsigned int max_val, const char *accepted_ending);
extern int string_to_uint(const char *str);
static inline int
string_to_uint_upto(const char *const str, unsigned int max_val)
{
return string_to_uint_ex(str, NULL, max_val, NULL);
}
extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits);
/*
@ -547,6 +529,7 @@ str_strip_prefix_len(const char *str, const char *prefix, size_t prefix_len)
extern int string_quote(const char *, char *, unsigned int, unsigned int);
extern int print_quoted_string(const char *, unsigned int, unsigned int);
extern int print_quoted_cstring(const char *, unsigned int);
/* a refers to the lower numbered u_arg,
* b refers to the higher numbered u_arg
@ -611,9 +594,12 @@ printpath(struct tcb *, kernel_ulong_t addr);
#define TIMESPEC_TEXT_BUFSIZE \
(sizeof(long long) * 3 * 2 + sizeof("{tv_sec=-, tv_nsec=}"))
extern void printfd(struct tcb *, int);
extern void print_sockaddr(struct tcb *, const void *sa, int len);
extern void print_sockaddr(const void *sa, int len);
extern bool
print_inet_addr(int af, const void *addr, unsigned int len, const char *var_name);
extern bool
decode_inet_addr(struct tcb *, kernel_ulong_t addr,
unsigned int len, int family, const char *var_name);
extern const char *get_sockaddr_by_inode(struct tcb *, int fd, unsigned long inode);
extern bool print_sockaddr_by_inode(struct tcb *, int fd, unsigned long inode);
extern void print_dirfd(struct tcb *, int);
@ -644,15 +630,22 @@ extern void tprint_open_modes(unsigned int);
extern const char *sprint_open_modes(unsigned int);
extern void
print_seccomp_filter(struct tcb *, kernel_ulong_t addr);
decode_seccomp_fprog(struct tcb *, kernel_ulong_t addr);
extern void
print_seccomp_fprog(struct tcb *, kernel_ulong_t addr, unsigned short len);
extern void
decode_sock_fprog(struct tcb *, kernel_ulong_t addr);
extern void
print_sock_fprog(struct tcb *, kernel_ulong_t addr, unsigned short len);
struct strace_stat;
extern void print_struct_stat(struct tcb *, const struct strace_stat *const st);
struct strace_statfs;
struct strace_keyctl_kdf_params;
extern void
print_struct_statfs(struct tcb *, kernel_ulong_t addr);
@ -662,18 +655,14 @@ print_struct_statfs64(struct tcb *, kernel_ulong_t addr, kernel_ulong_t size);
extern void print_ifindex(unsigned int);
struct number_set;
extern struct number_set read_set;
extern struct number_set write_set;
extern struct number_set signal_set;
extern bool is_number_in_set(unsigned int number, const struct number_set *);
extern void qualify(const char *);
extern unsigned int qual_flags(const unsigned int);
#define DECL_IOCTL(name) \
extern int \
name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg)
name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg) \
/* End of DECL_IOCTL definition. */
DECL_IOCTL(dm);
DECL_IOCTL(file);
DECL_IOCTL(fs_x);
@ -690,12 +679,17 @@ extern int decode_sg_io_v4(struct tcb *, const kernel_ulong_t arg);
struct nlmsghdr;
typedef bool (*netlink_decoder_t)(struct tcb *, const struct nlmsghdr *,
kernel_ulong_t addr, kernel_ulong_t len);
kernel_ulong_t addr, unsigned int len);
#define DECL_NETLINK(name) \
extern bool \
decode_netlink_ ## name(struct tcb *, const struct nlmsghdr *, \
kernel_ulong_t addr, kernel_ulong_t len)
kernel_ulong_t addr, unsigned int len) \
/* End of DECL_NETLINK definition. */
DECL_NETLINK(crypto);
DECL_NETLINK(route);
DECL_NETLINK(selinux);
DECL_NETLINK(sock_diag);
extern int tv_nz(const struct timeval *);
@ -832,7 +826,9 @@ extern unsigned current_klongsize;
#define DECL_PRINTNUM(name) \
extern bool \
printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
ATTRIBUTE_FORMAT((printf, 3, 0))
ATTRIBUTE_FORMAT((printf, 3, 0)) \
/* End of DECL_PRINTNUM definition. */
DECL_PRINTNUM(short);
DECL_PRINTNUM(int);
DECL_PRINTNUM(int64);
@ -840,7 +836,9 @@ DECL_PRINTNUM(int64);
#define DECL_PRINTNUM_ADDR(name) \
extern bool \
printnum_addr_ ## name(struct tcb *, kernel_ulong_t addr)
printnum_addr_ ## name(struct tcb *, kernel_ulong_t addr) \
/* End of DECL_PRINTNUM_ADDR definition. */
DECL_PRINTNUM_ADDR(int);
DECL_PRINTNUM_ADDR(int64);
#undef DECL_PRINTNUM_ADDR
@ -889,7 +887,9 @@ extern bool printnum_addr_klong_int(struct tcb *, kernel_ulong_t addr);
#define DECL_PRINTPAIR(name) \
extern bool \
printpair_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
ATTRIBUTE_FORMAT((printf, 3, 0))
ATTRIBUTE_FORMAT((printf, 3, 0)) \
/* End of DECL_PRINTPAIR definition. */
DECL_PRINTPAIR(int);
DECL_PRINTPAIR(int64);
#undef DECL_PRINTPAIR
@ -1011,34 +1011,4 @@ scno_is_valid(kernel_ulong_t scno)
#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp)
#if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
# define PRI_kl "ll"
#else
# define PRI_kl "l"
#endif
#define PRI_kld PRI_kl"d"
#define PRI_klu PRI_kl"u"
#define PRI_klx PRI_kl"x"
/*
* The kernel used to define 64-bit types on 64-bit systems on a per-arch
* basis. Some architectures would use unsigned long and others would use
* unsigned long long. These types were exported as part of the
* kernel-userspace ABI and now must be maintained forever. This matches
* what the kernel exports for each architecture so we don't need to cast
* every printing of __u64 or __s64 to stdint types.
*/
#if SIZEOF_LONG == 4
# define PRI__64 "ll"
#elif defined ALPHA || defined IA64 || defined MIPS || defined POWERPC
# define PRI__64 "l"
#else
# define PRI__64 "ll"
#endif
#define PRI__d64 PRI__64"d"
#define PRI__u64 PRI__64"u"
#define PRI__x64 PRI__64"x"
#endif /* !STRACE_DEFS_H */

View File

@ -132,10 +132,7 @@ SYS_FUNC(getdents)
zero_extend_signed_to_ull(d->d_off),
d->d_reclen);
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
print_quoted_cstring(d->d_name, d_name_len);
tprints(", d_type=");
if (oob)

View File

@ -105,10 +105,7 @@ SYS_FUNC(getdents64)
printxval(dirent_types, d->d_type, "DT_???");
tprints(", d_name=");
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
print_quoted_cstring(d->d_name, d_name_len);
tprints("}");
}

76
dm.c
View File

@ -35,6 +35,7 @@
#ifdef HAVE_LINUX_DM_IOCTL_H
# include "print_fields.h"
# include <linux/dm-ioctl.h>
# include <linux/ioctl.h>
@ -62,20 +63,15 @@ dm_decode_device(const unsigned int code, const struct dm_ioctl *ioc)
case DM_LIST_VERSIONS:
break;
default:
if (ioc->dev) {
tprints(", dev=");
print_dev_t(ioc->dev);
}
if (ioc->name[0]) {
tprints(", name=");
print_quoted_string(ioc->name, DM_NAME_LEN,
QUOTE_0_TERMINATED);
}
if (ioc->uuid[0]) {
tprints(", uuid=");
print_quoted_string(ioc->uuid, DM_UUID_LEN,
QUOTE_0_TERMINATED);
}
if (ioc->dev)
PRINT_FIELD_DEV(", ", *ioc, dev);
if (ioc->name[0])
PRINT_FIELD_CSTRING(", ", *ioc, name);
if (ioc->uuid[0])
PRINT_FIELD_CSTRING(", ", *ioc, uuid);
break;
}
}
@ -87,8 +83,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code,
if (entering(tcp)) {
switch (code) {
case DM_TABLE_LOAD:
tprintf(", target_count=%" PRIu32,
ioc->target_count);
PRINT_FIELD_U(", ", *ioc, target_count);
break;
case DM_DEV_SUSPEND:
if (ioc->flags & DM_SUSPEND_FLAG)
@ -97,8 +92,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code,
case DM_DEV_RENAME:
case DM_DEV_REMOVE:
case DM_DEV_WAIT:
tprintf(", event_nr=%" PRIu32,
ioc->event_nr);
PRINT_FIELD_U(", ", *ioc, event_nr);
break;
}
} else if (!syserror(tcp)) {
@ -113,12 +107,9 @@ dm_decode_values(struct tcb *tcp, const unsigned int code,
case DM_TABLE_DEPS:
case DM_TABLE_STATUS:
case DM_TARGET_MSG:
tprintf(", target_count=%" PRIu32,
ioc->target_count);
tprintf(", open_count=%" PRIu32,
ioc->open_count);
tprintf(", event_nr=%" PRIu32,
ioc->event_nr);
PRINT_FIELD_U(", ", *ioc, target_count);
PRINT_FIELD_U(", ", *ioc, open_count);
PRINT_FIELD_U(", ", *ioc, event_nr);
break;
}
}
@ -129,8 +120,7 @@ dm_decode_values(struct tcb *tcp, const unsigned int code,
static void
dm_decode_flags(const struct dm_ioctl *ioc)
{
tprints(", flags=");
printflags(dm_flags, ioc->flags, "DM_???");
PRINT_FIELD_FLAGS(", ", *ioc, flags, dm_flags, "DM_???");
}
static void
@ -171,15 +161,13 @@ dm_decode_dm_target_spec(struct tcb *const tcp, const kernel_ulong_t addr,
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprintf("{sector_start=%" PRI__u64 ", length=%" PRI__u64,
s.sector_start, s.length);
PRINT_FIELD_U("{", s, sector_start);
PRINT_FIELD_U(", ", s, length);
if (exiting(tcp))
tprintf(", status=%" PRId32, s.status);
PRINT_FIELD_D(", ", s, status);
tprints(", target_type=");
print_quoted_string(s.target_type, DM_MAX_TYPE_NAME,
QUOTE_0_TERMINATED);
PRINT_FIELD_CSTRING(", ", s, target_type);
tprints(", string=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
@ -242,8 +230,9 @@ dm_decode_dm_target_deps(struct tcb *const tcp, const kernel_ulong_t addr,
if (s.count > space)
goto misplaced;
tprintf("{count=%u, deps=", s.count);
PRINT_FIELD_U("{", s, count);
tprints(", deps=");
print_array(tcp, addr + offset_end, s.count, &dev_buf, sizeof(dev_buf),
umoven_or_printaddr, dm_print_dev, NULL);
@ -294,10 +283,8 @@ dm_decode_dm_name_list(struct tcb *const tcp, const kernel_ulong_t addr,
if (umove_or_printaddr(tcp, addr + offset, &s))
break;
tprints("{dev=");
print_dev_t(s.dev);
tprints("name=");
PRINT_FIELD_DEV("{", s, dev);
tprints(", name=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
@ -397,7 +384,8 @@ dm_decode_dm_target_msg(struct tcb *const tcp, const kernel_ulong_t addr,
if (umove_or_printaddr(tcp, addr + offset, &s))
return;
tprintf("{sector=%" PRI__u64 ", message=", s.sector);
PRINT_FIELD_U("{", s, sector);
tprints(", message=");
printstr_ex(tcp, addr + offset_end, ioc->data_size - offset_end,
QUOTE_0_TERMINATED);
tprints("}");
@ -491,7 +479,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code,
}
if (exiting(tcp) && syserror(tcp) && !ioc_changed)
return 1;
return RVAL_IOCTL_DECODED;
/*
* device mapper code uses %d in some places and %u in another, but
@ -508,7 +496,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code,
goto skip;
}
tprintf(", data_size=%u", ioc->data_size);
PRINT_FIELD_U(", ", *ioc, data_size);
if (ioc->data_size < offsetof(struct dm_ioctl, data)) {
tprints_comment("data_size too small");
@ -516,7 +504,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code,
}
if (dm_ioctl_has_params(code))
tprintf(", data_start=%u", ioc->data_start);
PRINT_FIELD_U(", ", *ioc, data_start);
dm_decode_device(code, ioc);
dm_decode_values(tcp, code, ioc);
@ -565,7 +553,7 @@ dm_known_ioctl(struct tcb *const tcp, const unsigned int code,
skip:
tprints("}");
return 1;
return entering(tcp) ? 0 : RVAL_IOCTL_DECODED;
}
int
@ -590,7 +578,7 @@ dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t ar
case DM_DEV_SET_GEOMETRY:
return dm_known_ioctl(tcp, code, arg);
default:
return 0;
return RVAL_DECODED;
}
}
@ -599,7 +587,7 @@ dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t ar
int
dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
{
return 0;
return RVAL_DECODED;
}
# endif /* DM_VERSION_MAJOR == 4 */

123
error_prints.c Normal file
View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 1999-2017 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.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "error_prints.h"
extern char *program_invocation_name;
static void
verror_msg(int err_no, const char *fmt, va_list p)
{
char *msg;
fflush(NULL);
/* We want to print entire message with single fprintf to ensure
* message integrity if stderr is shared with other programs.
* Thus we use vasprintf + single fprintf.
*/
msg = NULL;
if (vasprintf(&msg, fmt, p) >= 0) {
if (err_no)
fprintf(stderr, "%s: %s: %s\n",
program_invocation_name, msg, strerror(err_no));
else
fprintf(stderr, "%s: %s\n",
program_invocation_name, msg);
free(msg);
} else {
/* malloc in vasprintf failed, try it without malloc */
fprintf(stderr, "%s: ", program_invocation_name);
vfprintf(stderr, fmt, p);
if (err_no)
fprintf(stderr, ": %s\n", strerror(err_no));
else
putc('\n', stderr);
}
/* We don't switch stderr to buffered, thus fprintf(stderr)
* always flushes its output and this is not necessary: */
/* fflush(stderr); */
}
void
error_msg(const char *fmt, ...)
{
va_list p;
va_start(p, fmt);
verror_msg(0, fmt, p);
va_end(p);
}
void
error_msg_and_die(const char *fmt, ...)
{
va_list p;
va_start(p, fmt);
verror_msg(0, fmt, p);
die();
}
void
error_msg_and_help(const char *fmt, ...)
{
if (fmt != NULL) {
va_list p;
va_start(p, fmt);
verror_msg(0, fmt, p);
}
fprintf(stderr, "Try '%s -h' for more information.\n",
program_invocation_name);
die();
}
void
perror_msg(const char *fmt, ...)
{
va_list p;
va_start(p, fmt);
verror_msg(errno, fmt, p);
va_end(p);
}
void
perror_msg_and_die(const char *fmt, ...)
{
va_list p;
va_start(p, fmt);
verror_msg(errno, fmt, p);
die();
}

49
error_prints.h Normal file
View File

@ -0,0 +1,49 @@
/*
* This file contains error printing functions.
* These functions can be used by various binaries included in the strace
* package. Variable 'program_invocation_name' and function 'die()'
* have to be defined globally.
*
* Copyright (c) 2001-2017 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.
*/
#ifndef STRACE_ERROR_PRINTS_H
#define STRACE_ERROR_PRINTS_H
#include "gcc_compat.h"
void die(void) ATTRIBUTE_NORETURN;
void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void perror_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void error_msg_and_help(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void error_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
#endif /* !STRACE_ERROR_PRINTS_H */

45
evdev.c
View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2015 Etienne Gemsa <etienne.gemsa@lse.epita.fr>
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -83,7 +84,7 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
struct_ff_effect ffe;
if (umove_or_printaddr(tcp, arg, &ffe))
return 1;
return RVAL_IOCTL_DECODED;
tprints("{type=");
printxval(evdev_ff_types, ffe.type, "FF_???");
@ -94,7 +95,7 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
if (abbrev(tcp)) {
tprints("...}");
return 1;
return RVAL_IOCTL_DECODED;
}
tprintf("trigger={button=%" PRIu16
@ -150,7 +151,7 @@ ff_effect_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
tprints("}");
return 1;
return RVAL_IOCTL_DECODED;
}
static int
@ -184,7 +185,7 @@ abs_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
tprints("}");
}
return 1;
return RVAL_IOCTL_DECODED;
}
static int
@ -200,7 +201,7 @@ keycode_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
tprints("]");
}
return 1;
return RVAL_IOCTL_DECODED;
}
# ifdef EVIOCGKEYCODE_V2
@ -212,7 +213,7 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
struct input_keymap_entry ike;
if (umove_or_printaddr(tcp, arg, &ike))
return 1;
return RVAL_IOCTL_DECODED;
tprintf("{flags=%" PRIu8
", len=%" PRIu8 ", ",
@ -237,7 +238,7 @@ keycode_V2_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
tprints("}");
return 1;
return RVAL_IOCTL_DECODED;
}
# endif /* EVIOCGKEYCODE_V2 */
@ -258,7 +259,7 @@ getid_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
id.product,
id.version);
return 1;
return RVAL_IOCTL_DECODED;
}
static int
@ -276,7 +277,7 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
char decoded_arg[size];
if (umove_or_printaddr(tcp, arg, &decoded_arg))
return 1;
return RVAL_IOCTL_DECODED;
tprints("[");
@ -300,7 +301,7 @@ decode_bitset(struct tcb *const tcp, const kernel_ulong_t arg,
tprints("]");
return 1;
return RVAL_IOCTL_DECODED;
}
# ifdef EVIOCGMTSLOTS
@ -313,13 +314,13 @@ mtslots_ioctl(struct tcb *const tcp, const unsigned int code,
const size_t size = _IOC_SIZE(code) / sizeof(int);
if (!size) {
printaddr(arg);
return 1;
return RVAL_IOCTL_DECODED;
}
int buffer[size];
if (umove_or_printaddr(tcp, arg, &buffer))
return 1;
return RVAL_IOCTL_DECODED;
tprints("{code=");
printxval(evdev_mtslots, buffer[0], "ABS_MT_???");
@ -332,7 +333,7 @@ mtslots_ioctl(struct tcb *const tcp, const unsigned int code,
tprints("]}");
return 1;
return RVAL_IOCTL_DECODED;
}
# endif /* EVIOCGMTSLOTS */
@ -342,7 +343,7 @@ repeat_ioctl(struct tcb *const tcp, const kernel_ulong_t arg)
{
tprints(", ");
printpair_int(tcp, arg, "%u");
return 1;
return RVAL_IOCTL_DECODED;
}
# endif /* EVIOCGREP || EVIOCSREP */
@ -386,14 +387,14 @@ bit_ioctl(struct tcb *const tcp, const unsigned int ev_nr,
case EV_PWR:
tprints(", ");
printnum_int(tcp, arg, "%d");
return 1;
return RVAL_IOCTL_DECODED;
case EV_FF_STATUS:
return decode_bitset(tcp, arg, evdev_ff_status,
FF_STATUS_MAX, "FF_STATUS_???");
default:
tprints(", ");
printaddr(arg);
return 1;
return RVAL_IOCTL_DECODED;
}
}
@ -406,11 +407,11 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code,
case EVIOCGVERSION:
tprints(", ");
printnum_int(tcp, arg, "%#x");
return 1;
return RVAL_IOCTL_DECODED;
case EVIOCGEFFECTS:
tprints(", ");
printnum_int(tcp, arg, "%u");
return 1;
return RVAL_IOCTL_DECODED;
case EVIOCGID:
return getid_ioctl(tcp, arg);
# ifdef EVIOCGREP
@ -439,7 +440,7 @@ evdev_read_ioctl(struct tcb *const tcp, const unsigned int code,
printaddr(arg);
else
printstrn(tcp, arg, tcp->u_rval);
return 1;
return RVAL_IOCTL_DECODED;
# ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
return decode_bitset(tcp, arg, evdev_prop,
@ -492,18 +493,18 @@ evdev_write_ioctl(struct tcb *const tcp, const unsigned int code,
return ff_effect_ioctl(tcp, arg);
case EVIOCRMFF:
tprintf(", %d", (int) arg);
return 1;
return RVAL_IOCTL_DECODED;
case EVIOCGRAB:
# ifdef EVIOCREVOKE
case EVIOCREVOKE:
# endif
tprintf(", %" PRI_klu, arg);
return 1;
return RVAL_IOCTL_DECODED;
# ifdef EVIOCSCLOCKID
case EVIOCSCLOCKID:
tprints(", ");
printnum_int(tcp, arg, "%u");
return 1;
return RVAL_IOCTL_DECODED;
# endif
}

View File

@ -1,6 +1,5 @@
/*
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2015-2017 The strace developers.
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -28,26 +27,38 @@
#include "defs.h"
#include DEF_MPERS_TYPE(seccomp_fprog_t)
#include DEF_MPERS_TYPE(struct_sock_fprog)
#include "seccomp_fprog.h"
typedef struct seccomp_fprog seccomp_fprog_t;
#include <linux/filter.h>
typedef struct sock_fprog struct_sock_fprog;
#include MPERS_DEFS
#include "bpf_fprog.h"
MPERS_PRINTER_DECL(bool, fetch_seccomp_fprog, struct tcb *const tcp,
MPERS_PRINTER_DECL(unsigned int, get_sock_fprog_size, void)
{
return sizeof(struct_sock_fprog);
}
MPERS_PRINTER_DECL(bool, fetch_bpf_fprog, struct tcb *const tcp,
const kernel_ulong_t addr, void *const p)
{
struct seccomp_fprog *pfp = p;
seccomp_fprog_t mfp;
struct bpf_fprog *pfp = p;
struct_sock_fprog mfp;
if (sizeof(*pfp) == sizeof(mfp))
if ((sizeof(*pfp) == sizeof(mfp))
&& (offsetof(struct bpf_fprog, filter) ==
offsetof(struct_sock_fprog, filter)))
return !umove_or_printaddr(tcp, addr, pfp);
if (umove_or_printaddr(tcp, addr, &mfp))
return false;
pfp->len = mfp.len;
pfp->filter = mfp.filter;
pfp->filter =
#ifndef IN_MPERS
(uintptr_t)
#endif
mfp.filter;
return true;
}

View File

@ -0,0 +1,34 @@
#include "defs.h"
#include DEF_MPERS_TYPE(struct_keyctl_kdf_params)
#include "keyctl_kdf_params.h"
typedef struct keyctl_kdf_params struct_keyctl_kdf_params;
#include MPERS_DEFS
MPERS_PRINTER_DECL(int, fetch_keyctl_kdf_params, struct tcb *const tcp,
kernel_ulong_t addr, struct strace_keyctl_kdf_params *p)
{
struct_keyctl_kdf_params kdf;
int ret;
if ((ret = umove(tcp, addr, &kdf)))
return ret;
p->hashname = (kernel_ulong_t)
#ifndef IN_MPERS
(uintptr_t)
#endif
kdf.hashname;
p->otherinfo = (kernel_ulong_t)
#ifndef IN_MPERS
(uintptr_t)
#endif
kdf.otherinfo;
p->otherinfolen = kdf.otherinfolen;
memcpy(p->__spare, kdf.__spare, sizeof(kdf.__spare));
return 0;
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

35
file-date-gen Executable file
View File

@ -0,0 +1,35 @@
#! /bin/sh
if [ "$1" = "-f" ]; then
shift
DATE_FORMAT="$1"
shift
fi
: ${FILE:=$1}
: ${DATE_FILE:=$(dirname "$FILE")/.$(basename "${FILE}").date}
: ${DEFAULT_DATE:=$2}
: ${DATE_FORMAT:=%Y-%m-%d}
date=
[ -n "${FILE}" ] || {
echo >&2 "$0 $(dirname "$0")/file [$(dirname "$0")/file.date [DEFAULT_DATE]]"
exit 1
}
[ -f "${DATE_FILE}" ] && date="$(cat "${DATE_FILE}")"
[ -n "${date}" ] ||
date="$(git log -n 1 --format=format:%cD --no-patch "${FILE}")"
[ -n "${date}" ] || year="${DEFAULT_DATE}"
[ -n "${date}" ] || date="$(date -u)"
[ -n "${date}" ] || {
echo >&2 'Undefined date.'
exit 1
}
exec printf "%s" $(date "+${DATE_FORMAT}" -d "${date}")

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -245,5 +246,5 @@ file_ioctl(struct tcb *const tcp, const unsigned int code,
return RVAL_DECODED;
};
return RVAL_DECODED | 1;
return RVAL_IOCTL_DECODED;
}

40
filter.h Normal file
View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
* Copyright (c) 2017 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.
*/
#ifndef STRACE_FILTER_H
#define STRACE_FILTER_H
struct number_set;
typedef int (*string_to_uint_func)(const char *);
void qualify_tokens(const char *str, struct number_set *set,
string_to_uint_func func, const char *name);
void qualify_syscall_tokens(const char *str, struct number_set *set,
const char *name);
#endif /* !STRACE_FILTER_H */

373
filter_qualify.c Normal file
View File

@ -0,0 +1,373 @@
/*
* Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 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 "nsig.h"
#include "number_set.h"
#include "filter.h"
struct number_set *read_set;
struct number_set *write_set;
struct number_set *signal_set;
static struct number_set *abbrev_set;
static struct number_set *inject_set;
static struct number_set *raw_set;
static struct number_set *trace_set;
static struct number_set *verbose_set;
static int
sigstr_to_uint(const char *s)
{
int i;
if (*s >= '0' && *s <= '9')
return string_to_uint_upto(s, 255);
if (strncasecmp(s, "SIG", 3) == 0)
s += 3;
for (i = 0; i <= 255; ++i) {
const char *name = signame(i);
if (strncasecmp(name, "SIG", 3) != 0)
continue;
name += 3;
if (strcasecmp(name, s) != 0)
continue;
return i;
}
return -1;
}
static int
find_errno_by_name(const char *name)
{
unsigned int i;
for (i = 1; i < nerrnos; ++i) {
if (errnoent[i] && (strcasecmp(name, errnoent[i]) == 0))
return i;
}
return -1;
}
static bool
parse_inject_token(const char *const token, struct inject_opts *const fopts,
const bool fault_tokens_only)
{
const char *val;
int intval;
if ((val = STR_STRIP_PREFIX(token, "when=")) != token) {
/*
* == 1+1
* F == F+0
* F+ == F+1
* F+S
*/
char *end;
intval = string_to_uint_ex(val, &end, 0xffff, "+");
if (intval < 1)
return false;
fopts->first = intval;
if (*end) {
val = end + 1;
if (*val) {
/* F+S */
intval = string_to_uint_upto(val, 0xffff);
if (intval < 1)
return false;
fopts->step = intval;
} else {
/* F+ == F+1 */
fopts->step = 1;
}
} else {
/* F == F+0 */
fopts->step = 0;
}
} else if ((val = STR_STRIP_PREFIX(token, "error=")) != token) {
if (fopts->data.flags & INJECT_F_RETVAL)
return false;
intval = string_to_uint_upto(val, MAX_ERRNO_VALUE);
if (intval < 0)
intval = find_errno_by_name(val);
if (intval < 1)
return false;
fopts->data.rval = -intval;
fopts->data.flags |= INJECT_F_RETVAL;
} else if (!fault_tokens_only
&& (val = STR_STRIP_PREFIX(token, "retval=")) != token) {
if (fopts->data.flags & INJECT_F_RETVAL)
return false;
intval = string_to_uint(val);
if (intval < 0)
return false;
fopts->data.rval = intval;
fopts->data.flags |= INJECT_F_RETVAL;
} else if (!fault_tokens_only
&& (val = STR_STRIP_PREFIX(token, "signal=")) != token) {
if (fopts->data.flags & INJECT_F_SIGNAL)
return false;
intval = sigstr_to_uint(val);
if (intval < 1 || intval > NSIG_BYTES * 8)
return false;
fopts->data.signo = intval;
fopts->data.flags |= INJECT_F_SIGNAL;
} else {
return false;
}
return true;
}
static char *
parse_inject_expression(const char *const s, char **buf,
struct inject_opts *const fopts,
const bool fault_tokens_only)
{
char *saveptr = NULL;
char *name = NULL;
char *token;
*buf = xstrdup(s);
for (token = strtok_r(*buf, ":", &saveptr); token;
token = strtok_r(NULL, ":", &saveptr)) {
if (!name)
name = token;
else if (!parse_inject_token(token, fopts, fault_tokens_only))
goto parse_error;
}
if (name)
return name;
parse_error:
free(*buf);
return *buf = NULL;
}
static void
qualify_read(const char *const str)
{
if (!read_set)
read_set = alloc_number_set_array(1);
qualify_tokens(str, read_set, string_to_uint, "descriptor");
}
static void
qualify_write(const char *const str)
{
if (!write_set)
write_set = alloc_number_set_array(1);
qualify_tokens(str, write_set, string_to_uint, "descriptor");
}
static void
qualify_signals(const char *const str)
{
if (!signal_set)
signal_set = alloc_number_set_array(1);
qualify_tokens(str, signal_set, sigstr_to_uint, "signal");
}
static void
qualify_trace(const char *const str)
{
if (!trace_set)
trace_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, trace_set, "system call");
}
static void
qualify_abbrev(const char *const str)
{
if (!abbrev_set)
abbrev_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, abbrev_set, "system call");
}
static void
qualify_verbose(const char *const str)
{
if (!verbose_set)
verbose_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, verbose_set, "system call");
}
static void
qualify_raw(const char *const str)
{
if (!raw_set)
raw_set = alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(str, raw_set, "system call");
}
static void
qualify_inject_common(const char *const str,
const bool fault_tokens_only,
const char *const description)
{
struct inject_opts opts = {
.first = 1,
.step = 1
};
char *buf = NULL;
char *name = parse_inject_expression(str, &buf, &opts, fault_tokens_only);
if (!name) {
error_msg_and_die("invalid %s '%s'", description, str);
}
/* If neither of retval, error, or signal is specified, then ... */
if (!opts.data.flags) {
if (fault_tokens_only) {
/* in fault= syntax the default error code is ENOSYS. */
opts.data.rval = -ENOSYS;
opts.data.flags |= INJECT_F_RETVAL;
} else {
/* in inject= syntax this is not allowed. */
error_msg_and_die("invalid %s '%s'", description, str);
}
}
struct number_set *tmp_set =
alloc_number_set_array(SUPPORTED_PERSONALITIES);
qualify_syscall_tokens(name, tmp_set, description);
free(buf);
/*
* Initialize inject_vec accourding to tmp_set.
* Merge tmp_set into inject_set.
*/
unsigned int p;
for (p = 0; p < SUPPORTED_PERSONALITIES; ++p) {
if (number_set_array_is_empty(tmp_set, p))
continue;
if (!inject_set) {
inject_set =
alloc_number_set_array(SUPPORTED_PERSONALITIES);
}
if (!inject_vec[p]) {
inject_vec[p] = xcalloc(nsyscall_vec[p],
sizeof(*inject_vec[p]));
}
unsigned int i;
for (i = 0; i < nsyscall_vec[p]; ++i) {
if (is_number_in_set_array(i, tmp_set, p)) {
add_number_to_set_array(i, inject_set, p);
inject_vec[p][i] = opts;
}
}
}
free_number_set_array(tmp_set, SUPPORTED_PERSONALITIES);
}
static void
qualify_fault(const char *const str)
{
qualify_inject_common(str, true, "fault argument");
}
static void
qualify_inject(const char *const str)
{
qualify_inject_common(str, false, "inject argument");
}
static const struct qual_options {
const char *name;
void (*qualify)(const char *);
} qual_options[] = {
{ "trace", qualify_trace },
{ "t", qualify_trace },
{ "abbrev", qualify_abbrev },
{ "a", qualify_abbrev },
{ "verbose", qualify_verbose },
{ "v", qualify_verbose },
{ "raw", qualify_raw },
{ "x", qualify_raw },
{ "signal", qualify_signals },
{ "signals", qualify_signals },
{ "s", qualify_signals },
{ "read", qualify_read },
{ "reads", qualify_read },
{ "r", qualify_read },
{ "write", qualify_write },
{ "writes", qualify_write },
{ "w", qualify_write },
{ "fault", qualify_fault },
{ "inject", qualify_inject },
};
void
qualify(const char *str)
{
const struct qual_options *opt = qual_options;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(qual_options); ++i) {
const char *name = qual_options[i].name;
const size_t len = strlen(name);
const char *val = str_strip_prefix_len(str, name, len);
if (val == str || *val != '=')
continue;
str = val + 1;
opt = &qual_options[i];
break;
}
opt->qualify(str);
}
unsigned int
qual_flags(const unsigned int scno)
{
return (is_number_in_set_array(scno, trace_set, current_personality)
? QUAL_TRACE : 0)
| (is_number_in_set_array(scno, abbrev_set, current_personality)
? QUAL_ABBREV : 0)
| (is_number_in_set_array(scno, verbose_set, current_personality)
? QUAL_VERBOSE : 0)
| (is_number_in_set_array(scno, raw_set, current_personality)
? QUAL_RAW : 0)
| (is_number_in_set_array(scno, inject_set, current_personality)
? QUAL_INJECT : 0);
}

View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -62,5 +63,5 @@ fs_x_ioctl(struct tcb *const tcp, const unsigned int code,
return RVAL_DECODED;
}
return RVAL_DECODED | 1;
return RVAL_IOCTL_DECODED;
}

3
hdio.c
View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com>
* Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
* Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -60,5 +61,5 @@ MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *const tcp,
return RVAL_DECODED;
}
return RVAL_DECODED | 1;
return RVAL_IOCTL_DECODED;
}

40
ioctl.c
View File

@ -224,6 +224,33 @@ ioctl_decode_command_number(struct tcb *tcp)
}
}
/**
* Decode arg parameter of the ioctl call.
*
* @return There are two flags of the return value important for the purposes of
* processing by SYS_FUNC(ioctl):
* - RVAL_IOCTL_DECODED: indicates that ioctl decoder code
* has printed arg parameter;
* - RVAL_DECODED: indicates that decoding is done.
* As a result, the following behaviour is expected:
* - on entering:
* - 0: decoding should be continued on exiting;
* - RVAL_IOCTL_DECODED: decoding on exiting is not needed
* and decoder has printed arg value;
* - RVAL_DECODED: decoding on exiting is not needed
* and generic handler should print arg value.
* - on exiting:
* - 0: generic handler should print arg value;
* - RVAL_IOCTL_DECODED: decoder has printed arg value.
*
* Note that it makes no sense to return just RVAL_DECODED on exiting,
* but, of course, it is not prohibited (for example, it may be useful
* in cases where the return path is common on entering and on exiting
* the syscall).
*
* SYS_FUNC(ioctl) converts RVAL_IOCTL_DECODED flag to RVAL_DECODED,
* and passes all other bits of ioctl_decode return value unchanged.
*/
static int
ioctl_decode(struct tcb *tcp)
{
@ -319,16 +346,11 @@ SYS_FUNC(ioctl)
ret = ioctl_decode(tcp) | RVAL_DECODED;
}
if (ret & RVAL_DECODED) {
ret &= ~RVAL_DECODED;
if (ret)
--ret;
else
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
if (ret & RVAL_IOCTL_DECODED) {
ret &= ~RVAL_IOCTL_DECODED;
ret |= RVAL_DECODED;
} else {
if (ret)
--ret;
} else if (ret & RVAL_DECODED) {
tprintf(", %#" PRI_klx, tcp->u_arg[2]);
}
return ret;

View File

@ -55,4 +55,36 @@ typedef struct {
char d_name[1];
} kernel_dirent;
#if SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
# define PRI_kl "ll"
#else
# define PRI_kl "l"
#endif
#define PRI_kld PRI_kl"d"
#define PRI_klu PRI_kl"u"
#define PRI_klx PRI_kl"x"
/*
* The kernel used to define 64-bit types on 64-bit systems on a per-arch
* basis. Some architectures would use unsigned long and others would use
* unsigned long long. These types were exported as part of the
* kernel-userspace ABI and now must be maintained forever. This matches
* what the kernel exports for each architecture so we don't need to cast
* every printing of __u64 or __s64 to stdint types.
* The exception is Android, where for MIPS64 unsigned long long is used.
*/
#if SIZEOF_LONG == 4
# define PRI__64 "ll"
#elif defined ALPHA || defined IA64 || defined POWERPC \
|| (defined MIPS && !defined __ANDROID__)
# define PRI__64 "l"
#else
# define PRI__64 "ll"
#endif
#define PRI__d64 PRI__64"d"
#define PRI__u64 PRI__64"u"
#define PRI__x64 PRI__64"x"
#endif /* !STRACE_KERNEL_TYPES_H */

View File

@ -28,6 +28,9 @@
#include "defs.h"
#include "keyctl_kdf_params.h"
#include "print_fields.h"
typedef int32_t key_serial_t;
#include "xlat/key_spec.h"
@ -245,12 +248,14 @@ print_dh_params(struct tcb *tcp, kernel_ulong_t addr)
static void
keyctl_dh_compute(struct tcb *tcp, kernel_ulong_t params, kernel_ulong_t buf,
kernel_ulong_t len)
kernel_ulong_t len, kernel_ulong_t kdf_addr)
{
if (entering(tcp)) {
print_dh_params(tcp, params);
tprints(", ");
} else {
struct strace_keyctl_kdf_params kdf;
if (syserror(tcp)) {
printaddr(buf);
} else {
@ -259,10 +264,64 @@ keyctl_dh_compute(struct tcb *tcp, kernel_ulong_t params, kernel_ulong_t buf,
(kernel_ulong_t) tcp->u_rval;
printstrn(tcp, buf, rval);
}
tprintf(", %llu", zero_extend_signed_to_ull(len));
tprintf(", %llu, ", zero_extend_signed_to_ull(len));
if (fetch_keyctl_kdf_params(tcp, kdf_addr, &kdf)) {
printaddr(kdf_addr);
} else {
size_t i;
PRINT_FIELD_STR("{", kdf, hashname, tcp);
/*
* Kernel doesn't touch otherinfo
* if otherinfolen is zero.
*/
if (kdf.otherinfolen)
PRINT_FIELD_STRN(", ", kdf, otherinfo,
kdf.otherinfolen, tcp);
else
PRINT_FIELD_PTR(", ", kdf, otherinfo);
PRINT_FIELD_U(", ", kdf, otherinfolen);
/* Some future-proofing */
for (i = 0; i < ARRAY_SIZE(kdf.__spare); i++) {
if (kdf.__spare[i])
break;
}
if (i < ARRAY_SIZE(kdf.__spare)) {
tprints(", __spare=[");
for (i = 0; i < ARRAY_SIZE(kdf.__spare); i++) {
if (i)
tprints(", ");
tprintf("%#x", kdf.__spare[i]);
}
tprints("]");
}
tprints("}");
}
}
}
static void
keyctl_restrict_keyring(struct tcb *const tcp,
const key_serial_t id,
const kernel_ulong_t addr1,
const kernel_ulong_t addr2)
{
print_keyring_serial_number(id);
tprints(", ");
printstr(tcp, addr1);
tprints(", ");
printstr(tcp, addr2);
}
#include "xlat/key_reqkeys.h"
#include "xlat/keyctl_commands.h"
@ -360,9 +419,13 @@ SYS_FUNC(keyctl)
break;
case KEYCTL_DH_COMPUTE:
keyctl_dh_compute(tcp, arg2, arg3, arg4);
keyctl_dh_compute(tcp, arg2, arg3, arg4, arg5);
return 0;
case KEYCTL_RESTRICT_KEYRING:
keyctl_restrict_keyring(tcp, arg2, arg3, arg4);
break;
default:
tprintf("%#" PRI_klx ", %#" PRI_klx
", %#" PRI_klx ", %#" PRI_klx,

27
keyctl_kdf_params.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef STRACE_KEYCTL_KDF_PARAMS_H
#define STRACE_KEYCTL_KDF_PARAMS_H
#include <stdint.h>
#include "kernel_types.h"
/* from include/linux/crypto.h */
#define CRYPTO_MAX_ALG_NAME 128
/* from security/keys/internal.h */
#define KEYCTL_KDF_MAX_OI_LEN 64 /* max length of otherinfo */
struct keyctl_kdf_params {
char *hashname;
char *otherinfo;
uint32_t otherinfolen;
uint32_t __spare[8];
};
struct strace_keyctl_kdf_params {
kernel_ulong_t hashname;
kernel_ulong_t otherinfo;
uint32_t otherinfolen;
uint32_t __spare[8];
};
#endif /* STRACE_KEYCTL_KDF_PARAMS_H */

View File

@ -39,6 +39,7 @@
{ "asm-generic/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTPEER", _IOC_NONE, 0x5441, 0x00 },
{ "asm-generic/ioctls.h", "TIOCGRS485", 0, 0x542E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
@ -92,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
@ -177,6 +179,10 @@
{ "drm/drm.h", "DRM_IOCTL_SG_ALLOC", _IOC_READ|_IOC_WRITE, 0x6438, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SG_FREE", _IOC_WRITE, 0x6439, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SWITCH_CTX", _IOC_WRITE, 0x6424, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_CREATE", _IOC_READ|_IOC_WRITE, 0x64bf, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_DESTROY", _IOC_READ|_IOC_WRITE, 0x64c0, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x64c2, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD", _IOC_READ|_IOC_WRITE, 0x64c1, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_UNBLOCK", _IOC_READ|_IOC_WRITE, 0x6413, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_UNLOCK", _IOC_WRITE, 0x642b, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_UPDATE_DRAW", _IOC_WRITE, 0x643f, 0x14 },
@ -399,7 +405,9 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 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_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -727,6 +735,7 @@
{ "linux/cm4000_cs.h", "CM_IOCSRDR", _IOC_NONE, 0x6303, 0x00 },
{ "linux/cm4000_cs.h", "CM_IOSDBGLVL", _IOC_WRITE, 0x63fa, 0x04 },
{ "linux/coda.h", "CIOC_KERNEL_VERSION", _IOC_READ|_IOC_WRITE, 0x630a, 0x04 },
{ "linux/dm-ioctl.h", "DM_DEV_ARM_POLL", _IOC_READ|_IOC_WRITE, 0xfd10, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_CREATE", _IOC_READ|_IOC_WRITE, 0xfd03, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_REMOVE", _IOC_READ|_IOC_WRITE, 0xfd04, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_RENAME", _IOC_READ|_IOC_WRITE, 0xfd05, 0x138 },
@ -2105,6 +2114,7 @@
{ "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_SPEED", _IOC_NONE, 0x551f, 0x00 },
{ "linux/usbdevice_fs.h", "USBDEVFS_HUB_PORTINFO", _IOC_READ, 0x5513, 0x80 },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL32", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
@ -2383,7 +2393,6 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "media/davinci/vpfe_capture.h", "VPFE_CMD_S_CCDC_RAW_PARAMS", _IOC_WRITE, 0x56c1, 0x04 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },
@ -2493,6 +2502,8 @@
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VERIFY", _IOC_READ|_IOC_WRITE, 0xca84, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_CLONE", _IOC_READ|_IOC_WRITE, 0xca89, 0x70 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_RESIZE", _IOC_READ|_IOC_WRITE, 0xca88, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_AFU_DEBUG", _IOC_READ|_IOC_WRITE, 0xcabe, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_LUN_PROVISION", _IOC_READ|_IOC_WRITE, 0xcabf, 0xa0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_BUS_NUMBER", 0, 0x5386, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_IDLUN", 0, 0x5382, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_PCI", 0, 0x5387, 0 },
@ -2611,6 +2622,7 @@
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TSTAMP", _IOC_WRITE, 0x4102, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TTSTAMP", _IOC_WRITE, 0x4103, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_UNLINK", _IOC_NONE, 0x4161, 0x00 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_USER_PVERSION", _IOC_WRITE, 0x4104, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEI_FRAMES", _IOC_WRITE, 0x4150, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEN_FRAMES", _IOC_WRITE, 0x4152, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_XRUN", _IOC_NONE, 0x4148, 0x00 },

View File

@ -39,6 +39,7 @@
{ "asm-generic/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTPEER", _IOC_NONE, 0x5441, 0x00 },
{ "asm-generic/ioctls.h", "TIOCGRS485", 0, 0x542E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
@ -92,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
@ -177,6 +179,10 @@
{ "drm/drm.h", "DRM_IOCTL_SG_ALLOC", _IOC_READ|_IOC_WRITE, 0x6438, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SG_FREE", _IOC_WRITE, 0x6439, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SWITCH_CTX", _IOC_WRITE, 0x6424, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_CREATE", _IOC_READ|_IOC_WRITE, 0x64bf, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_DESTROY", _IOC_READ|_IOC_WRITE, 0x64c0, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x64c2, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD", _IOC_READ|_IOC_WRITE, 0x64c1, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_UNBLOCK", _IOC_READ|_IOC_WRITE, 0x6413, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_UNLOCK", _IOC_WRITE, 0x642b, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_UPDATE_DRAW", _IOC_WRITE, 0x643f, 0x14 },
@ -399,7 +405,9 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 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_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -727,6 +735,7 @@
{ "linux/cm4000_cs.h", "CM_IOCSRDR", _IOC_NONE, 0x6303, 0x00 },
{ "linux/cm4000_cs.h", "CM_IOSDBGLVL", _IOC_WRITE, 0x63fa, 0x04 },
{ "linux/coda.h", "CIOC_KERNEL_VERSION", _IOC_READ|_IOC_WRITE, 0x630a, 0x04 },
{ "linux/dm-ioctl.h", "DM_DEV_ARM_POLL", _IOC_READ|_IOC_WRITE, 0xfd10, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_CREATE", _IOC_READ|_IOC_WRITE, 0xfd03, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_REMOVE", _IOC_READ|_IOC_WRITE, 0xfd04, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_RENAME", _IOC_READ|_IOC_WRITE, 0xfd05, 0x138 },
@ -2105,6 +2114,7 @@
{ "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_SPEED", _IOC_NONE, 0x551f, 0x00 },
{ "linux/usbdevice_fs.h", "USBDEVFS_HUB_PORTINFO", _IOC_READ, 0x5513, 0x80 },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL32", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
@ -2383,7 +2393,6 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "media/davinci/vpfe_capture.h", "VPFE_CMD_S_CCDC_RAW_PARAMS", _IOC_WRITE, 0x56c1, 0x04 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },
@ -2493,6 +2502,8 @@
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VERIFY", _IOC_READ|_IOC_WRITE, 0xca84, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_CLONE", _IOC_READ|_IOC_WRITE, 0xca89, 0x70 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_RESIZE", _IOC_READ|_IOC_WRITE, 0xca88, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_AFU_DEBUG", _IOC_READ|_IOC_WRITE, 0xcabe, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_LUN_PROVISION", _IOC_READ|_IOC_WRITE, 0xcabf, 0xa0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_BUS_NUMBER", 0, 0x5386, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_IDLUN", 0, 0x5382, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_PCI", 0, 0x5387, 0 },
@ -2611,6 +2622,7 @@
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TSTAMP", _IOC_WRITE, 0x4102, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TTSTAMP", _IOC_WRITE, 0x4103, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_UNLINK", _IOC_NONE, 0x4161, 0x00 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_USER_PVERSION", _IOC_WRITE, 0x4104, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEI_FRAMES", _IOC_WRITE, 0x4150, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEN_FRAMES", _IOC_WRITE, 0x4152, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_XRUN", _IOC_NONE, 0x4148, 0x00 },

View File

@ -39,6 +39,7 @@
{ "asm-generic/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTPEER", _IOC_NONE, 0x5441, 0x00 },
{ "asm-generic/ioctls.h", "TIOCGRS485", 0, 0x542E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
@ -92,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
@ -177,6 +179,10 @@
{ "drm/drm.h", "DRM_IOCTL_SG_ALLOC", _IOC_READ|_IOC_WRITE, 0x6438, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SG_FREE", _IOC_WRITE, 0x6439, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SWITCH_CTX", _IOC_WRITE, 0x6424, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_CREATE", _IOC_READ|_IOC_WRITE, 0x64bf, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_DESTROY", _IOC_READ|_IOC_WRITE, 0x64c0, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x64c2, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD", _IOC_READ|_IOC_WRITE, 0x64c1, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_UNBLOCK", _IOC_READ|_IOC_WRITE, 0x6413, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_UNLOCK", _IOC_WRITE, 0x642b, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_UPDATE_DRAW", _IOC_WRITE, 0x643f, 0x18 },
@ -399,7 +405,9 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 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_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -727,6 +735,7 @@
{ "linux/cm4000_cs.h", "CM_IOCSRDR", _IOC_NONE, 0x6303, 0x00 },
{ "linux/cm4000_cs.h", "CM_IOSDBGLVL", _IOC_WRITE, 0x63fa, 0x04 },
{ "linux/coda.h", "CIOC_KERNEL_VERSION", _IOC_READ|_IOC_WRITE, 0x630a, 0x04 },
{ "linux/dm-ioctl.h", "DM_DEV_ARM_POLL", _IOC_READ|_IOC_WRITE, 0xfd10, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_CREATE", _IOC_READ|_IOC_WRITE, 0xfd03, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_REMOVE", _IOC_READ|_IOC_WRITE, 0xfd04, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_RENAME", _IOC_READ|_IOC_WRITE, 0xfd05, 0x138 },
@ -2105,6 +2114,7 @@
{ "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_SPEED", _IOC_NONE, 0x551f, 0x00 },
{ "linux/usbdevice_fs.h", "USBDEVFS_HUB_PORTINFO", _IOC_READ, 0x5513, 0x80 },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL32", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
@ -2493,6 +2503,8 @@
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VERIFY", _IOC_READ|_IOC_WRITE, 0xca84, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_CLONE", _IOC_READ|_IOC_WRITE, 0xca89, 0x70 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_RESIZE", _IOC_READ|_IOC_WRITE, 0xca88, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_AFU_DEBUG", _IOC_READ|_IOC_WRITE, 0xcabe, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_LUN_PROVISION", _IOC_READ|_IOC_WRITE, 0xcabf, 0xa0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_BUS_NUMBER", 0, 0x5386, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_IDLUN", 0, 0x5382, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_PCI", 0, 0x5387, 0 },
@ -2611,6 +2623,7 @@
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TSTAMP", _IOC_WRITE, 0x4102, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TTSTAMP", _IOC_WRITE, 0x4103, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_UNLINK", _IOC_NONE, 0x4161, 0x00 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_USER_PVERSION", _IOC_WRITE, 0x4104, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEI_FRAMES", _IOC_WRITE, 0x4150, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEN_FRAMES", _IOC_WRITE, 0x4152, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_XRUN", _IOC_NONE, 0x4148, 0x00 },

View File

@ -28,7 +28,7 @@
[ 24] = { 3, TD, SEN(dup3), "dup3" },
[ 25] = { 3, TD, SEN(fcntl64), "fcntl64" },
[ 26] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[ 27] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[ 27] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[ 28] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[ 29] = { 3, TD, SEN(ioctl), "ioctl" },
[ 30] = { 3, 0, SEN(ioprio_set), "ioprio_set" },

View File

@ -39,6 +39,7 @@
{ "asm-generic/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTPEER", _IOC_NONE, 0x5441, 0x00 },
{ "asm-generic/ioctls.h", "TIOCGRS485", 0, 0x542E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
@ -92,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x20 },
@ -177,6 +179,10 @@
{ "drm/drm.h", "DRM_IOCTL_SG_ALLOC", _IOC_READ|_IOC_WRITE, 0x6438, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SG_FREE", _IOC_WRITE, 0x6439, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SWITCH_CTX", _IOC_WRITE, 0x6424, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_CREATE", _IOC_READ|_IOC_WRITE, 0x64bf, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_DESTROY", _IOC_READ|_IOC_WRITE, 0x64c0, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x64c2, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD", _IOC_READ|_IOC_WRITE, 0x64c1, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_UNBLOCK", _IOC_READ|_IOC_WRITE, 0x6413, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_UNLOCK", _IOC_WRITE, 0x642b, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_UPDATE_DRAW", _IOC_WRITE, 0x643f, 0x18 },
@ -399,7 +405,9 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 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_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -727,6 +735,7 @@
{ "linux/cm4000_cs.h", "CM_IOCSRDR", _IOC_NONE, 0x6303, 0x00 },
{ "linux/cm4000_cs.h", "CM_IOSDBGLVL", _IOC_WRITE, 0x63fa, 0x08 },
{ "linux/coda.h", "CIOC_KERNEL_VERSION", _IOC_READ|_IOC_WRITE, 0x630a, 0x08 },
{ "linux/dm-ioctl.h", "DM_DEV_ARM_POLL", _IOC_READ|_IOC_WRITE, 0xfd10, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_CREATE", _IOC_READ|_IOC_WRITE, 0xfd03, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_REMOVE", _IOC_READ|_IOC_WRITE, 0xfd04, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_RENAME", _IOC_READ|_IOC_WRITE, 0xfd05, 0x138 },
@ -2105,6 +2114,7 @@
{ "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_SPEED", _IOC_NONE, 0x551f, 0x00 },
{ "linux/usbdevice_fs.h", "USBDEVFS_HUB_PORTINFO", _IOC_READ, 0x5513, 0x80 },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL", _IOC_READ|_IOC_WRITE, 0x5512, 0x10 },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL32", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
@ -2383,7 +2393,6 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "media/davinci/vpfe_capture.h", "VPFE_CMD_S_CCDC_RAW_PARAMS", _IOC_WRITE, 0x56c1, 0x08 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },
@ -2493,6 +2502,8 @@
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VERIFY", _IOC_READ|_IOC_WRITE, 0xca84, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_CLONE", _IOC_READ|_IOC_WRITE, 0xca89, 0x70 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_RESIZE", _IOC_READ|_IOC_WRITE, 0xca88, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_AFU_DEBUG", _IOC_READ|_IOC_WRITE, 0xcabe, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_LUN_PROVISION", _IOC_READ|_IOC_WRITE, 0xcabf, 0xa0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_BUS_NUMBER", 0, 0x5386, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_IDLUN", 0, 0x5382, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_PCI", 0, 0x5387, 0 },
@ -2611,6 +2622,7 @@
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TSTAMP", _IOC_WRITE, 0x4102, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TTSTAMP", _IOC_WRITE, 0x4103, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_UNLINK", _IOC_NONE, 0x4161, 0x00 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_USER_PVERSION", _IOC_WRITE, 0x4104, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEI_FRAMES", _IOC_WRITE, 0x4150, 0x18 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEN_FRAMES", _IOC_WRITE, 0x4152, 0x18 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_XRUN", _IOC_NONE, 0x4148, 0x00 },

View File

@ -25,7 +25,7 @@
[ 24] = { 3, TD, SEN(dup3), "dup3" },
[ 25] = { 3, TD, SEN(fcntl), "fcntl" },
[ 26] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[ 27] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[ 27] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[ 28] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[ 29] = { 3, TD, SEN(ioctl), "ioctl" },
[ 30] = { 3, 0, SEN(ioprio_set), "ioprio_set" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
#define get_error arm_get_error
#include "arm/get_error.c"
#undef get_error

View File

@ -408,7 +408,7 @@
[442] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[443] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[444] = { 0, TD, SEN(inotify_init), "inotify_init" },
[445] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[445] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[446] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[447] = { 1, TD, SEN(fdatasync), "fdatasync" },
[448] = { 4, 0, SEN(kexec_load), "kexec_load" },
@ -477,3 +477,12 @@
[511] = { 3, 0, SEN(getrandom), "getrandom" },
[512] = { 2, TD, SEN(memfd_create), "memfd_create" },
[513] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat" },
[514] = { 3, 0, SEN(seccomp), "seccomp" },
[515] = { 3, TD, SEN(bpf), "bpf" },
[516] = { 1, TD, SEN(userfaultfd), "userfaultfd" },
[517] = { 2, 0, SEN(membarrier), "membarrier" },
[518] = { 3, TM, SEN(mlock2), "mlock2" },
[519] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[520] = { 6, TD, SEN(preadv2), "preadv2" },
[521] = { 6, TD, SEN(pwritev2), "pwritev2" },
[522] = { 5, TD|TF|TSTA, SEN(statx), "statx" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -50,12 +50,14 @@
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_CMMA_BITS", _IOC_READ|_IOC_WRITE, 0xaeb8, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_CMMA_BITS", _IOC_WRITE, 0xaeb9, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },

View File

@ -342,7 +342,7 @@
[314] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[315] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[316] = { 0, TD, SEN(inotify_init), "inotify_init" },
[317] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[317] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[318] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[319] = { 6, TM, SEN(mbind), "mbind" },
[320] = { 5, TM, SEN(get_mempolicy), "get_mempolicy" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -267,7 +267,7 @@
[238] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[239] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[240] = { 0, TD, SEN(inotify_init), "inotify_init" },
[241] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[241] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[242] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[243] = { 4, TD|TF, SEN(openat), "openat" },
[244] = { 3, TD|TF, SEN(mkdirat), "mkdirat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -318,7 +318,7 @@
[289] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[290] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[291] = { 0, TD, SEN(inotify_init), "inotify_init" },
[292] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[292] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[293] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[295] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -285,7 +285,7 @@
[289] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[290] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[291] = { 0, TD, SEN(inotify_init), "inotify_init" },
[292] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[292] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[293] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[295] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -273,7 +273,7 @@
[267] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[268] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[269] = { 0, TD, SEN(inotify_init), "inotify_init" },
[270] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[270] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[271] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[272] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[273] = { 6, TD, SEN(pselect6), "pselect6" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -74,12 +74,14 @@
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_CMMA_BITS", _IOC_READ|_IOC_WRITE, 0xaeb8, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_CMMA_BITS", _IOC_WRITE, 0xaeb9, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },

View File

@ -318,7 +318,7 @@
[289] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[290] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[291] = { 0, TD, SEN(inotify_init), "inotify_init" },
[292] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[292] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[293] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[295] = { 4, TD|TF, SEN(openat), "openat" },
@ -410,6 +410,7 @@
[381] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[382] = { 1, 0, SEN(pkey_free), "pkey_free" },
[383] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
[384] = { 2, TP, SEN(arch_prctl), "arch_prctl" },
#define SYS_socket_subcall 400
#include "subcall.h"

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -296,7 +296,7 @@
[1275] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[1276] = { 6, TM, SEN(move_pages), "move_pages" },
[1277] = { 0, TD, SEN(inotify_init), "inotify_init" },
[1278] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[1278] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[1279] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[1280] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[1281] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -39,6 +39,38 @@ enum {
INET_DIAG_REQ_BYTECODE,
};
struct inet_diag_bc_op {
unsigned char code;
unsigned char yes;
unsigned short no;
};
enum {
INET_DIAG_BC_NOP,
INET_DIAG_BC_JMP,
INET_DIAG_BC_S_GE,
INET_DIAG_BC_S_LE,
INET_DIAG_BC_D_GE,
INET_DIAG_BC_D_LE,
INET_DIAG_BC_AUTO,
INET_DIAG_BC_S_COND,
INET_DIAG_BC_D_COND,
INET_DIAG_BC_DEV_COND, /* u32 ifindex */
INET_DIAG_BC_MARK_COND,
};
struct inet_diag_hostcond {
uint8_t family;
uint8_t prefix_len;
int port;
uint32_t addr[0];
};
struct inet_diag_markcond {
uint32_t mark;
uint32_t mask;
};
/* Info structure */
struct inet_diag_msg {
uint8_t idiag_family;

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -311,7 +311,7 @@
[282] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[283] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[284] = { 0, TD, SEN(inotify_init), "inotify_init" },
[285] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[285] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[286] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[287] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[288] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -318,7 +318,7 @@
[289] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[290] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[291] = { 0, TD, SEN(inotify_init), "inotify_init" },
[292] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[292] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[293] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[295] = { 4, TD|TF, SEN(openat), "openat" },
@ -424,3 +424,4 @@
[395] = { 4, TM|SI, SEN(pkey_mprotect), "pkey_mprotect" },
[396] = { 2, 0, SEN(pkey_alloc), "pkey_alloc" },
[397] = { 1, 0, SEN(pkey_free), "pkey_free" },
[398] = { 5, TD|TF|TSTA, SEN(statx), "statx" },

View File

@ -14,11 +14,16 @@ get_syscall_args(struct tcb *tcp)
tcp->u_arg[1] = mips_REG_A1;
tcp->u_arg[2] = mips_REG_A2;
tcp->u_arg[3] = mips_REG_A3;
if (tcp->s_ent->nargs > 4) {
if (umoven(tcp, mips_REG_SP + 4 * 4,
(tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
&tcp->u_arg[4]) < 0)
return -1;
if (tcp->s_ent->nargs > 4
&& umoven(tcp, mips_REG_SP + 4 * sizeof(tcp->u_arg[0]),
(tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
&tcp->u_arg[4]) < 0) {
/*
* Let's proceed with the first 4 arguments
* instead of reporting the failure.
*/
memset(&tcp->u_arg[4], 0,
(tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]));
}
#else
# error unsupported mips abi

View File

@ -248,7 +248,7 @@
[6245] = { 5, 0, SEN(keyctl), "keyctl" },
[6246] = { 1, 0, SEN(set_thread_area), "set_thread_area" },
[6247] = { 0, TD, SEN(inotify_init), "inotify_init" },
[6248] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[6248] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[6249] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[6250] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[6251] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -244,7 +244,7 @@
[5241] = { 5, 0, SEN(keyctl), "keyctl" },
[5242] = { 1, 0, SEN(set_thread_area), "set_thread_area" },
[5243] = { 0, TD, SEN(inotify_init), "inotify_init" },
[5244] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[5244] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[5245] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[5246] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[5247] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -285,7 +285,7 @@
[4282] = { 5, 0, SEN(keyctl), "keyctl" },
[4283] = { 1, 0, SEN(set_thread_area), "set_thread_area" },
[4284] = { 0, TD, SEN(inotify_init), "inotify_init" },
[4285] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[4285] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[4286] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[4287] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[4288] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -37,4 +37,37 @@ enum {
PACKET_DIAG_FILTER,
};
struct packet_diag_info {
uint32_t pdi_index;
uint32_t pdi_version;
uint32_t pdi_reserve;
uint32_t pdi_copy_thresh;
uint32_t pdi_tstamp;
uint32_t pdi_flags;
#define PDI_RUNNING 0x1
#define PDI_AUXDATA 0x2
#define PDI_ORIGDEV 0x4
#define PDI_VNETHDR 0x8
#define PDI_LOSS 0x10
};
struct packet_diag_mclist {
uint32_t pdmc_index;
uint32_t pdmc_count;
uint16_t pdmc_type;
uint16_t pdmc_alen;
uint8_t pdmc_addr[32]; /* MAX_ADDR_LEN */
};
struct packet_diag_ring {
uint32_t pdr_block_size;
uint32_t pdr_block_nr;
uint32_t pdr_frame_size;
uint32_t pdr_frame_nr;
uint32_t pdr_retire_tmo;
uint32_t pdr_sizeof_priv;
uint32_t pdr_features;
};
#endif /* !STRACE_LINUX_PACKET_DIAG_H */

View File

@ -32,6 +32,7 @@
{ "asm/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm/ioctls.h", "TIOCGPTPEER", _IOC_NONE, 0x5441, 0x00 },
{ "asm/ioctls.h", "TIOCGRS485", 0, 0x542e, 0 },
{ "asm/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
@ -86,13 +87,6 @@
{ "asm/ps3fb.h", "PS3FB_IOCTL_ON", _IOC_NONE, 0x7204, 0x00 },
{ "asm/ps3fb.h", "PS3FB_IOCTL_SCREENINFO", _IOC_READ, 0x7203, 0x04 },
{ "asm/ps3fb.h", "PS3FB_IOCTL_SETMODE", _IOC_WRITE, 0x7201, 0x04 },
{ "asm/sockios.h", "FIOGETOWN", 0, 0x8903, 0 },
{ "asm/sockios.h", "FIOSETOWN", 0, 0x8901, 0 },
{ "asm/sockios.h", "SIOCATMARK", 0, 0x8905, 0 },
{ "asm/sockios.h", "SIOCGPGRP", 0, 0x8904, 0 },
{ "asm/sockios.h", "SIOCGSTAMP", 0, 0x8906, 0 },
{ "asm/sockios.h", "SIOCGSTAMPNS", 0, 0x8907, 0 },
{ "asm/sockios.h", "SIOCSPGRP", 0, 0x8902, 0 },
{ "linux/kvm.h", "KVM_ALLOCATE_RMA", _IOC_READ, 0xaea9, 0x08 },
{ "linux/kvm.h", "KVM_ARM_SET_DEVICE_ADDR", _IOC_WRITE, 0xaeab, 0x10 },
{ "linux/kvm.h", "KVM_ASSIGN_DEV_IRQ", _IOC_WRITE, 0xae70, 0x40 },
@ -148,12 +142,14 @@
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_CMMA_BITS", _IOC_READ|_IOC_WRITE, 0xaeb8, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_CMMA_BITS", _IOC_WRITE, 0xaeb9, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },

View File

@ -303,7 +303,7 @@
[273] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[274] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[275] = { 0, TD, SEN(inotify_init), "inotify_init" },
[276] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[276] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[277] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[278] = { 3, 0, SEN(printargs), "spu_run" },
[279] = { 4, 0, SEN(printargs), "spu_create" },

View File

@ -298,7 +298,7 @@
[273] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[274] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[275] = { 0, TD, SEN(inotify_init), "inotify_init" },
[276] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[276] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[277] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[278] = { 3, 0, SEN(printargs), "spu_run" },
[279] = { 4, 0, SEN(printargs), "spu_create" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -43,6 +43,7 @@
{ "asm/pkey.h", "PKEY_GENSECK", _IOC_READ|_IOC_WRITE, 0x7001, 0x48 },
{ "asm/pkey.h", "PKEY_SEC2PROTK", _IOC_READ|_IOC_WRITE, 0x7003, 0x8c },
{ "asm/pkey.h", "PKEY_SKEY2PKEY", _IOC_READ|_IOC_WRITE, 0x7006, 0x88 },
{ "asm/pkey.h", "PKEY_VERIFYKEY", _IOC_READ|_IOC_WRITE, 0x7007, 0x4c },
{ "asm/sclp_ctl.h", "SCLP_CTL_SCCB", _IOC_READ|_IOC_WRITE, 0x1010, 0x0c },
{ "asm/tape390.h", "TAPE390_CRYPT_QUERY", _IOC_READ, 0x6403, 0x03 },
{ "asm/tape390.h", "TAPE390_CRYPT_SET", _IOC_WRITE, 0x6402, 0x03 },
@ -116,12 +117,14 @@
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_CMMA_BITS", _IOC_READ|_IOC_WRITE, 0xaeb8, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_CMMA_BITS", _IOC_WRITE, 0xaeb9, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },

View File

@ -314,7 +314,7 @@
[282] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[283] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[284] = { 0, TD, SEN(inotify_init), "inotify_init" },
[285] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[285] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[286] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[287] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[288] = { 4, TD|TF, SEN(openat), "openat" },
@ -407,7 +407,7 @@
[375] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[376] = { 6, TD, SEN(preadv2), "preadv2" },
[377] = { 6, TD, SEN(pwritev2), "pwritev2" },
[378] = { },
[378] = { 2, 0, SEN(printargs), "s390_guarded_storage" },
[379] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
#define SYS_socket_subcall 400

View File

@ -43,6 +43,7 @@
{ "asm/pkey.h", "PKEY_GENSECK", _IOC_READ|_IOC_WRITE, 0x7001, 0x48 },
{ "asm/pkey.h", "PKEY_SEC2PROTK", _IOC_READ|_IOC_WRITE, 0x7003, 0x8c },
{ "asm/pkey.h", "PKEY_SKEY2PKEY", _IOC_READ|_IOC_WRITE, 0x7006, 0x88 },
{ "asm/pkey.h", "PKEY_VERIFYKEY", _IOC_READ|_IOC_WRITE, 0x7007, 0x4c },
{ "asm/sclp_ctl.h", "SCLP_CTL_SCCB", _IOC_READ|_IOC_WRITE, 0x1010, 0x0c },
{ "asm/tape390.h", "TAPE390_CRYPT_QUERY", _IOC_READ, 0x6403, 0x03 },
{ "asm/tape390.h", "TAPE390_CRYPT_SET", _IOC_WRITE, 0x6402, 0x03 },
@ -116,12 +117,14 @@
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_CMMA_BITS", _IOC_READ|_IOC_WRITE, 0xaeb8, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_CMMA_BITS", _IOC_WRITE, 0xaeb9, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },

View File

@ -298,7 +298,7 @@
[282] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[283] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[284] = { 0, TD, SEN(inotify_init), "inotify_init" },
[285] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[285] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[286] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[287] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[288] = { 4, TD|TF, SEN(openat), "openat" },
@ -391,7 +391,7 @@
[375] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[376] = { 6, TD, SEN(preadv2), "preadv2" },
[377] = { 6, TD, SEN(pwritev2), "pwritev2" },
[378] = { },
[378] = { 2, 0, SEN(printargs), "s390_guarded_storage" },
[379] = { 5, TD|TF|TSTA, SEN(statx), "statx" },
#define SYS_socket_subcall 400

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -317,7 +317,7 @@
[288] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[289] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[290] = { 0, TD, SEN(inotify_init), "inotify_init" },
[291] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[291] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[292] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[293] = { },
[294] = { 4, TM, SEN(migrate_pages), "migrate_pages" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -343,7 +343,7 @@
[316] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[317] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[318] = { 0, TD, SEN(inotify_init), "inotify_init" },
[319] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[319] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[320] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[321] = { },
[322] = { 4, TM, SEN(migrate_pages), "migrate_pages" },

View File

@ -30,4 +30,43 @@ enum {
SMC_DIAG_SHUTDOWN,
};
/* SMC_DIAG_CONNINFO */
struct smc_diag_cursor {
uint16_t reserved;
uint16_t wrap;
uint32_t count;
};
struct smc_diag_conninfo {
uint32_t token;
uint32_t sndbuf_size;
uint32_t rmbe_size;
uint32_t peer_rmbe_size;
struct smc_diag_cursor rx_prod;
struct smc_diag_cursor rx_cons;
struct smc_diag_cursor tx_prod;
struct smc_diag_cursor tx_cons;
uint8_t rx_prod_flags;
uint8_t rx_conn_state_flags;
uint8_t tx_prod_flags;
uint8_t tx_conn_state_flags;
struct smc_diag_cursor tx_prep;
struct smc_diag_cursor tx_sent;
struct smc_diag_cursor tx_fin;
};
/* SMC_DIAG_LINKINFO */
struct smc_diag_linkinfo {
uint8_t link_id;
uint8_t ibname[64]; /* IB_DEVICE_NAME_MAX */
uint8_t ibport;
uint8_t gid[40];
uint8_t peer_gid[40];
};
struct smc_diag_lgrinfo {
struct smc_diag_linkinfo lnk[1];
uint8_t role;
};
#endif /* !STRACE_LINUX_SMC_DIAG_H */

View File

@ -150,7 +150,7 @@
[149] = { 5, 0, SEN(printargs), "pciconfig_write" },
[150] = { 3, TN, SEN(getsockname), "getsockname" },
[151] = { 0, TD, SEN(inotify_init), "inotify_init" },
[152] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[152] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[153] = { 3, TD, SEN(poll), "poll" },
[154] = { 3, TD, SEN(getdents64), "getdents64" },
[155] = { 3, TD, SEN(fcntl64), "fcntl64" },

View File

@ -6,18 +6,18 @@ arch_get_scno(struct tcb *tcp)
unsigned long trap;
errno = 0;
trap = ptrace(PTRACE_PEEKTEXT, tcp->pid, (void *) sparc_regs.tpc, 0);
if (errno)
return -1;
trap >>= 32;
switch (trap) {
case 0x91d02010:
/* Linux/SPARC syscall trap. */
update_personality(tcp, 1);
break;
case 0x91d0206d:
/* Linux/SPARC64 syscall trap. */
update_personality(tcp, 0);
break;
if (errno == 0) {
trap >>= 32;
switch (trap) {
case 0x91d02010:
/* Linux/SPARC syscall trap. */
update_personality(tcp, 1);
break;
case 0x91d0206d:
/* Linux/SPARC64 syscall trap. */
update_personality(tcp, 0);
break;
}
}
tcp->scno = sparc_regs.u_regs[U_REG_G1];

View File

@ -148,7 +148,7 @@
[149] = { 5, 0, SEN(printargs), "pciconfig_write" },
[150] = { 3, TN, SEN(getsockname), "getsockname" },
[151] = { 0, TD, SEN(inotify_init), "inotify_init" },
[152] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[152] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[153] = { 3, TD, SEN(poll), "poll" },
[154] = { 3, TD, SEN(getdents64), "getdents64" },
[155] = { },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -39,6 +39,7 @@
{ "asm-generic/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm-generic/ioctls.h", "TIOCGPTPEER", _IOC_NONE, 0x5441, 0x00 },
{ "asm-generic/ioctls.h", "TIOCGRS485", 0, 0x542E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm-generic/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
@ -92,6 +93,7 @@
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_VA", _IOC_WRITE, 0x6448, 0x28 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_INFO", _IOC_WRITE, 0x6445, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_VM", _IOC_READ|_IOC_WRITE, 0x6453, 0x08 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_CS", _IOC_READ|_IOC_WRITE, 0x6449, 0x20 },
{ "drm/amdgpu_drm.h", "DRM_IOCTL_AMDGPU_WAIT_FENCES", _IOC_READ|_IOC_WRITE, 0x6452, 0x18 },
{ "drm/drm.h", "DRM_IOCTL_ADD_BUFS", _IOC_READ|_IOC_WRITE, 0x6416, 0x18 },
@ -177,6 +179,10 @@
{ "drm/drm.h", "DRM_IOCTL_SG_ALLOC", _IOC_READ|_IOC_WRITE, 0x6438, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SG_FREE", _IOC_WRITE, 0x6439, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SWITCH_CTX", _IOC_WRITE, 0x6424, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_CREATE", _IOC_READ|_IOC_WRITE, 0x64bf, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_DESTROY", _IOC_READ|_IOC_WRITE, 0x64c0, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE", _IOC_READ|_IOC_WRITE, 0x64c2, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD", _IOC_READ|_IOC_WRITE, 0x64c1, 0x10 },
{ "drm/drm.h", "DRM_IOCTL_UNBLOCK", _IOC_READ|_IOC_WRITE, 0x6413, 0x04 },
{ "drm/drm.h", "DRM_IOCTL_UNLOCK", _IOC_WRITE, 0x642b, 0x08 },
{ "drm/drm.h", "DRM_IOCTL_UPDATE_DRAW", _IOC_WRITE, 0x643f, 0x18 },
@ -399,7 +405,9 @@
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_CREATE_SHADER_BO", _IOC_READ|_IOC_WRITE, 0x6445, 0x18 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_HANG_STATE", _IOC_READ|_IOC_WRITE, 0x6446, 0xa0 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_PARAM", _IOC_READ|_IOC_WRITE, 0x6447, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_GET_TILING", _IOC_READ|_IOC_WRITE, 0x6449, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_MMAP_BO", _IOC_READ|_IOC_WRITE, 0x6444, 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_WAIT_BO", _IOC_READ|_IOC_WRITE, 0x6442, 0x10 },
{ "drm/vc4_drm.h", "DRM_IOCTL_VC4_WAIT_SEQNO", _IOC_READ|_IOC_WRITE, 0x6441, 0x10 },
@ -727,6 +735,7 @@
{ "linux/cm4000_cs.h", "CM_IOCSRDR", _IOC_NONE, 0x6303, 0x00 },
{ "linux/cm4000_cs.h", "CM_IOSDBGLVL", _IOC_WRITE, 0x63fa, 0x04 },
{ "linux/coda.h", "CIOC_KERNEL_VERSION", _IOC_READ|_IOC_WRITE, 0x630a, 0x04 },
{ "linux/dm-ioctl.h", "DM_DEV_ARM_POLL", _IOC_READ|_IOC_WRITE, 0xfd10, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_CREATE", _IOC_READ|_IOC_WRITE, 0xfd03, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_REMOVE", _IOC_READ|_IOC_WRITE, 0xfd04, 0x138 },
{ "linux/dm-ioctl.h", "DM_DEV_RENAME", _IOC_READ|_IOC_WRITE, 0xfd05, 0x138 },
@ -818,7 +827,7 @@
{ "linux/dvb/video.h", "VIDEO_FAST_FORWARD", _IOC_NONE, 0x6f1f, 0x00 },
{ "linux/dvb/video.h", "VIDEO_FREEZE", _IOC_NONE, 0x6f17, 0x00 },
{ "linux/dvb/video.h", "VIDEO_GET_CAPABILITIES", _IOC_READ, 0x6f21, 0x04 },
{ "linux/dvb/video.h", "VIDEO_GET_EVENT", _IOC_READ, 0x6f1c, 0x20 },
{ "linux/dvb/video.h", "VIDEO_GET_EVENT", _IOC_READ, 0x6f1c, 0x14 },
{ "linux/dvb/video.h", "VIDEO_GET_FRAME_COUNT", _IOC_READ, 0x6f3a, 0x08 },
{ "linux/dvb/video.h", "VIDEO_GET_FRAME_RATE", _IOC_READ, 0x6f38, 0x04 },
{ "linux/dvb/video.h", "VIDEO_GET_NAVI", _IOC_READ, 0x6f34, 0x404 },
@ -2105,6 +2114,7 @@
{ "linux/usbdevice_fs.h", "USBDEVFS_FREE_STREAMS", _IOC_READ, 0x551d, 0x08 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GETDRIVER", _IOC_WRITE, 0x5508, 0x104 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_CAPABILITIES", _IOC_READ, 0x551a, 0x04 },
{ "linux/usbdevice_fs.h", "USBDEVFS_GET_SPEED", _IOC_NONE, 0x551f, 0x00 },
{ "linux/usbdevice_fs.h", "USBDEVFS_HUB_PORTINFO", _IOC_READ, 0x5513, 0x80 },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
{ "linux/usbdevice_fs.h", "USBDEVFS_IOCTL32", _IOC_READ|_IOC_WRITE, 0x5512, 0x0c },
@ -2383,7 +2393,6 @@
{ "linux/wireless.h", "SIOCSIWSTATS", 0, 0x8B0E, 0 },
{ "linux/wireless.h", "SIOCSIWTHRSPY", 0, 0x8B12, 0 },
{ "linux/wireless.h", "SIOCSIWTXPOW", 0, 0x8B26, 0 },
{ "media/davinci/vpfe_capture.h", "VPFE_CMD_S_CCDC_RAW_PARAMS", _IOC_WRITE, 0x56c1, 0x04 },
{ "media/drv-intf/exynos-fimc.h", "S5P_FIMC_TX_END_NOTIFY", _IOC_NONE, 0x6500, 0x00 },
{ "media/i2c/adv7842.h", "ADV7842_CMD_RAM_TEST", _IOC_NONE, 0x56c0, 0x00 },
{ "media/i2c/bt819.h", "BT819_FIFO_RESET_HIGH", _IOC_NONE, 0x6201, 0x00 },
@ -2493,6 +2502,8 @@
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VERIFY", _IOC_READ|_IOC_WRITE, 0xca84, 0x90 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_CLONE", _IOC_READ|_IOC_WRITE, 0xca89, 0x70 },
{ "scsi/cxlflash_ioctl.h", "DK_CXLFLASH_VLUN_RESIZE", _IOC_READ|_IOC_WRITE, 0xca88, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_AFU_DEBUG", _IOC_READ|_IOC_WRITE, 0xcabe, 0x78 },
{ "scsi/cxlflash_ioctl.h", "HT_CXLFLASH_LUN_PROVISION", _IOC_READ|_IOC_WRITE, 0xcabf, 0xa0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_BUS_NUMBER", 0, 0x5386, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_IDLUN", 0, 0x5382, 0 },
{ "scsi/scsi.h", "SCSI_IOCTL_GET_PCI", 0, 0x5387, 0 },
@ -2611,6 +2622,7 @@
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TSTAMP", _IOC_WRITE, 0x4102, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_TTSTAMP", _IOC_WRITE, 0x4103, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_UNLINK", _IOC_NONE, 0x4161, 0x00 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_USER_PVERSION", _IOC_WRITE, 0x4104, 0x04 },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEI_FRAMES", _IOC_WRITE, 0x4150, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_WRITEN_FRAMES", _IOC_WRITE, 0x4152, 0x0c },
{ "sound/asound.h", "SNDRV_PCM_IOCTL_XRUN", _IOC_NONE, 0x4148, 0x00 },

View File

@ -252,7 +252,7 @@
[251] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[252] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[253] = { 0, TD, SEN(inotify_init), "inotify_init" },
[254] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[254] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[255] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[256] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[257] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -74,12 +74,14 @@
{ "linux/kvm.h", "KVM_REINJECT_CONTROL", _IOC_NONE, 0xae71, 0x00 },
{ "linux/kvm.h", "KVM_RUN", _IOC_NONE, 0xae80, 0x00 },
{ "linux/kvm.h", "KVM_S390_ENABLE_SIE", _IOC_NONE, 0xae06, 0x00 },
{ "linux/kvm.h", "KVM_S390_GET_CMMA_BITS", _IOC_READ|_IOC_WRITE, 0xaeb8, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_IRQ_STATE", _IOC_WRITE, 0xaeb6, 0x20 },
{ "linux/kvm.h", "KVM_S390_GET_SKEYS", _IOC_WRITE, 0xaeb2, 0x40 },
{ "linux/kvm.h", "KVM_S390_INITIAL_RESET", _IOC_NONE, 0xae97, 0x00 },
{ "linux/kvm.h", "KVM_S390_INTERRUPT", _IOC_WRITE, 0xae94, 0x10 },
{ "linux/kvm.h", "KVM_S390_IRQ", _IOC_WRITE, 0xaeb4, 0x48 },
{ "linux/kvm.h", "KVM_S390_MEM_OP", _IOC_WRITE, 0xaeb1, 0x40 },
{ "linux/kvm.h", "KVM_S390_SET_CMMA_BITS", _IOC_WRITE, 0xaeb9, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_INITIAL_PSW", _IOC_WRITE, 0xae96, 0x10 },
{ "linux/kvm.h", "KVM_S390_SET_IRQ_STATE", _IOC_WRITE, 0xaeb5, 0x20 },
{ "linux/kvm.h", "KVM_S390_SET_SKEYS", _IOC_WRITE, 0xaeb3, 0x40 },

View File

@ -252,7 +252,7 @@
[251] = { 3, 0, SEN(ioprio_set), "ioprio_set" },
[252] = { 2, 0, SEN(ioprio_get), "ioprio_get" },
[253] = { 0, TD, SEN(inotify_init), "inotify_init" },
[254] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[254] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[255] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[256] = { 4, TM, SEN(migrate_pages), "migrate_pages" },
[257] = { 4, TD|TF, SEN(openat), "openat" },

View File

@ -1,3 +1,5 @@
#include "negated_errno.h"
static void
get_error(struct tcb *tcp, const bool check_errno)
{

View File

@ -267,7 +267,7 @@
[274] = { 6, TD, SEN(epoll_pwait), "epoll_pwait" },
[275] = { 1, TD, SEN(epoll_create1), "epoll_create1" },
[276] = { 0, TD, SEN(inotify_init), "inotify_init" },
[277] = { 3, TD, SEN(inotify_add_watch), "inotify_add_watch" },
[277] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" },
[278] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" },
[279] = { 1, TD, SEN(inotify_init1), "inotify_init1" },
[280] = { 3, 0, SEN(getcpu), "getcpu" },

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