Commit Graph

6097 Commits

Author SHA1 Message Date
c458ea4d77 tests: check signal mask transparency
Starting with commit v4.17-5-gf83b49b strace is expected
to forward the signal mask to tracees unchanged.

* tests/check_sigblock.c: New file.
* tests/set_sigblock.c: Likewise.
* tests/sigblock.test: New test.
* tests/.gitignore: Add check_sigblock and set_sigblock.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add sigblock.test.
2017-11-04 23:43:55 +00:00
ff1bc06589 tests: check signal disposition transparency
Starting with commit v4.17-8-ge97a66f strace is expected
to forward the signal disposition to tracees unchanged.

* tests/check_sigign.c: New file.
* tests/list_sigaction_signum.c: Likewise.
* tests/set_sigign.c: Likewise.
* tests/sigign.test: New test.
* tests/.gitignore: Add check_sigign, list_sigaction_signum,
and set_sigign.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add sigign.test.
2017-11-03 23:10:38 +00:00
Eugene Syromyatnikov
48cb6336d8 tests: update futex test to accommodate the recent kernel change
Kernel commit v4.14-rc1~162^2~8 refactored futex implementation and
introduced checks for invalid shift sizes.  Accommodate this change
by allowing EINVAL in the corresponding futex checks.

* tests/futex.c (CHECK_FUTEX_GENERIC): Reset errno before the syscall.
(main) <wake_ops>: Add err2 field, describe err/err2 fields.
Add EINVAL as a possible errno to the checks that contain invalid
shift values.
Update return value check so it checks that values are strictly
as expected.

Closes: https://github.com/strace/strace/pull/16
2017-11-03 20:46:47 +00:00
Eugene Syromyatnikov
052a399cce tests: cleanup futex test
* tests/futex.c (main) <wake_ops>: Remove unused errstr field
from the structure type definition.
2017-11-03 20:46:47 +00:00
5d460ae383 seccomp: decode SECCOMP_GET_ACTION_AVAIL operation
* defs.h (seccomp_ret_action): New xlat prototype.
* seccomp.c (decode_seccomp_set_mode_strict): Remove.
(SYS_FUNC(seccomp)): Decode SECCOMP_GET_ACTION_AVAIL operation.
* NEWS: Mention this.
* tests/seccomp_get_action_avail.c: New file.
* tests/gen_tests.in (seccomp_get_action_avail): New entry.
* tests/pure_executables.list: Add seccomp_get_action_avail.
* tests/.gitignore: Likewise.
2017-11-02 00:21:57 +00:00
745c53410f Add SECCOMP_RET_KILL_PROCESS decoding support
* bpf_seccomp_filter.c [!SECCOMP_RET_ACTION]: Remove.
[!SECCOMP_RET_ACTION_FULL] (SECCOMP_RET_ACTION_FULL): Define.
(print_seccomp_filter_k): Use SECCOMP_RET_ACTION_FULL
instead of SECCOMP_RET_ACTION.
* xlat/seccomp_ret_action.in: Add SECCOMP_RET_KILL_PROCESS introduced
by linux kernel commit v4.14-rc2~15^2~3.
2017-11-01 02:05:41 +00:00
01d45b6c2b Rename SECCOMP_RET_KILL to SECCOMP_RET_KILL_THREAD
Follow linux kernel commit v4.14-rc2~15^2~4 and rename SECCOMP_RET_KILL
to SECCOMP_RET_KILL_THREAD.

* xlat/seccomp_ret_action.in (SECCOMP_RET_KILL): Rename
to SECCOMP_RET_KILL_THREAD.
* tests/prctl-seccomp-filter-v.c (main): Update expected output.
* tests/seccomp-filter-v.c (main): Likewise.
2017-11-01 02:02:21 +00:00
3ed59f89fd Update SECCOMP_* constants
* xlat/seccomp_filter_flags.in: Add SECCOMP_FILTER_FLAG_LOG introduced
by kernel commit v4.14-rc2~15^2~6.
* xlat/seccomp_ops.in: Add SECCOMP_GET_ACTION_AVAIL introduced
by kernel commit v4.14-rc2~15^2~9.
* xlat/seccomp_ret_action.in: Add SECCOMP_RET_LOG introduced
by kernel commit v4.14-rc2~15^2~5.
* NEWS: Mention this.
* tests/seccomp-filter.c (main): Update expected output.
* tests/seccomp-filter-v.c (main): Likewise.
2017-11-01 02:00:04 +00:00
2ce8a26a9a Provide fallback definitions for SECCOMP_RET_* constants
* xlat/seccomp_ret_action.in: Add fallback definitions.
2017-11-01 02:00:04 +00:00
1079428852 tests: robustify options-syntax.test against inquisitive musl
Workaround musl >= 1.1.17 ability to use AT_EXECFN during
program_invocation_name initialization.

* tests/options-syntax.test: Check for two valid variants
of "zeroargc strace" expected output.
2017-11-01 01:43:25 +00:00
73354cff1a Update MEMBARRIER_CMD_* constants
* xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED
introduced by kernel commit v4.14-rc6~26.
* tests/membarrier.c (main): Update expected output.
2017-11-01 00:20:44 +00:00
JingPiao Chen
98e7eec333 tests: check decoding of NFNL_SUBSYS_NFT_COMPAT netlink message flags
* tests/nfnetlink_nft_compat.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:55 +08:00
JingPiao Chen
76e1dbb539 tests: check decoding of NFNL_SUBSYS_NFTABLES netlink message flags
* tests/nfnetlink_nftables.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:55 +08:00
JingPiao Chen
3617415443 tests: check decoding of NFNL_SUBSYS_CTHELPER netlink message flags
* tests/nfnetlink_cthelper.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:55 +08:00
JingPiao Chen
148e20ccdc tests: check decoding of NFNL_SUBSYS_CTNETLINK_TIMEOUT netlink message flags
* tests/nfnetlink_cttimeout.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:55 +08:00
JingPiao Chen
66e923f09d tests: check decoding of NFNL_SUBSYS_ACCT netlink message flags
* tests/nfnetlink_acct.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:55 +08:00
JingPiao Chen
2a23f1d638 tests: check decoding of NFNL_SUBSYS_CTNETLINK_EXP netlink message flags
* tests/nfnetlink_ctnetlink_exp.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:55 +08:00
JingPiao Chen
07c91defbc tests: check decoding of NFNL_SUBSYS_CTNETLINK netlink message flags
* tests/nfnetlink_ctnetlink.c (test_nlmsg_flags): New function.
(main): Use it.
2017-10-31 11:59:42 +08:00
JingPiao Chen
58739bf243 netlink: decode NETLINK_NETFILTER netlink message flags
* netlink.c (decode_nlmsg_flags_netfilter): New function.
(nlmsg_flags): Add NETLINK_NETFILTER.
* NEWS: Mention this.
2017-10-26 18:08:03 +00:00
JingPiao Chen
b56c8dbcfb netlink: decode netlink message delete flags
* netlink.c: Include "xlat/netlink_delete_flags.h".
(decode_nlmsg_flags_crypto, decode_nlmsg_flags_route,
decode_nlmsg_flags_xfrm): Decode delete flags.
* netlink.h (NLM_F_NONREC): New macro.
* xlat/netlink_delete_flags.in: New file.
* tests/netlink_crypto.c (test_nlmsg_flags): Check this.
* tests/netlink_route.c (test_nlmsg_flags): Likewise.
* tests/netlink_xfrm.c (test_nlmsg_flags): Likewise.
2017-10-26 18:07:03 +00:00
JingPiao Chen
695de1df13 netlink: refactor decode_nlmsg_flags
Refactor decode_nlmsg_flags to make it family-specific, just like
decode_nlmsg_type and decode_payload.

* netlink.c (decode_nlmsg_flags_crypto, decode_nlmsg_flags_route,
decode_nlmsg_flags_sock_diag, decode_nlmsg_flags_xfrm): New functions.
(nlmsg_flags_decoder_t): New typedef.
(nlmsg_flags): New array.
(decode_nlmsg_flags): Use it.
2017-10-26 18:04:08 +00:00
JingPiao Chen
69c68ef5bf Workaround historic linux/netfilter/xt_osf.h deficiencies
When using linux kernel headers without commit v4.5-rc1~128^2~115^2~22
("netfilter: fix include files for compilation"), both <linux/ip.h>
and <linux/tcp.h> have to be included before <linux/netfilter/xt_osf.h>.

* configure.ac (AC_CHECK_HEADERS): Include <linux/ip.h>
and <linux/tcp.h> when checking for linux/netfilter/xt_osf.h header.
* tests/nfnetlink_osf.c: Include <linux/ip.h> and <linux/tcp.h>
before <linux/netfilter/xt_osf.h>.
2017-10-14 18:29:51 +00:00
JingPiao Chen
489d8a9564 tests: check decoding of NFNL_SUBSYS_NFT_COMPAT netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nf_tables_compat.h.
* tests/nfnetlink_nft_compat.c: New file.
* tests/gen_tests.in (nfnetlink_nft_compat): New entry.
* tests/pure_executables.list: Add nfnetlink_nft_compat.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
b27bee724d tests: check decoding of NFNL_SUBSYS_NFTABLES netlink message types
* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/nf_tables.h.
* tests/nfnetlink_nftables.c: New file.
* tests/gen_tests.in (nfnetlink_nftables): New entry.
* tests/pure_executables.list: Add nfnetlink_nftables.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
935e0629c5 tests: check decoding of NFNL_SUBSYS_CTHELPER netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_cthelper.h.
* tests/nfnetlink_cthelper.c: New file.
* tests/gen_tests.in (nfnetlink_cthelper): New entry.
* tests/pure_executables.list: Add nfnetlink_cthelper.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
130b1ade11 tests: check decoding of NFNL_SUBSYS_CTNETLINK_TIMEOUT netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_cttimeout.h.
* tests/nfnetlink_cttimeout.c: New file.
* tests/gen_tests.in (nfnetlink_cttimeout): New entry.
* tests/pure_executables.list: Add nfnetlink_cttimeout.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
fa94d0e5e0 tests: check decoding of NFNL_SUBSYS_ACCT netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_acct.h.
* tests/nfnetlink_acct.c: New file.
* tests/gen_tests.in (nfnetlink_acct): New entry.
* tests/pure_executables.list: Add nfnetlink_acct.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
f61c513898 tests: check decoding of NFNL_SUBSYS_IPSET netlink message types
* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/ipset/ip_set.h.
* tests/nfnetlink_ipset.c: New file.
* tests/gen_tests.in (nfnetlink_ipset): New entry.
* tests/pure_executables.list: Add nfnetlink_ipset.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
0d870031b3 tests: check decoding of NFNL_SUBSYS_OSF netlink message types
* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/xt_osf.h.
* tests/nfnetlink_osf.c: New file.
* tests/gen_tests.in (nfnetlink_osf): New entry.
* tests/pure_executables.list: Add nfnetlink_osf.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
ed593fef59 tests: check decoding of NFNL_SUBSYS_ULOG netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_log.h.
* tests/nfnetlink_ulog.c: New file.
* tests/gen_tests.in (nfnetlink_ulog): New entry.
* tests/pure_executables.list: Add nfnetlink_ulog.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
cd02efa8cf tests: check decoding of NFNL_SUBSYS_QUEUE netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_queue.h.
* tests/nfnetlink_queue.c: New file.
* tests/gen_tests.in (nfnetlink_queue): New entry.
* tests/pure_executables.list: Add nfnetlink_queue.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
9854baf382 tests: check decoding of NFNL_SUBSYS_CTNETLINK_EXP netlink message types
* tests/nfnetlink_ctnetlink_exp.c: New file.
* tests/gen_tests.in (nfnetlink_ctnetlink_exp): New entry.
* tests/pure_executables.list: Add nfnetlink_ctnetlink_exp.
* tests/.gitignore: Likewise.
2017-09-24 10:07:58 +00:00
JingPiao Chen
f2ee2a845e tests: check decoding of NFNL_SUBSYS_CTNETLINK netlink message types
* configure.ac (AC_CHECK_HEADERS): Add
linux/netfilter/nfnetlink_conntrack.h.
* tests/nfnetlink_ctnetlink.c: New file.
* tests/gen_tests.in (nfnetlink_ctnetlink): New entry.
* tests/pure_executables.list: Add nfnetlink_ctnetlink.
* tests/.gitignore: Likewise.
2017-09-24 10:07:57 +00:00
JingPiao Chen
c5d6bccdb0 netlink: decode NETLINK_NETFILTER netlink message types
* netlink.c: Include "xlat/nf_acct_msg_types.h",
"xlat/nf_cthelper_msg_types.h", "xlat/nf_ctnetlink_exp_msg_types.h",
"xlat/nf_ctnetlink_msg_types.h", "xlat/nf_cttimeout_msg_types.h",
"xlat/nf_ipset_msg_types.h", "xlat/nf_nft_compat_msg_types.h",
"xlat/nf_nftables_msg_types.h", "xlat/nf_osf_msg_types.h",
"xlat/nf_queue_msg_types.h", and "xlat/nf_ulog_msg_types.h".
(nf_nlmsg_types): New array.
(decode_nlmsg_type_netfilter): Use it.
* NEWS: Mention this.
* xlat/nf_acct_msg_types.in: New file.
* xlat/nf_cthelper_msg_types.in: Likewise.
* xlat/nf_ctnetlink_exp_msg_types.in: Likewise.
* xlat/nf_ctnetlink_msg_types.in: Likewise.
* xlat/nf_cttimeout_msg_types.in: Likewise.
* xlat/nf_ipset_msg_types.in: Likewise.
* xlat/nf_nft_compat_msg_types.in: Likewise.
* xlat/nf_nftables_msg_types.in: Likewise.
* xlat/nf_osf_msg_types.in: Likewise.
* xlat/nf_queue_msg_types.in: Likewise.
* xlat/nf_ulog_msg_types.in: Likewise.
* tests/netlink_netfilter.c (test_nlmsg_type): Update expected output.
2017-09-24 10:07:57 +00:00
2d3a697810 ppc64: fix sigreturn parser for ppc personality
* linux/powerpc/arch_sigreturn.c (arch_sigreturn) [POWERPC64]: Rewrite.
2017-09-20 00:15:02 +00:00
55b097b506 ppc64: truncate syscall args for 32-bit personality tracees
* linux/powerpc/get_syscall_args.c (get_syscall_args): Clear upper
32 bits of syscall args for 32-bit personality tracees.
* NEWS: Mention this fix.
2017-09-20 00:15:02 +00:00
c8a294a585 ppc64: fix PRI__64 macro definition when compiled with -m32
* kernel_types.h [SIZEOF_LONG != 4]: Check for __powerpc64__ instead
of POWERPC to handle -m32 case properly.
2017-09-20 00:15:02 +00:00
5b9de7b081 loop: decode LOOP_SET_BLOCK_SIZE
* loop.c (loop_ioctl) <LOOP_SET_BLOCK_SIZE>: Handle LOOP_SET_BLOCK_SIZE.
* tests/ioctl_loop.c (main): Check it.
2017-09-19 11:32:05 +00:00
5e90930421 Update ioctl entries from linux v4.14-rc1
* linux/32/ioctls_inc_align16.h: Update from linux v4.14-rc1
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.
* xlat/loop_cmds.in: Add LOOP_SET_BLOCK_SIZE introduced
by kernel commit v4.13-rc7-176-g89e4fde.
* NEWS: Mention this.
* tests/ioctl_loop.c (main): Update.
2017-09-19 11:32:05 +00:00
Gleb Fotengauer-Malinovskiy
55bc4164bd maint: generate ioctl entries without target architecture code execution
ioctls_sym.sh used to generate and invoke target architecture
executables that limited its applicability.
After this change, the generated code is just compiled to the target
architecture object files and all required information is obtained
from the dwarf sections.
This approach allows to generate ioctl entries for any target
architecture supported by compiler.

* maint/ioctls_sym.awk: New file.
* maint/ioctls_sym.sh (LC_ALL): Define to C and export.
(uname_m): Make configurable.
(CFLAGS): Add -gdwarf-2.
(LDFLAGS): Remove.
Do not use print_ioctlent.c.
Change asm-generic/ioctl.h and asm/ioctl.h hook.
Dump and process dwarf sections of generated object files.
* maint/print_ioctlent.c: Remove.
2017-09-19 11:32:05 +00:00
68d18a891e Remove KVM_S390_* ioctls from non-s390 architectures
* maint/ioctls_sym.sh <linux/kvm.h> (s390_list): New variable.
Use it to exclude KVM_S390_* ioctls on non-s390 architectures.
* linux/arm/ioctls_arch0.h: Regenerate.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
2017-09-18 11:26:04 +00:00
7052c84b01 Remove some of arch-specific KVM ioctls from non-matching architectures
* maint/ioctls_sym.sh (arm_list, ppc_list, x86_list): Use bracket
expressions to generalize arch-specific regular expressions.
* linux/arm/ioctls_arch0.h: Regenerate.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
6769418d51 dm: add support for DM_DEV_ARM_POLL
Added in Linux commit v4.13-rc1~137^2~14.

* dm.c [!DM_LIST_VERSIONS] (DM_LIST_VERSIONS): Add leading zero.
[!DM_TARGET_MSG] (DM_TARGET_MSG): Likewise.
[!DM_DEV_SET_GEOMETRY_CMD] (DM_DEV_SET_GEOMETRY_CMD): Likewise.
[!DM_DEV_ARM_POLL] (DM_DEV_ARM_POLL): New macro.
(dm_ioctl_has_params, dm_ioctl): Handle DM_DEV_ARM_POLL.
* tests/ioctl_dm.c [!DM_DEV_ARM_POLL] (DM_DEV_ARM_POLL): New macro.
(main) <dummy_check_cmds>: Add DM_DEV_ARM_POLL.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
6eb263c72c kcmp: add KCMP_EPOLL_TFD support
* configure.ac (AC_CHECK_TYPES): Add check for struct kcmp_epoll_slot.
* kcmp.c (SYS_FUNC(kcmp)) <case KCMP_EPOLL_TFD>: Implement idx1/idx2
argument parsing.
* tests/kcmp.c: Update test.
* xlat/kcmp_types.in (KCMP_EPOLL_TFD): New entry.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
10878b224a tests: add kcmp-y test
It is not very useful as of now, but it will allow tracking changes
in fd output once they are implemented.

* tests/gen_tests.in (kcmp-y): New test.
* tests/kcmp-y.c: New file, wrapper for kcmp.c
* tests/kcmp.c: Add opening of some files for which info may be printed
in the future.
* tests/pure_executables.list: Add kcmp-y.
* tests/.gitignore: Likewise.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
76cf3b2a98 kcmp: output fds using a separate function
This is a preparation for the future introduction of cross-NS PID
derivation, which would enable us to print fd information for fds
related to all processes, not just traced ones.

Note the change in output type for idx1/idx2 in KCMP_FILE command from
unsigned to int, it follows printfd output format.

* kcmp.c (printpidfd): New function.
(PRINT_FIELD_PIDFD): New macro.
(SYS_FUNC(kcmp)) <case KCMP_FILE>: Use printpidfd for printing
idx1/idx2, as they are fds, after all.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
8cddc598da tests/kcmp: add more checks
Let's check all kcmp commands that they indeed do not print idx1/idx2.
Also, check that upper bits of pid arguments are ignored.

* tests/gen_tests.in (kcmp): Decrease -a argument's value from 27 to 22.
* tests/kcmp.c: Add checks for upper bits of pid1/pid2 and for all
kcmp types not tested before.
2017-09-17 12:04:11 +00:00
Eugene Syromyatnikov
9acc241775 tests/kcmp: use <linux/kcmp.h> if it is available
I see it as a good idea to stick to system headers whenever possible
in order to also check for possible discrepancies between strace's
internal definitions and definitions present in the system headers.

* configure.ac (AC_CHECK_HEADERS): Add linux/kcmp.h.
* tests/kcmp.h [HAVE_LINUX_KCMP_H]: Include <linux/kcmp.h>,
do not define KCMP_FILE and KCMP_SYSVSEM.
2017-09-17 12:04:11 +00:00
JingPiao Chen
d5c03ad80a tests: check decoding of MDBA_ROUTER_PORT netlink attribute
* tests/nlattr_mdba_router_port.c: New file.
* tests/gen_tests.in (nlattr_mdba_router_port): New entry.
* tests/pure_executables.list: Add nlattr_mdba_router_port.
* tests/.gitignore: Likewise.
2017-09-17 12:04:11 +00:00
JingPiao Chen
7efe8b38db tests: check decoding of MDBA_MDB_ENTRY_INFO netlink attributes
* tests/nlattr_mdba_mdb_entry.c: New file.
* tests/gen_tests.in (nlattr_mdba_mdb_entry): New entry.
* tests/pure_executables.list: Add nlattr_mdba_mdb_entry.
* tests/.gitignore: Likewise.
2017-09-17 12:04:11 +00:00