]> granicus.if.org Git - strace/log
strace
7 years agortnl_mdb: decode br_port_msg netlink attributes
JingPiao Chen [Mon, 4 Sep 2017 14:27:02 +0000 (22:27 +0800)]
rtnl_mdb: decode br_port_msg netlink attributes

* configure.ac (AC_CHECK_TYPES): Check for struct br_mdb_entry
in <linux/if_bridge.h>.
(AC_CHECK_MEMBERS): Check for flags and vid fields in struct br_mdb_entry.
* rtnl_mdb.c: Include "xlat/mdb_flags.h", "xlat/mdb_states.h",
"xlat/rtnl_mdba_mdb_attrs.h", "xlat/rtnl_mdba_mdb_eattr_attrs.h",
"xlat/rtnl_mdba_mdb_entry_attrs.h" ,"xlat/rtnl_mdba_router_attrs.h"
and "xlat/rtnl_mdba_router_pattr_attrs.h".
(decode_mdba_mdb_entry_info, decode_mdba_mdb_entry,
decode_mdba_mdb, decode_multicast_router_type,
decode_mdba_router_port, decode_mdba_router): New functions.
(mdba_mdb_eattr_nla_decoders, mdba_mdb_entry_nla_decoders,
mdba_mdb_nla_decoders, mdba_router_pattr_nla_decoders,
mdba_router_nla_decoders, br_port_msg_nla_decoders): New arrays.
(decode_br_port_msg): Use br_port_msg_nla_decoders.
* xlat/mdb_flags.in: New file.
* xlat/mdb_states.in: Likewise.
* xlat/multicast_router_types.in: Likewise.
* xlat/rtnl_mdba_mdb_attrs.in: Likewise.
* xlat/rtnl_mdba_mdb_eattr_attrs.in: Likewise.
* xlat/rtnl_mdba_mdb_entry_attrs.in: Likewise.
* xlat/rtnl_mdba_router_attrs.in: Likewise.
* xlat/rtnl_mdba_router_pattr_attrs.in: Likewise.

7 years agonetlink: implement decoding of INET_DIAG_CLASS_ID attribute
Dmitry V. Levin [Sat, 16 Sep 2017 17:44:29 +0000 (17:44 +0000)]
netlink: implement decoding of INET_DIAG_CLASS_ID attribute

This is a new netlink attribute introduced by linux kernel commit
v4.14-rc1~130^2~207.

* linux/inet_diag.h (INET_DIAG_CLASS_ID): New enum.
* netlink_inet_diag.c (inet_diag_msg_nla_decoders): Add
INET_DIAG_CLASS_ID.
* xlat/inet_diag_attrs.in: Add INET_DIAG_CLASS_ID.
* xlat/inet_diag_extended_flags.in: Add 1<<(INET_DIAG_CLASS_ID-1).
* tests/nlattr_inet_diag_msg.c (main): Check INET_DIAG_CLASS_ID
decoding.

7 years agoUpdate MEMBARRIER_CMD_* constants
Dmitry V. Levin [Fri, 15 Sep 2017 16:06:14 +0000 (16:06 +0000)]
Update MEMBARRIER_CMD_* constants

* xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED
introduced by kernel commit v4.14-rc1~174^2^2^4.
* NEWS: Mention this.
* tests/membarrier.c (main): Update expected output.

7 years agoUpdate UFFD_FEATURE_* constants
Dmitry V. Levin [Thu, 14 Sep 2017 15:52:54 +0000 (15:52 +0000)]
Update UFFD_FEATURE_* constants

* xlat/memfd_create_flags.in: Remove UFFD_FEATURE_EVENT_EXIT removed
by kernel commit v4.11-rc2~15^2~18.
Add UFFD_FEATURE_SIGBUS and UFFD_FEATURE_THREAD_ID introduced by kernel
commits v4.14-rc1~126^2~28 and v4.14-rc1~126^2~23, repsectively.
* NEWS: Mention this.

7 years agoUpdate MFD_* constants
Dmitry V. Levin [Wed, 13 Sep 2017 15:50:37 +0000 (15:50 +0000)]
Update MFD_* constants

* xlat/memfd_create_flags.in: Add MFD_HUGETLB introduced
by kernel commit v4.14-rc1~126^2~17.
* NEWS: Mention this.
* tests/memfd_create.c (main): Update expected output.

7 years agoUpdate ETH_P_* constants
Dmitry V. Levin [Tue, 12 Sep 2017 15:46:35 +0000 (15:46 +0000)]
Update ETH_P_* constants

* xlat/ethernet_protocols.in: Add ETH_P_ERSPAN, ETH_P_NSH, ETH_P_IFE,
and ETH_P_MAP introduced by kernel commits v4.14-rc1~130^2~164,
v4.14-rc1~130^2~89^2~3, v4.14-rc1~130^2~90^2~2, and
v4.14-rc1~130^2~78^2~2, respectively.
* NEWS: Mention this.

7 years agoUpdate ARPHRD_* constants
Dmitry V. Levin [Mon, 11 Sep 2017 15:43:36 +0000 (15:43 +0000)]
Update ARPHRD_* constants

* xlat/arp_hardware_types.in: Add ARPHRD_RAWIP introduced
by kernel commit v4.14-rc1~130^2~78^2~1.
* NEWS: Mention this.

7 years agoUpdate BPF_* constants
Dmitry V. Levin [Sun, 10 Sep 2017 09:41:22 +0000 (09:41 +0000)]
Update BPF_* constants

* xlat/bpf_attach_type.in: Add BPF_SK_SKB_STREAM_PARSER
and BPF_SK_SKB_STREAM_VERDICT introduced by kernel commit
v4.14-rc1~130^2~123^2~8.
* xlat/bpf_map_flags.in: Add BPF_F_NO_COMMON_LRU and BPF_F_NUMA_NODE
introduced by kernel commits v4.10-rc1~202^2~271^2~2
and v4.14-rc1~130^2~196^2~1, respectively.
* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_DEVMAP
and BPF_MAP_TYPE_SOCKMAP introduced by kernel commits
v4.14-rc1~130^2~497^2~4 and v4.14-rc1~130^2~234^2~4,
respectively.
* xlat/bpf_op_jmp.in: Add BPF_JLT, BPF_JLE, BPF_JSLT, and BPF_JSLE
introduced by kernel commit v4.14-rc1~130^2~309^2~8.
* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_SK_SKB introduced
by kernel commit v4.14-rc1~130^2~234^2~6.
* NEWS: Mention this.

7 years agoUpdate SO_* constants
Dmitry V. Levin [Sat, 9 Sep 2017 08:17:36 +0000 (08:17 +0000)]
Update SO_* constants

* xlat/sockoptions.in: Add SO_ZEROCOPY introduced by kernel commit
v4.14-rc1~130^2~376^2~5.
* NEWS: Mention this.

7 years agoUpdate MADV_* constants
Dmitry V. Levin [Fri, 8 Sep 2017 09:10:50 +0000 (09:10 +0000)]
Update MADV_* constants

* xlat/madvise_cmds.in: Add MADV_WIPEONFORK and MADV_KEEPONFORK
introduced by kernel commit v4.14-rc1~126^2.
* NEWS: Mention this.

7 years agoerror_prints: fix potential program_invocation_name type conflict
Baruch Siach [Fri, 8 Sep 2017 09:12:57 +0000 (12:12 +0300)]
error_prints: fix potential program_invocation_name type conflict

uClibc-ng declares program_invocation_name as const.
This causes the build failure below:

error_prints.c:40:14: error: conflicting types for ‘program_invocation_name’
 extern char *program_invocation_name;
              ^~~~~~~~~~~~~~~~~~~~~~~
In file included from error_prints.c:32:0:
.../output/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/errno.h:54:20: note: previous declaration of ‘program_invocation_name’ was here
 extern const char *program_invocation_name, *program_invocation_short_name;
                    ^~~~~~~~~~~~~~~~~~~~~~~

* error_prints.c (program_invocation_name): Declare only in case
of [!HAVE_PROGRAM_INVOCATION_NAME].

7 years agortnl_tc_action: decode tcamsg netlink attributes
JingPiao Chen [Mon, 4 Sep 2017 06:56:44 +0000 (14:56 +0800)]
rtnl_tc_action: decode tcamsg netlink attributes

* rtnl_tc_action.c (tcamsg_nla_decoders): New array.
(decode_tcamsg): Use it.

7 years agotests: check decoding of TCA_STAB netlink attribute of tcmsg
JingPiao Chen [Mon, 4 Sep 2017 13:40:06 +0000 (21:40 +0800)]
tests: check decoding of TCA_STAB netlink attribute of tcmsg

* tests/test_nlattr.h (TEST_NESTED_NLATTR_ARRAY): New macro.
* tests/nlattr_tca_stab.c: New file.
* tests/gen_tests.in (nlattr_tca_stab): New entry.
* tests/pure_executables.list: Add nlattr_tca_stab.
* tests/.gitignore: Likewise.

7 years agotests: check decoding of TCA_STATS2 netlink attribute of tcmsg
JingPiao Chen [Mon, 4 Sep 2017 12:56:47 +0000 (20:56 +0800)]
tests: check decoding of TCA_STATS2 netlink attribute of tcmsg

* tests/nlattr_tc_stats.c: New file.
* tests/gen_tests.in (nlattr_tc_stats): New entry.
* tests/pure_executables.list: Add nlattr_tc_stats.
* tests/.gitignore: Likewise.

7 years agotests: check decoding of tcmsg netlink attributes
JingPiao Chen [Mon, 4 Sep 2017 07:11:33 +0000 (15:11 +0800)]
tests: check decoding of tcmsg netlink attributes

* tests/nlattr_tcmsg.c: Include <stddef.h> and <linux/pkt_sched.h>.
(main): Check decoding of TCA_STATS and TCA_RATE.

7 years agortnl_tc: decode tcmsg netlink attributes
JingPiao Chen [Mon, 4 Sep 2017 06:56:24 +0000 (14:56 +0800)]
rtnl_tc: decode tcmsg netlink attributes

* configure.ac (AC_CHECK_TYPES): Check for gnet_stats_basic,
gnet_stats_queue, gnet_stats_rate_est,
and gnet_stats_rate_est64 structures in <linux/gen_stats.h>.
And check for struct tc_sizespec in <linux/pkt_sched.h>.
* nlattr.h (tc_stats): New prototype.
* rtnl_tc.c: Include <linux/gen_stats.h>, <linux/pkt_sched.h>,
"xlat/rtnl_tca_stab_attrs.h" and "xlat/rtnl_tca_stats_attrs.h".
(decode_tc_stats, decode_tc_estimator, decode_gnet_stats_basic,
decode_gnet_stats_rate_est, decode_gnet_stats_queue,
decode_gnet_stats_rate_est64, decode_nla_tc_stats,
decode_tc_sizespec, print_stab_data, decode_tca_stab_data,
decode_tca_stab): New functions.
(tca_stats_nla_decoders, tca_stab_nla_decoders,
tcmsg_nla_decoders): New arrays.
(decode_tcmsg): Use tcmsg_nla_decoders.
* xlat/rtnl_tca_stab_attrs.in: New file.
* xlat/rtnl_tca_stats_attrs.in: Likewise.

7 years agoUpdate TCP_* constants
Dmitry V. Levin [Thu, 7 Sep 2017 06:45:04 +0000 (06:45 +0000)]
Update TCP_* constants

* xlat/socktcpoptions.in: Add TCP_ULP and TCP_MD5SIG_EXT.
* NEWS: Mention this.

7 years agoUpdate SOL_* constants
Dmitry V. Levin [Thu, 7 Sep 2017 06:45:04 +0000 (06:45 +0000)]
Update SOL_* constants

* xlat/socketlayers.in: Add SOL_TLS.
* NEWS: Mention this.

7 years agoPost-release administrivia
Dmitry V. Levin [Wed, 6 Sep 2017 20:24:50 +0000 (20:24 +0000)]
Post-release administrivia

* NEWS: Add a header line for the next release.
* debian/changelog.in: Add a changelog entry for 4.19-1.
* strace.spec.in: Likewise.

7 years agoPrepare for 4.19 release v4.19
Dmitry V. Levin [Tue, 5 Sep 2017 12:13:14 +0000 (12:13 +0000)]
Prepare for 4.19 release

* NEWS: Update for 4.19 release.

7 years ago.mailmap: add canonical name and address of Edgar Kaziakhmedov
Dmitry V. Levin [Mon, 4 Sep 2017 00:57:41 +0000 (00:57 +0000)]
.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.

7 years agomaint: add gen-tag-message.sh script
Dmitry V. Levin [Sun, 3 Sep 2017 09:49:57 +0000 (09:49 +0000)]
maint: add gen-tag-message.sh script

* maint/gen-tag-message.sh: New file.

7 years agomaint: add gen-contributors-list.sh script
Dmitry V. Levin [Sat, 2 Sep 2017 22:12:12 +0000 (22:12 +0000)]
maint: add gen-contributors-list.sh script

* maint/gen-contributors-list.sh: New file.

7 years agoUpdate copyright headers
Eugene Syromyatnikov [Tue, 5 Sep 2017 08:01:01 +0000 (10:01 +0200)]
Update copyright headers

Headers updated automatically with

    maint/update_copyright_headers.sh -c

7 years agoupdate_copyright_years.sh: add ability to automatically commit results
Eugene Syromyatnikov [Tue, 5 Sep 2017 07:56:15 +0000 (09:56 +0200)]
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.

7 years agoconfigure.ac: specify minimal GNU Automake version
Eugene Syromyatnikov [Mon, 4 Sep 2017 20:45:12 +0000 (22:45 +0200)]
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
7 years agoUpdate NEWS
Eugene Syromyatnikov [Mon, 4 Sep 2017 15:14:35 +0000 (17:14 +0200)]
Update NEWS

7 years agotests: check decoding of IFLA_XDP netlink attribute of ifinfomsg
JingPiao Chen [Sun, 3 Sep 2017 01:25:09 +0000 (09:25 +0800)]
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.

7 years agotests: check decoding of IFLA_PORT_SELF netlink attribute of ifinfomsg
JingPiao Chen [Sun, 3 Sep 2017 01:13:27 +0000 (09:13 +0800)]
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.

7 years agotests: check decoding of more ifinfomsg netlink attributes
JingPiao Chen [Sat, 2 Sep 2017 14:46:41 +0000 (22:46 +0800)]
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.

7 years agortnl_link: decode more ifinfomsg netlink attributes
JingPiao Chen [Sat, 2 Sep 2017 14:25:43 +0000 (22:25 +0800)]
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.

7 years agokeyctl: add support for KDF parameters decoding in KEYCTL_DH_COMPUTE
Eugene Syromyatnikov [Fri, 1 Sep 2017 14:14:25 +0000 (16:14 +0200)]
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.

7 years agotests/keyctl: improve readability
Eugene Syromyatnikov [Fri, 1 Sep 2017 13:12:42 +0000 (15:12 +0200)]
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.

7 years agos390: update ioctl entries from linux 4.13
Gleb Fotengauer-Malinovskiy [Fri, 1 Sep 2017 17:30:13 +0000 (20:30 +0300)]
s390: update ioctl entries from linux 4.13

* linux/s390/ioctls_arch0.h: Update from linux v4.13-rc7 using ioctls_gen.sh.

7 years agompers.awk: fix regression introduced by the previous cleanup
Dmitry V. Levin [Fri, 1 Sep 2017 17:30:13 +0000 (17:30 +0000)]
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")
7 years agortnl_link: enhance decoding of struct rtnl_link_stats{,64}
Dmitry V. Levin [Fri, 1 Sep 2017 08:41:08 +0000 (08:41 +0000)]
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).

7 years agortnl_neightbl: enhance decoding of struct ndt_stats
Dmitry V. Levin [Fri, 1 Sep 2017 08:41:08 +0000 (08:41 +0000)]
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.

7 years agotests: check decoding of IFLA_PROTINFO netlink attribute of ifinfomsg
JingPiao Chen [Tue, 29 Aug 2017 13:04:19 +0000 (21:04 +0800)]
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.

7 years agortnl_link: decode IFLA_PROTINFO netlink attribute of ifinfomsg
JingPiao Chen [Sun, 27 Aug 2017 08:12:11 +0000 (16:12 +0800)]
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.

7 years agotests: check decoding of ndtmsg netlink attributes
JingPiao Chen [Wed, 30 Aug 2017 13:56:09 +0000 (21:56 +0800)]
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.

7 years agortnl_neightbl: decode ndtmsg netlink attributes
JingPiao Chen [Wed, 30 Aug 2017 13:51:30 +0000 (21:51 +0800)]
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.

7 years agotests: check decoding of ifaddrlblmsg netlink attributes
JingPiao Chen [Wed, 30 Aug 2017 13:15:27 +0000 (21:15 +0800)]
tests: check decoding of ifaddrlblmsg netlink attributes

* tests/nlattr_ifaddrlblmsg.c (main): Check decoding of IFAL_ADDRESS.

7 years agortnl_addrlabel: decode ifaddrlblmsg netlink attributes
JingPiao Chen [Wed, 30 Aug 2017 13:14:05 +0000 (21:14 +0800)]
rtnl_addrlabel: decode ifaddrlblmsg netlink attributes

* rtnl_addrlabel.c (decode_ifal_address): New function.
(ifaddrlblmsg_nla_decoders): New array.
(decode_ifaddrlblmsg): Use it.

7 years agoalpha: wire up new syscalls
Dmitry V. Levin [Fri, 1 Sep 2017 00:56:59 +0000 (00:56 +0000)]
alpha: wire up new syscalls

* linux/alpha/syscallent.h [514..522]: New entries.

7 years agotests/.gitignore: add missing files that should be ignored
JingPiao Chen [Wed, 30 Aug 2017 17:36:12 +0000 (01:36 +0800)]
tests/.gitignore: add missing files that should be ignored

* tests/.gitignore: Add is_linux_mips_n64.

7 years agompers.awk: declare local variables consistently
Dmitry V. Levin [Thu, 31 Aug 2017 09:54:24 +0000 (09:54 +0000)]
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.

7 years agompers.awk: separate local variables from real parameters by newline
Dmitry V. Levin [Wed, 30 Aug 2017 09:48:51 +0000 (09:48 +0000)]
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.

7 years agortnl_rule: enhance FRA_TABLE decoding
Dmitry V. Levin [Tue, 29 Aug 2017 10:09:04 +0000 (10:09 +0000)]
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.

7 years agortnl_route: enhance RTA_TABLE decoding
Dmitry V. Levin [Tue, 29 Aug 2017 10:09:04 +0000 (10:09 +0000)]
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.

7 years agortnl_nsid: decode rtgenmsg netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 17:20:10 +0000 (01:20 +0800)]
rtnl_nsid: decode rtgenmsg netlink attributes

* rtnl_nsid.c (rtgenmsg_nla_decoders): New array.
(decode_rtgenmsg): Use it.

7 years agortnl_netconf: decode netconfmsg netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 17:18:20 +0000 (01:18 +0800)]
rtnl_netconf: decode netconfmsg netlink attributes

* rtnl_netconf.c (netconfmsg_nla_decoders): New array.
(decode_netconfmsg): Use it.

7 years agotests: check decoding of ndmsg netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 16:56:41 +0000 (00:56 +0800)]
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.

7 years agortnl_neigh: decode ndmsg netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 16:46:22 +0000 (00:46 +0800)]
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.

7 years agotests: check decoding of fib_rule_hdr netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 16:37:33 +0000 (00:37 +0800)]
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.

7 years agortnl_rule: decode fib_rule_hdr netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 16:33:30 +0000 (00:33 +0800)]
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.

7 years agortnl_neigh: fix ndm_type field decode in struct ndmsg
JingPiao Chen [Mon, 28 Aug 2017 08:13:56 +0000 (16:13 +0800)]
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.

7 years agoDisallow more than one signal= specification in an injection expression
Dmitry V. Levin [Mon, 28 Aug 2017 23:38:43 +0000 (23:38 +0000)]
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.

7 years agoAdd "flags" field to struct inject_data
Dmitry V. Levin [Mon, 28 Aug 2017 22:37:27 +0000 (22:37 +0000)]
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.

7 years agoMove inject data of struct inject_opts to inject_data substructure
Dmitry V. Levin [Mon, 28 Aug 2017 22:37:27 +0000 (22:37 +0000)]
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>
7 years agoUpdate ioctl entries from linux v4.13-rc7
Gleb Fotengauer-Malinovskiy [Mon, 28 Aug 2017 14:32:21 +0000 (17:32 +0300)]
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.

7 years agotests: check decoding of ifinfomsg netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 15:55:14 +0000 (23:55 +0800)]
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.

7 years agortnl_link: decode ifinfomsg netlink attributes
JingPiao Chen [Sun, 27 Aug 2017 15:04:15 +0000 (23:04 +0800)]
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.

7 years agoImply RVAL_DECODED when RVAL_IOCTL_PARSED is returned on entering
Dmitry V. Levin [Mon, 28 Aug 2017 00:39:15 +0000 (00:39 +0000)]
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>
7 years agoReplace return 1 ioctl sub-decoder hack with proper flag
Eugene Syromyatnikov [Mon, 14 Aug 2017 17:25:13 +0000 (19:25 +0200)]
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.

7 years agov4l2: streamline logic
Eugene Syromyatnikov [Sat, 26 Aug 2017 23:12:08 +0000 (01:12 +0200)]
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.

7 years agov4l2: reorder field printing in order to avoid auxstr usage
Eugene Syromyatnikov [Sat, 26 Aug 2017 23:10:00 +0000 (01:10 +0200)]
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.

7 years agouserfaultfd: streamline logic
Eugene Syromyatnikov [Sat, 26 Aug 2017 22:54:24 +0000 (00:54 +0200)]
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.

7 years agoDo not return RVAL_DECODED on exiting path of ioctl decoders
Eugene Syromyatnikov [Sat, 26 Aug 2017 22:39:24 +0000 (00:39 +0200)]
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.

7 years agodm: return RVAL_DECODED instead of 0 if we can't decode command
Eugene Syromyatnikov [Sat, 26 Aug 2017 22:24:37 +0000 (00:24 +0200)]
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.

7 years agoReturn 0 instead of 1 on entering path of ioctl decoders
Eugene Syromyatnikov [Sat, 26 Aug 2017 22:18:27 +0000 (00:18 +0200)]
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>
7 years agoioctl: simplify ioctl_decode handling, document its return value semantics
Eugene Syromyatnikov [Fri, 25 Aug 2017 22:33:55 +0000 (00:33 +0200)]
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).

7 years agosyscall.c: define personality names for all multi-personality architectures
Eugene Syromyatnikov [Sun, 27 Aug 2017 16:49:01 +0000 (18:49 +0200)]
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>
7 years agocopyright-year-gen: workaround for old git versions
Eugene Syromyatnikov [Sun, 27 Aug 2017 16:29:05 +0000 (18:29 +0200)]
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.

7 years agoubi: trim overly long lines
Eugene Syromyatnikov [Sat, 26 Aug 2017 22:45:16 +0000 (00:45 +0200)]
ubi: trim overly long lines

7 years agoterm: use print_quoted_string
Eugene Syromyatnikov [Sat, 26 Aug 2017 22:42:55 +0000 (00:42 +0200)]
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.

7 years agoupdate_copyright_years.sh: workaround for old git versions
Eugene Syromyatnikov [Fri, 25 Aug 2017 22:28:45 +0000 (00:28 +0200)]
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.

7 years agosyscall: use spaces in tile personality names, de-duplicate definition
Eugene Syromyatnikov [Sat, 26 Aug 2017 23:36:30 +0000 (01:36 +0200)]
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.

7 years agotests: check decoding of rtmsg netlink attributes
JingPiao Chen [Tue, 22 Aug 2017 15:24:55 +0000 (23:24 +0800)]
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>
7 years agortnl_route: decode rtmsg netlink attributes
JingPiao Chen [Tue, 22 Aug 2017 15:24:45 +0000 (23:24 +0800)]
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>
7 years agos390: wire up s390_guarded_storage syscall
Dmitry V. Levin [Fri, 25 Aug 2017 15:57:14 +0000 (15:57 +0000)]
s390: wire up s390_guarded_storage syscall

* linux/s390/syscallent.h [378]: Add s390_guarded_storage entry.
* linux/s390x/syscallent.h: Likewise.

7 years agomicroblaze: wire up statx syscall
Dmitry V. Levin [Fri, 25 Aug 2017 15:57:14 +0000 (15:57 +0000)]
microblaze: wire up statx syscall

* linux/microblaze/syscallent.h [398]: Add statx entry.

7 years agoalloc_number_set_array: add ATTRIBUTE_MALLOC
Dmitry V. Levin [Thu, 24 Aug 2017 18:13:29 +0000 (18:13 +0000)]
alloc_number_set_array: add ATTRIBUTE_MALLOC

* number_set.h: Include "gcc_compat.h".
(alloc_number_set_array): Add ATTRIBUTE_MALLOC.

7 years agoAdd macros for testing QUAL_* flags
Nikolay Marchuk [Thu, 24 Aug 2017 11:19:40 +0000 (18:19 +0700)]
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.

7 years agoRemove QUAL_SIGNAL, QUAL_READ and QUAL_WRITE
Dmitry V. Levin [Thu, 24 Aug 2017 18:24:16 +0000 (18:24 +0000)]
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.

7 years agoxstrdup, xtrndup: allow NULL argument
Eugene Syromiatnikov [Thu, 24 Aug 2017 17:36:08 +0000 (17:36 +0000)]
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.

7 years agotests: really skip mips o32 scno tampering tests on mips n64
Dmitry V. Levin [Wed, 23 Aug 2017 18:38:26 +0000 (18:38 +0000)]
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.

7 years agoHide struct number_set implementation details from users
Dmitry V. Levin [Tue, 22 Aug 2017 21:23:49 +0000 (21:23 +0000)]
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.

7 years agoExtend number_set interface
Dmitry V. Levin [Tue, 22 Aug 2017 21:23:49 +0000 (21:23 +0000)]
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.

7 years agoMove number_set interface to separate files
Dmitry V. Levin [Tue, 22 Aug 2017 21:23:49 +0000 (21:23 +0000)]
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.

7 years agoMove SUPPORTED_PERSONALITIES to a separate file
Edgar Kaziakhmedov [Tue, 22 Aug 2017 12:35:03 +0000 (15:35 +0300)]
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>
7 years agoMove string_to_uint* functions to a separate file
Edgar Kaziakhmedov [Tue, 22 Aug 2017 12:35:02 +0000 (15:35 +0300)]
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>
7 years agotests: check decoding of ifaddrmsg netlink attributes
JingPiao Chen [Tue, 22 Aug 2017 06:45:49 +0000 (14:45 +0800)]
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.

7 years agortnl_addr: decode ifaddrmsg netlink attributes
JingPiao Chen [Tue, 22 Aug 2017 06:45:48 +0000 (14:45 +0800)]
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.

7 years agoExport decode_inet_addr
Dmitry V. Levin [Tue, 22 Aug 2017 11:35:20 +0000 (11:35 +0000)]
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.

7 years agonetlink_inet_diag: prepare decode_inet_addr for export
Dmitry V. Levin [Mon, 21 Aug 2017 11:30:47 +0000 (11:30 +0000)]
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.

7 years agoprint_inet_addr: add support of invocations without field name
Dmitry V. Levin [Sun, 20 Aug 2017 11:10:03 +0000 (11:10 +0000)]
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.

7 years agoprint_inet_addr: print address of unsupported family in hex
Dmitry V. Levin [Sat, 19 Aug 2017 11:04:00 +0000 (11:04 +0000)]
print_inet_addr: print address of unsupported family in hex

* sockaddr.c (print_inet_addr): Specify QUOTE_FORCE_HEX
to print_quoted_string.

7 years agomips o32: do not bail out in get_syscall_args if umoven fails
Dmitry V. Levin [Fri, 18 Aug 2017 14:30:08 +0000 (14:30 +0000)]
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.

7 years agoconfigure: cleanup struct statfs/statfs64 member checks
Dmitry V. Levin [Thu, 17 Aug 2017 12:43:18 +0000 (12:43 +0000)]
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.

7 years agotests: fix a few harmless -Woverflow compilation warnings
Dmitry V. Levin [Wed, 16 Aug 2017 17:50:25 +0000 (17:50 +0000)]
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>