5715 Commits

Author SHA1 Message Date
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
Nikolay Marchuk
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
JingPiao Chen
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
Eugene Syromyatnikov
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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
JingPiao Chen
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