]> granicus.if.org Git - strace/log
strace
6 years agoxlat: add BPF_PROG_TYPE_SK_REUSEPORT to bpf_prog_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:46:26 +0000 (15:46 +0200)]
xlat: add BPF_PROG_TYPE_SK_REUSEPORT to bpf_prog_types.in

* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_REUSEPORT): New constant,
introduced by Linux commit v4.19-rc1~140^2~24^2~2^2~5.
* tests/bpf.c: Update expected output.

6 years agoxlat: add IPSTATS_MIB_REASM_OVERLAPS to snmp_ip_stats_mib.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:42:13 +0000 (15:42 +0200)]
xlat: add IPSTATS_MIB_REASM_OVERLAPS to snmp_ip_stats_mib.in

* xlat/snmp_ip_stats.in (IPSTATS_MIB_REASM_OVERLAPS): New constant,
introduced by Linux commit v4.19-rc1~140^2~128^2~2.

6 years agoxlat: update bpf_map_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:39:54 +0000 (15:39 +0200)]
xlat: update bpf_map_types.in

* xlat/bpf_map_types.in (BPF_MAP_TYPE_CGROUP_STORAGE): New constant,
introduced by Linux commit v4.19-rc1~140^2~108^2~3^2~12.
(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY): New constant, introduced by Linux
commit v4.19-rc1~140^2~24^2~2^2~6.
* tests/bpf.c: Update expected output.

6 years agortnl_link: add IFLA_MIN_MTU and IFLA_MAX_MTU attributes
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:31:11 +0000 (15:31 +0200)]
rtnl_link: add IFLA_MIN_MTU and IFLA_MAX_MTU attributes

Introduced by Linux commit v4.19-rc1~140^2~205^2~1.

* rtnl_link.c (ifinfomsg_nla_decoders) <[IFLA_MIN_MTU], [IFLA_MAX_MTU]>:
New decoder, calls decode_nla_u32.
* xlat/rtnl_link_attrs.in (IFLA_MIN_MTU, IFLA_MAX_MTU): New constant.

6 years agoxlat: add IPV4_DEVCONF_BC_FORWARDING-1 to inet_devconf_indices.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:30:27 +0000 (15:30 +0200)]
xlat: add IPV4_DEVCONF_BC_FORWARDING-1 to inet_devconf_indices.in

* xlat/inet_devconf_indices.in (IPV4_DEVCONF_BC_FORWARDING-1): New
constant, introduced by Linux commit v4.19-rc1~140^2~208^2~1.

6 years agortnl_netconf: add NETCONFA_BC_FORWARDING attribute
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:29:06 +0000 (15:29 +0200)]
rtnl_netconf: add NETCONFA_BC_FORWARDING attribute

Introduced by Linux commit v4.19-rc1~140^2~208^2~1.

* rtnl_netconf.c (netconfmsg_nla_decoders) <[NETCONFA_BC_FORWARDING]>:
New decoder, calls decode_nla_s32.
* xlat/rtnl_netconf_attrs.in (NETCONFA_BC_FORWARDING): New constant.

6 years agonetlink_smc_diag: add SMC_DIAG_FALLBACK attribute support
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:20:33 +0000 (15:20 +0200)]
netlink_smc_diag: add SMC_DIAG_FALLBACK attribute support

Introduced by Linux commit v4.19-rc1~140^2~253^2~1.

* linux/smc_diag.h (SMC_DIAG_FALLBACK): New enumeration item.
(struct smc_diag_fallback): New type definition.
* netlink_smc_diag.c: Include "xlat/smc_decl_codes.h".
(decode_smc_diag_fallback): New function.
(smc_diag_msg_nla_decoders) <[SMC_DIAG_FALLBACK]>: New decoder, calls
decode_smc_diag_fallback.
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_FALLBACK
attribute decoding.
* xlat/smc_decl_codes.in: New file.
* xlat/smc_diag_attrs.in (SMC_DIAG_FALLBACK): New constant.

6 years agodefs.h: add style argument to printxval_search_ex macro
Eugene Syromyatnikov [Sun, 19 Aug 2018 13:19:21 +0000 (15:19 +0200)]
defs.h: add style argument to printxval_search_ex macro

It is identical to printxval_search otherwise.

* defs.h (printxval_search_ex): Add style argument.

6 years agoxlat: update v4l2_pix_fmts.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 12:52:58 +0000 (14:52 +0200)]
xlat: update v4l2_pix_fmts.in

* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_FWHT): New constant, introduced by
Linux commit v4.19-rc1~137^2~221.
(V4L2_PIX_FMT_SBGGR14P, V4L2_PIX_FMT_SGBRG14P, V4L2_PIX_FMT_SGRBG14P,
V4L2_PIX_FMT_SRGGB14P): New constants, introduced by Linux commit
v4.19-rc1~137^2~97.
(V4L2_PIX_FMT_Y10P): New constant, introduced by Linux commit
v4.19-rc1~137^2~95.

6 years agonetlink_smc_diag: decode smc_diag_msg.diag_fallback constant names
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:56:21 +0000 (11:56 +0200)]
netlink_smc_diag: decode smc_diag_msg.diag_fallback constant names

Introduced by Linux commit v4.19-rc1~140^2~285^2~4.

* xlat/smc_diag_mode.in: New file.
* netlink_smc_diag.c: Include "xlat/smc_diag_mode.h".
(decode_smc_diag_msg): Print diag_fallback field using smc_diag_mode
xlat.
* tests/netlink_sock_diag.c (test_smc_diag_msg): Update expected output.
* tests/nlattr_smc_diag_msg.c (print_smc_diag_msg): Likewise.

6 years agortnl_link: add IFLA_BRPORT_BACKUP_PORT attribute
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:47:11 +0000 (11:47 +0200)]
rtnl_link: add IFLA_BRPORT_BACKUP_PORT attribute

Introduced by Linux commit v4.19-rc1~140^2~288^2.

* xlat/rtnl_ifla_brport_attrs.in (IFLA_BRPORT_BACKUP_PORT): New
constant.
* rtnl_link.c (ifla_brport_nla_decoders) <[IFLA_BRPORT_BACKUP_PORT]>:
New decoder.

6 years agoxlat: update nt_descriptor_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:41:16 +0000 (11:41 +0200)]
xlat: update nt_descriptor_types.in

* xlat/nt_descriptor_types.in (NT_VMCOREDD): New named constant,
introduced by Linux commit v4.18-rc1~114^2~252^2~2.
(NT_MIPS_DSP): New named constant, introduced by Linux commit
v4.19-rc1~42^2~63.
(NT_MIPS_FP_MODE): New named constant, introduced by Linux commit
v4.19-rc1~42^2~62.

6 years agoxlat: add AUDIT_INTEGRITY_POLICY_RULE to nl_audit_types.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:38:51 +0000 (11:38 +0200)]
xlat: add AUDIT_INTEGRITY_POLICY_RULE to nl_audit_types.in

* xlat/nl_audit_types.in (AUDIT_INTEGRITY_POLICY_RULE): New constant,
introduced by Linux commit v4.19-rc1~124^2~5.

6 years agortnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:31:34 +0000 (11:31 +0200)]
rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value

* xlat/rtnl_ifla_xdp_attached_mode.in: New file.
* rtnl_link.c: Include "xlat/rtnl_ifla_xdp_attached_mode.h".
(decode_ifla_xdp_attached): New function.
(ifla_xdp_nla_decoders) <[IFLA_XDP_ATTACHED]>: Use
decode_ifla_xdp_attached instead of decode_nla_u8.
* tests/nlattr_ifla_xdp.c: Add checks for IFLA_XDP_ATTACHED decoding.

6 years agortnl_link: add new IFLA_XDP_* attributes
Eugene Syromyatnikov [Sun, 19 Aug 2018 09:14:27 +0000 (11:14 +0200)]
rtnl_link: add new IFLA_XDP_* attributes

Introduced by Linux commit v4.19-rc1~140^2~364^2~6^2~6.

* xlat/rtnl_ifla_xdp_attrs.in (IFLA_XDP_DRV_PROG_ID,
IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID): New constants.
* rtnl_link.c (ifla_xdp_nla_decoders): Add decoders for
IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, and IFLA_XDP_HW_PROG_ID.
* tests/nlattr_ifla_xdp.c: Add checks for new attributes.

6 years agoxlat: update v4l2_control_ids.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:58:11 +0000 (10:58 +0200)]
xlat: update v4l2_control_ids.in

* xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_VP8_PROFILE): Renamed
from V4L2_CID_MPEG_VIDEO_VPX_PROFILE (the latter is now a synonym),
by Linux commit v4.19-rc1~137^2~270.
(V4L2_CID_MPEG_VIDEO_VP9_PROFILE): New constant, introduced by Linux
commit v4.19-rc1~137^2~269.

6 years agoxlat: add SO_TXTIME to sock_options.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:54:51 +0000 (10:54 +0200)]
xlat: add SO_TXTIME to sock_options.in

* xlat/sock_options.in (SO_TXTIME): New constant, introduced by Linux
commit v4.19-rc1~140^2~465^2~12.

6 years agonetlink_smc_diag: implement SMC_DIAG_DMBINFO decoding
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:48:06 +0000 (10:48 +0200)]
netlink_smc_diag: implement SMC_DIAG_DMBINFO decoding

The message has been added by Linux commit v4.19-rc1~140^2~507^2~1.

* linux/smc_diag.h: Include "gcc_compat.h".
(enum): Add SMC_DIAG_DMBINFO.
(struct smcd_diag_dmbinfo): New type definition.
* xlat/smc_diag_attrs.in (SMC_DIAG_DMBINFO): New constant.
* netlink_smc_diag.c (decode_smc_diag_dmbinfo): New function.
(smc_diag_msg_nla_decoders) [SMC_DIAG_DMBINFO]: New decoder, calls
decode_smc_diag_dmbinfo.
* tests/nlattr_smc_diag_msg.c: Add SMC_DIAG_DMBINFO check.

6 years agoxlat: add SCTP_REUSE_PORT to sock_sctp_options.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 07:59:01 +0000 (09:59 +0200)]
xlat: add SCTP_REUSE_PORT to sock_sctp_options.in

* xlat/sock_sctp_options.in (SCTP_REUSE_PORT): New constant, introduced
by Linux commit v4.19-rc1~140^2~518.

6 years agoxlat: add IN_MASK_CREATE to inotify_flags.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 07:57:04 +0000 (09:57 +0200)]
xlat: add IN_MASK_CREATE to inotify_flags.in

* xlat/inotify_flags.in (IN_MASK_CREATE): New constant, introduced by
Linux commit v4.19-rc1~115^2.
* tests/inotify.c (main): Update expected output.

6 years agotests: workaround systemd-nspawn habit of disabling unimplemented syscalls
Dmitry V. Levin [Wed, 22 Aug 2018 20:38:27 +0000 (20:38 +0000)]
tests: workaround systemd-nspawn habit of disabling unimplemented syscalls

* tests/nsyscalls.c (test_syscall): Do not assume that unimplemented
syscalls always fail with ENOSYS.

6 years agotests: workaround systemd-nspawn habit of disabling mlockall syscall
Dmitry V. Levin [Wed, 22 Aug 2018 20:38:27 +0000 (20:38 +0000)]
tests: workaround systemd-nspawn habit of disabling mlockall syscall

* tests/mmap.c (main): Do not assume that mlockall syscall always
succeeds.

6 years agotests: workaround systemd-nspawn habit of disabling munlockall syscall
Dmitry V. Levin [Wed, 22 Aug 2018 20:38:27 +0000 (20:38 +0000)]
tests: workaround systemd-nspawn habit of disabling munlockall syscall

* tests/munlockall.c (main): Do not assume that munlockall syscall
always succeeds.

6 years agoDecode AF_SMC netlink messages unconditionally
Eugene Syromyatnikov [Sun, 19 Aug 2018 08:43:47 +0000 (10:43 +0200)]
Decode AF_SMC netlink messages unconditionally

As smc_diag.h is bundled, there is little sense to build AF_SMC support
conditionally.

* netlink_smc_diag.c [!AF_SMC]: Include xlat/addrfams.h under
XLAT_MACROS_ONLY, enable the rest of file.
* netlink_sock_diag.c: Include xlat/addrfams.h under XLAT_MACROS_ONLY.
(diag_decoders): Remove "ifdef AF_SMC" condition for [AF_SMC], reorder
in accordance with address family values.
* tests/nlattr_smc_diag_msg.c [!AF_SMC]: Define AF_SMC to 43, enable
the rest of test.

6 years agostrace.c: introduce struct tcb_wait_data
Dmitry V. Levin [Tue, 14 Aug 2018 13:43:34 +0000 (13:43 +0000)]
strace.c: introduce struct tcb_wait_data

Introduce a new structure to pass information between next_event(),
restart_delayed_tcb(), and dispatch_event().

This is going to be used by a subsequent change of next_event().

* strace.c (struct tcb_wait_data): New type.
(next_event): Remove parameters, return a pointer
to const struct tcb_wait_data.  Return NULL instead of TE_BREAK.
(dispatch_event): Replace all parameters with a pointer
to const struct tcb_wait_data, obtain the trace event, siginfo,
and status from its fields.
(restart_delayed_tcb): Add local struct tcb_wait_data variable
with te field set to TE_RESTART, pass it to dispatch_event().
(main): Remove status and si variables, update next_event()
and dispatch_event() invocations.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: fix typo in smc_protocols.in
Eugene Syromyatnikov [Sun, 19 Aug 2018 19:51:15 +0000 (21:51 +0200)]
xlat: fix typo in smc_protocols.in

* xlat/smc_protocols.in: s/^MCPROTO_SMC/SMCPROTO_SMC/.

6 years agoci: add a test with the latest gcc and mainline headers
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: add a test with the latest gcc and mainline headers

* .gitlab-ci.yml (gcc-x86_64-libdw-mainline): New entry.
* .travis.yml (CC=gcc-8, KHEADERS=torvalds/linux): Likewise.

6 years agoci: update gitlab ubuntu image
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: update gitlab ubuntu image

* .gitlab-ci.yml (image): Replace "ubuntu:17.10" with "ubuntu:18.04".

6 years agoci: install kernel headers after compiler dependencies
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: install kernel headers after compiler dependencies

* ci/install-dependencies.sh: Install kernel headers after compiler
dependencies to avoid a needless attempt to install $common_packages.

6 years agoci: fix kernel headers version diagnostics
Dmitry V. Levin [Sun, 19 Aug 2018 10:26:18 +0000 (10:26 +0000)]
ci: fix kernel headers version diagnostics

* ci/run-build-and-tests.sh: Honor $CPPFLAGS when printing
kernel headers version.

6 years agotests: enhance test coverage of evdev ioctl
Zhibin Li [Fri, 10 Aug 2018 12:17:38 +0000 (20:17 +0800)]
tests: enhance test coverage of evdev ioctl

* tests/ioctl_evdev.c (main): Test EVIOCGMTSLOTS(8) command.

6 years agotests: check decoding of successful evdev ioctl
Zhibin Li [Wed, 1 Aug 2018 09:54:35 +0000 (17:54 +0800)]
tests: check decoding of successful evdev ioctl

* tests/ioctl_evdev-success.c: New file.
* tests/ioctl_evdev-success-v.c: Likewise.
* tests/ioctl_evdev-success.test: New test.
* tests/ioctl_evdev-success-v.test: Likewise.
* tests/.gitignore: Add ioctl_evdev-success and ioctl_evdev-success-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add the two tests mentioned above.

6 years agoevdev: fix decoding of EVIOCGBIT(0, ...)
Zhibin Li [Wed, 1 Aug 2018 09:53:57 +0000 (17:53 +0800)]
evdev: fix decoding of EVIOCGBIT(0, ...)

There is a comment in drivers/input/evdev.c which says:
/* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */

That is, EVIOCGBIT(0, ...) should return a bit mask with supported
event types instead of SYN_* event codes.

* defs.h (evdev_ev): New prototype.
* evdev.c: Include "xlat/evdev_ev.h" and remove "xlat/evdev_sync.h".
(bit_ioctl) <case EV_SYN>: Replace EV_SYN with 0, use evdev_ev
with XT_SORTED in decode_bitset invocation instead.
* ioctl.c: Do not include "xlat/evdev_ev.h".
(evdev_decode_number): Print nr == 0x20 as "0" instead of "EV_SYN".
* tests/ioctl_evdev.c (main): Use 0 instead of EV_SYN in EVIOCGBIT
output.
* xlat/evdev_sync.in: Remove.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.10~89 "Add decoding for evdev ioctls"
6 years agoevdev: fix decoding of bit sets
Zhibin Li [Wed, 1 Aug 2018 09:53:57 +0000 (17:53 +0800)]
evdev: fix decoding of bit sets

According to drivers/input/evdev.c:bits_to_user(),
the Linux kernel returns the number of bytes, not bits.

* evdev.c (decode_bitset_): Treat syscall return value as the number
of bytes.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Fixes: v4.10~89 "Add decoding for evdev ioctls"
6 years agokvm: decode the argument of KVM_CHECK_EXTENSION
Pierre Marsais [Thu, 16 Aug 2018 19:04:41 +0000 (20:04 +0100)]
kvm: decode the argument of KVM_CHECK_EXTENSION

xlat/kvm_cap.in has been generated using the following command line:

grep '#define\s\+KVM_CAP' $linux/include/uapi/linux/kvm.h |
sed -E -e 's/^#define\s+([^ \t]+)\s*([0-9]+).*$/printf "%-40s%s\n" \1 \2/e' \
       -e 's/ {8}/\t/g; s/ +/\t/g'

* xlat/kvm_cap.in: New file.
* kvm.c: Include "xlat/kvm_cap.h".
(kvm_ioctl_decode_check_extension): New function.
(kvm_ioctl): Use it.
* tests/ioctl_kvm_run_common.c (main): Check decoding
of KVM_CHECK_EXTENSION command.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
6 years agoxlat: update V4L2_CID_USER_*_BASE constants
Dmitry V. Levin [Sat, 18 Aug 2018 07:22:47 +0000 (07:22 +0000)]
xlat: update V4L2_CID_USER_*_BASE constants

* xlat/v4l2_control_id_bases.in (V4L2_CID_USER_S2255_BASE,
V4L2_CID_USER_SI476X_BASE, V4L2_CID_USER_SAA7134_BASE,
V4L2_CID_USER_ADV7180_BASE, V4L2_CID_USER_TC358743_BASE,
V4L2_CID_USER_MAX217X_BASE): New constants.

6 years agoxlat: workaround V4L2_CID_USER_IMX_BASE Linux kernel ABI breakage
Dmitry V. Levin [Sat, 18 Aug 2018 07:22:47 +0000 (07:22 +0000)]
xlat: workaround V4L2_CID_USER_IMX_BASE Linux kernel ABI breakage

Linux kernel commit v4.18-rc2-106-g421860b9d47053badce4b247576fa48df9ab4c48
has changed the value of V4L2_CID_USER_IMX_BASE constant introduced
by commit v4.13-rc1~141^2~121 because the old value was already used
by V4L2_CID_USER_MAX217X_BASE.

This is of course an ABI breakage that affects Linux kernels starting
with 4.13 and up to 4.18, as well as their LTS derivatives.

Since the imx driver didn't provide any public control ID definitions,
it looks like the best way to handle this situation is to pretend that
the old value of V4L2_CID_USER_IMX_BASE didn't exist.

* xlat/v4l2_control_id_bases.in (V4L2_CID_USER_IMX_BASE): Redefine.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoPost-release administrivia
Dmitry V. Levin [Tue, 14 Aug 2018 10:11:12 +0000 (10:11 +0000)]
Post-release administrivia

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

6 years agoPrepare for 4.24 release v4.24
Dmitry V. Levin [Tue, 14 Aug 2018 00:01:02 +0000 (00:01 +0000)]
Prepare for 4.24 release

* NEWS: Update for 4.24 release.

6 years agoUpdate copyright headers
Dmitry V. Levin [Sun, 12 Aug 2018 22:22:32 +0000 (22:22 +0000)]
Update copyright headers

Headers updated automatically using maint/update_copyright_years.sh
script.

6 years agoUpdate ioctl entries from linux v4.18
Gleb Fotengauer-Malinovskiy [Fri, 10 Aug 2018 16:07:34 +0000 (19:07 +0300)]
Update ioctl entries from linux v4.18

* linux/32/ioctls_inc_align16.h: Update from linux v4.18-rc8
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/s390x/ioctls_arch0.h: Likewise.
* NEWS: Mention this.

6 years agomaint: update for linux v4.18
Gleb Fotengauer-Malinovskiy [Fri, 10 Aug 2018 16:06:38 +0000 (19:06 +0300)]
maint: update for linux v4.18

* maint/ioctls_sym.sh: Add workaround for linux/omap3isp.h file.

6 years agoReplace BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL
Dmitry V. Levin [Sun, 12 Aug 2018 09:50:33 +0000 (09:50 +0000)]
Replace BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL

Linux kernel commit v4.18-rc1~37^2~66 introduced FS_IOC_[GS]ETFSLABEL
ioctl constants as generalized copies of BTRFS_IOC_[GS]ET_FSLABEL.

* linux/32/ioctls_inc_align16.h: Replace BTRFS_IOC_[GS]ET_FSLABEL
with FS_IOC_[GS]ETFSLABEL.
* 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.
* maint/ioctls_sym.sh: Remove BTRFS_IOC_[GS]ET_FSLABEL.
* tests/btrfs.c (FS_IOC_GETFSLABEL, FS_IOC_SETFSLABEL): Add fallback
definitions.
(btrfs_test_label_ioctls, btrfs_test_read_ioctls): Replace
BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL.

6 years agoopen.c: use __O_TMPFILE
Eugene Syromyatnikov [Tue, 31 Jul 2018 12:21:32 +0000 (14:21 +0200)]
open.c: use __O_TMPFILE

As it is the flag kernel actually checks against,
and it is now guaranteed to have a fallback definition.

* open.c (STRACE_O_TMPFILE): Remove.
(decode_open): Use __O_TMPFILE instead of STRACE_O_TMPFILE.

6 years agoxlat: regenerate sock_options.in
Dmitry V. Levin [Sun, 5 Aug 2018 18:57:25 +0000 (18:57 +0000)]
xlat: regenerate sock_options.in

* xlat/sock_options.in: Regenerate using maint/gen_xlat_defs.sh script.
* xlat/sock_options.sh: Remove.

6 years agoxlat: add fallback definitions to open_mode_flags
Dmitry V. Levin [Sun, 5 Aug 2018 18:57:25 +0000 (18:57 +0000)]
xlat: add fallback definitions to open_mode_flags

* xlat/open_mode_flags.in: Regenerate using maint/gen_xlat_defs.sh script
to provide fallback definitions.  Implement a workaround for O_NDELAY.

Co-Authored-by: Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: remove non-Linux flags from open_mode_flags
Eugene Syromyatnikov [Wed, 20 Jun 2018 16:57:07 +0000 (18:57 +0200)]
xlat: remove non-Linux flags from open_mode_flags

* xlat/open_mode_flags.in (O_PRIV, FNDELAY, FAPPEND, FMARK, FDEFER,
FSHLOCK, FEXLOCK, FCREAT, FTRUNC, FEXCL, FNBIO, FSYNC, FNOCTTY,
O_SHLOCK, O_EXLOCK): Remove flags that are not present in Linux.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoxlat: add fallback definitions to madvise_cmds
Dmitry V. Levin [Sun, 5 Aug 2018 18:57:25 +0000 (18:57 +0000)]
xlat: add fallback definitions to madvise_cmds

* xlat/madvise_cmds.in: Regenerate using maint/gen_xlat_defs.sh script
to provide fallback definitions.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: add fallback definitions to mmap_flags
Dmitry V. Levin [Sun, 5 Aug 2018 18:57:25 +0000 (18:57 +0000)]
xlat: add fallback definitions to mmap_flags

* xlat/mmap_flags.in: Regenerate using maint/gen_xlat_defs.sh script
to provide fallback definitions.  Implement a workaround for MAP_RENAME.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agomaint: add a Linux UAPI headers crawler
Eugene Syromyatnikov [Sun, 5 Aug 2018 14:26:15 +0000 (16:26 +0200)]
maint: add a Linux UAPI headers crawler

This script is going to be used to generate xlat fallback values.

* maint/gen_xlat_defs.sh: New file.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agostrace.spec.in: use $RPM_OPT_FLAGS when building auxiliary programs
Dmitry V. Levin [Sun, 5 Aug 2018 11:49:04 +0000 (11:49 +0000)]
strace.spec.in: use $RPM_OPT_FLAGS when building auxiliary programs

* strace.spec.in: Set CFLAGS_FOR_BUILD to "$RPM_OPT_FLAGS" so that
$RPM_OPT_FLAGS is honored when building auxiliary programs like
ioctlsort.

6 years agostrace.spec.in: compress changelog files
Dmitry V. Levin [Sun, 5 Aug 2018 11:49:04 +0000 (11:49 +0000)]
strace.spec.in: compress changelog files

Some say uncompressed changelog files are too big.

* strace.spec.in: Compress ChangeLog and ChangeLog-CVS using gzip -9n.

6 years agostrace.spec.in: use a SUSE-specific group name for SUSE
Dmitry V. Levin [Sun, 5 Aug 2018 11:49:04 +0000 (11:49 +0000)]
strace.spec.in: use a SUSE-specific group name for SUSE

Since, apparently, it isn't quite happy with a simple group name
"Development/Debuggers".

* strace.spec.in (Group): Add %{?suse_version:/Tools}.

6 years agostrace.spec.in: use a SUSE-specific license name for SUSE
Eugene Syromyatnikov [Mon, 11 Jun 2018 05:42:57 +0000 (07:42 +0200)]
strace.spec.in: use a SUSE-specific license name for SUSE

Since, apparently, it isn't quite happy with a simple "BSD".

* strace.spec.in (License): Add %{?suse_version:-3-Clause}.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: allow any error code when trying to set time
Eugene Syromyatnikov [Sun, 5 Aug 2018 05:14:34 +0000 (07:14 +0200)]
tests: allow any error code when trying to set time

Lower expectations of particular error code numbers when trying to set
time.  This helps to workaround issues with unexpected return codes
in some exotic environments where EPERM is returned instead of EINVAL
(e.g. mock that uses systemd-nspawn).

* tests/clock_xettime.c (main): Do not hardcode EINVAL, print return
codes using sprintrc.
* tests/xettimeofday.c (main): Likewise.
* NEWS: Mention this fix.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agos390x: fix build with old kernel headers
Eugene Syromyatnikov [Sun, 5 Aug 2018 07:38:17 +0000 (09:38 +0200)]
s390x: fix build with old kernel headers

Avoid defining psw_compat_t and s390_compat_regs if their definitions
are provided by kernel.  Before Linux commit v3.10-rc1~201^2~11,
these definition were available in <asm/ptrace.h>.

* configure.ac (AC_CHECK_TYPES): Check for s390_compat_regs.
* linux/s390x/arch_regs.c [HAVE_S390_COMPAT_REGS]: Do not define
psw_compat_t and s390_compat_regs.
* NEWS: Mention this fix.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agostrace.spec.in: minor updates here and there
Dmitry V. Levin [Sun, 5 Aug 2018 11:49:04 +0000 (11:49 +0000)]
strace.spec.in: minor updates here and there

* strace.spec.in: Add descriptive comments to build requirements.
Introduce %maybe_use_defattr and use it instead of %defattr.
Add output of ld --version to the build environment information.
Use printf instead of echo -e.

6 years agostrace.spec.in: remove strace64 subpackage
Dmitry V. Levin [Sun, 5 Aug 2018 11:49:04 +0000 (11:49 +0000)]
strace.spec.in: remove strace64 subpackage

strace64 subpackage used to be installed into ppc32 and sparc32
userspace running by a 64-bit kernel to trace 64-bit processes.

As simultaneous decoding of processes running both in 64-bit and 32-bit
personality is fully supported on every architecture with compat kernel
support for quite some time, one can just install a 64-bit strace and
there is no more need for that strace64 kludge.

* strace.spec.in (strace64_arches, copy64, %ifarch %{strace64_arches}):
Remove.

6 years agoUpdate NEWS
Dmitry V. Levin [Sat, 4 Aug 2018 20:34:09 +0000 (20:34 +0000)]
Update NEWS

6 years agoUpdate NEWS
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
Update NEWS

6 years agortnl_route: decode new RTA_* attributes
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
rtnl_route: decode new RTA_* attributes

* rtnl_route.c (rtmsg_nla_decoders): Add entries for RTA_IP_PROTO,
RTA_SPORT, and RTA_DPORT.

6 years agoxlat: update RTA_* constants
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
xlat: update RTA_* constants

* xlat/rtnl_route_attrs.in: Add RTA_IP_PROTO, RTA_SPORT, and RTA_DPORT
* constants introduced by Linux kernel commit v4.18-rc1~114^2~165^2~2.

6 years agortnl_link: decode new IFLA_BRPORT_* attributes
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
rtnl_link: decode new IFLA_BRPORT_* attributes

* rtnl_link.c (ifla_brport_nla_decoders): Add entries for
IFLA_BRPORT_GROUP_FWD_MASK, IFLA_BRPORT_NEIGH_SUPPRESS, and
IFLA_BRPORT_ISOLATED.

6 years agoxlat: update IFLA_BRPORT_* constants
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
xlat: update IFLA_BRPORT_* constants

* xlat/rtnl_ifla_brport_attrs.in: Add IFLA_BRPORT_GROUP_FWD_MASK
constant introduced by Linux kernel commit v4.15-rc1~84^2~607.
Add IFLA_BRPORT_NEIGH_SUPPRESS constant introduced by Linux kernel
commit v4.15-rc1~84^2~523^2~2.
Add IFLA_BRPORT_ISOLATED constant introduced by Linux kernel commit
v4.18-rc1~114^2~142.

6 years agoxlat: update IFA_* constants
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
xlat: update IFA_* constants

* xlat/rtnl_addr_attrs.in: Add IFA_RT_PRIORITY constant introduced
by Linux kernel commit v4.18-rc1~114^2~108^2~3

6 years agoxlat: update RTPROT_* constants
Dmitry V. Levin [Sat, 4 Aug 2018 11:45:20 +0000 (11:45 +0000)]
xlat: update RTPROT_* constants

* xlat/routing_protocols.in: Add RTPROT_BGP, RTPROT_ISIS, RTPROT_OSPF,
RTPROT_RIP, and RTPROT_EIGRP constants introduced by Linux kernel commit
v4.18-rc1~114^2~90.

6 years agoxlat: save the script used to generate xlat/sock_options.in
Dmitry V. Levin [Wed, 1 Aug 2018 14:57:16 +0000 (14:57 +0000)]
xlat: save the script used to generate xlat/sock_options.in

* xlat/sock_options.sh: New file from commit message of commit v4.23~199.

6 years agotests: check decoding of getsockopt(PACKET_STATISTICS)
Zhibin Li [Tue, 24 Jul 2018 08:59:16 +0000 (16:59 +0800)]
tests: check decoding of getsockopt(PACKET_STATISTICS)

* tests/net-tpacket_stats.c: New file.
* tests/net-tpacket_stats-success.c: Likewise.
* tests/gen_tests.in (net-tpacket_stats): New test.
* tests/net-tpacket_stats-success.test: Likewise.
* tests/.gitignore: Add net-tpacket_stats and net-tpacket_stats-success.
* tests/Makefile.am (check_PROGRAMS): Add net-tpacket_stats-success.
(DECODER_TESTS): Add net-tpacket_stats-success.test.
* tests/pure_executables.list: Add net-tpacket_stats.

6 years agotests: check decoding of setsockopt(PACKET_[R|T]X_RING)
Zhibin Li [Tue, 24 Jul 2018 08:59:15 +0000 (16:59 +0800)]
tests: check decoding of setsockopt(PACKET_[R|T]X_RING)

* tests/net-tpacket_req.c: New file.
* tests/.gitignore: Add net-tpacket_req.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (net-tpacket_req): New test.

6 years agotests: check decoding of setsockopt(PACKET_[ADD|DROP]_MEMBERSHIP)
Zhibin Li [Tue, 24 Jul 2018 08:59:14 +0000 (16:59 +0800)]
tests: check decoding of setsockopt(PACKET_[ADD|DROP]_MEMBERSHIP)

* tests/net-packet_mreq.c: New file.
* tests/.gitignore: Add net-packet_mreq.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (net-packet_mreq): New test.

6 years agotests: bring lists back to the sorted order
Dmitry V. Levin [Fri, 20 Jul 2018 16:18:17 +0000 (16:18 +0000)]
tests: bring lists back to the sorted order

* tests/.gitignore: Make the list sorted again.
* tests/pure_executables.list: Likewise.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS):
Likewise.

6 years agotests: check decoding of successful quotactl
Zhibin Li [Wed, 18 Jul 2018 10:00:58 +0000 (18:00 +0800)]
tests: check decoding of successful quotactl

* tests/quotactl-success.c: New file.
* tests/quotactl-success-v.c: Likewise.
* tests/quotactl-xfs-success.c: Likewise.
* tests/quotactl-xfs-success-v.c: Likewise.
* tests/quotactl-success.test: New test.
* tests/quotactl-success-v.test: Likewise.
* tests/quotactl-xfs-success.test: Likewise.
* tests/quotactl-xfs-success-v.test: Likewise.
* tests/.gitignore: Add quotactl-success, quotactl-success-v,
quotactl-xfs-success and quotactl-xfs-success-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add four new tests listed above.
* tests/quotactl.h: [INJECT_RETVAL] (check_quota): Use errstr instead of
sprintrc; check that returned value is equivalent to the injected one;
append "(INJECTED)" string to errstr.
* tests/quotactl.c: Changed condition rc != 0 to rc < 0 in callback
functions and value of opaque pointer addr_cb_arg in order to check
successful injection.
* tests/quotactl-xfs.c: Likewise.

6 years agonet: enhance decoding of getsockopt(PACKET_STATISTICS)
Dmitry V. Levin [Wed, 18 Jul 2018 20:03:18 +0000 (20:03 +0000)]
net: enhance decoding of getsockopt(PACKET_STATISTICS)

* net.c (print_tpacket_stats): Change decoder to match the kernel
behaviour: getsockopt syscall accepts any non-negative *optlen and
writes either MIN(sizeof(struct tpacket_stats), *optlen) or
MIN(sizeof(struct tpacket_stats_v3), *optlen) bytes of data.

6 years agonet: compile SO_PEERCRED/SO_ATTACH_FILTER/SO_ATTACH_REUSEPORT_CBPF code unconditionally
Dmitry V. Levin [Wed, 18 Jul 2018 20:03:18 +0000 (20:03 +0000)]
net: compile SO_PEERCRED/SO_ATTACH_FILTER/SO_ATTACH_REUSEPORT_CBPF code unconditionally

* net.c: Remove checks for SO_PEERCRED, SO_ATTACH_FILTER, and
SO_ATTACH_REUSEPORT_CBPF macros as they are defined unconditionally
since commit v4.23~199.

6 years agonet: enhance decoding of getsockopt(SO_PEERCRED)
Dmitry V. Levin [Tue, 17 Jul 2018 22:07:40 +0000 (22:07 +0000)]
net: enhance decoding of getsockopt(SO_PEERCRED)

* net.c (print_ucred): Rename to print_get_ucred, change decoder
to match the kernel behaviour: getsockopt syscall accepts any
non-negative *optlen and writes MIN(sizeof(struct ucred), *optlen)
bytes of data.
(print_getsockopt): Replace print_ucred with print_get_ucred.
* tests/so_percred.c: Include <string.h>.
(main): Update expected output.

6 years agonet: enhance decoding of getsockopt(SO_LINGER)
Dmitry V. Levin [Mon, 16 Jul 2018 22:57:59 +0000 (22:57 +0000)]
net: enhance decoding of getsockopt(SO_LINGER)

* net.c (print_get_linger): Change decoder to match the kernel
behaviour: getsockopt syscall accepts any non-negative *optlen
and writes MIN(sizeof(struct linger), *optlen) bytes of data.
(print_set_linger): Move after definition of SYS_FUNC(getsockopt).
* tests/so_linger.c: Include <stddef.h> and <string.h>.
(main): Update expected output.

6 years agonet: generalize getsockopt length check
Dmitry V. Levin [Wed, 18 Jul 2018 19:25:52 +0000 (19:25 +0000)]
net: generalize getsockopt length check

* net.c (print_getsockopt): Apply (ulen < 0 || rlen < 0) check for all
cases.  As the kernel neither accepts nor returns a negative length
in case of successful getsockopt syscall invocation, these negative
values must have been forged by userspace.

6 years agotests: fix build with fresh glibc
Dmitry V. Levin [Sun, 15 Jul 2018 22:14:29 +0000 (22:14 +0000)]
tests: fix build with fresh glibc

Workaround additional incompatibility between <sys/stat.h> and
<asm/stat.h> introduced by glibc-2.27.9000-566-gfd70af4.

* tests/xstatx.c (statx, statx_timestamp): Redefine before the inclusion
of <sys/stat.h> to avoid conflicts between definitions provided by the
linux kernel headers and the GNU libc.

6 years agotests/quotactl.h: document check_quota
Eugene Syromyatnikov [Sun, 15 Jul 2018 04:44:07 +0000 (07:44 +0300)]
tests/quotactl.h: document check_quota

* tests/quotactl.h (check_quota): Add a comment describing the function
usage.

6 years agotests/quotactl-xfs.c: fix indentation
Zhibin Li [Thu, 12 Jul 2018 09:32:14 +0000 (17:32 +0800)]
tests/quotactl-xfs.c: fix indentation

6 years agotests: use check_quota for invalid quotactl commands
Zhibin Li [Thu, 12 Jul 2018 09:32:12 +0000 (17:32 +0800)]
tests: use check_quota for invalid quotactl commands

Use check_quota function for invalid commands instead of manual quotactl
syscall invocations. In this way successful injection can also be checked
for these commands in the next commit.

* tests/quotactl.c (main): Add invalid_cmd_str and invalid_id_str local
variables, remove unused variable rc, use check_quota instead of manual
quotactl syscall invocations.
* tests/quotaclt.c (main): Add invalid_cmd_str variable, remove unused
variable rc, use check_quota instead of manual quotactl syscall invocations.

6 years agotests: enhance test coverage of quotactl syscall parser
Zhibin Li [Thu, 12 Jul 2018 09:32:11 +0000 (17:32 +0800)]
tests: enhance test coverage of quotactl syscall parser

* tests/quotactl.c (print_dqfmt): New function.
(main): Use print_dqfmt to print flags of quota format, improve existing
tests and add more tests for Q_GETFMT.
* tests/quotactl-xfs.c: Improve existing tests and add more tests for
Q_XGETQSTAT and Q_XGETQSTATV.

6 years agotests/quotactl-xfs.c: fix typos in QCMD
Zhibin Li [Thu, 12 Jul 2018 09:32:10 +0000 (17:32 +0800)]
tests/quotactl-xfs.c: fix typos in QCMD

* tests/quotactl-xfs.c (main): fix typos of sub-commands in QCMD.

6 years agoMpersify decoder of struct xfs_dqstats
Zhibin Li [Thu, 12 Jul 2018 09:32:09 +0000 (17:32 +0800)]
Mpersify decoder of struct xfs_dqstats

* xfs_quota_stat.h: New file.
* fetch_struct_xfs_quotastat.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* quota.c: Include xfs_quota_stat.h
(struct fs_qfilestat, struct xfs_dqstats): Moved to xfs_quota_stat.h.
(decode_cmd_data) <case Q_XGETQSTAT>: Use fetch_struct_quotastat.

6 years agoquota: fix disorder of PRINT_FIELD invocations
Zhibin Li [Thu, 12 Jul 2018 09:32:08 +0000 (17:32 +0800)]
quota: fix disorder of PRINT_FIELD invocations

* quota.c (decode_cmd_data) <case Q_XGETQSTAT>: Print fields
of struct xfs_dqstats in the structure order.

6 years agotests: extend coverage for other fcntl flags
Zhibin Li [Thu, 12 Jul 2018 06:49:42 +0000 (14:49 +0800)]
tests: extend coverage for other fcntl flags

* tests/fcntl-common.c: Include <assert.h>.
(struct fcntl_cmd_check): New structure.
(print_retval_flags, test_other_set_cmd, test_other_get_cmd,
print_flags_getfd, print_flags_getsig, print_flags_getlease,
test_fcntl_others): New functions.
(main): Use test_fcntl_others.

6 years agoImplement -e kvm= option on all architectures
Dmitry V. Levin [Wed, 11 Jul 2018 00:00:57 +0000 (00:00 +0000)]
Implement -e kvm= option on all architectures

Make -e kvm= interface available on all architectures by adding a stub
on those architectures that do not have <linux/kvm.h>.

* filter_qualify.c (qualify_kvm): Define unconditionally.
(qual_options): Define qualify_kvm entry unconditionally.
* strace.c (usage): Mention kvm argument of -e option unconditionally.

6 years agoxlat: update bpf(2)-related constants
Eugene Syromyatnikov [Mon, 25 Jun 2018 01:31:32 +0000 (03:31 +0200)]
xlat: update bpf(2)-related constants

* xlat/bpf_attach_type.in (BPF_CGROUP_UDP4_SENDMSG,
BPF_CGROUP_UDP6_SENDMSG): New constant, introduced by Linux commit
v4.18-rc1~114^2~9^2~20^2~4.
(BPF_LIRC_MODE2): New constant, introduced by Linux commit
v4.18-rc1~114^2~9^2~15^2~1.
* xlat/bpf_commands.in (BPF_BTF_LOAD): New constant, introduced by Linux
commit v4.18-rc1~114^2~417^2~1^2~5.
(BPF_BTF_GET_FD_BY_ID): New constant, introduced by Linux commit
v4.18-rc1~114^2~223^2~21^2~4.
(BPF_TASK_FD_QUERY): New constant, introduced by Linux commit
v4.18-rc1~114^2~148^2~1^2~5.
* xlat/bpf_map_types.in (BPF_MAP_TYPE_XSKMAP): New constant, introduced
by Linux commit v4.18-rc1~114^2~304^2~4^2~8.
(BPF_MAP_TYPE_SOCKHASH): New constant, introduced by Linux commit
v4.18-rc1~114^2~223^2~5^2~2.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_LWT_SEG6LOCAL): New constant,
introduced by Linux commit v4.18-rc1~114^2~148^2~2^2~1.
(BPF_PROG_TYPE_LIRC_MODE2): New constant, introduced by Linux commit
v4.18-rc1~114^2~9^2~15^2~1.
* tests/bpf.c: Update expected output.

6 years agoWire up io_pgetevents and rseq on hppa, microblaze, mips, powerpc, and s390
Eugene Syromyatnikov [Mon, 25 Jun 2018 01:06:23 +0000 (03:06 +0200)]
Wire up io_pgetevents and rseq on hppa, microblaze, mips, powerpc, and s390

* linux/hppa/syscallent.h ([350]): Wire up io_pgetevents syscall
introduced by Linux commit v4.18-rc3~7^2~2.
* linux/microblaze/syscallent.h ([399], [400]): Wire up io_pgetevents
and rseq syscalls introduced by Linux commit v4.18-rc3~33^2~2.
* linux/mips/syscallent-n32.h ([6331], [6332]): Wire up rseq and
io_pgetevents syscalls introduced by Linux commits v4.18-rc2~11^2~2
and v4.18-rc2~11^2, respectively.
* linux/mips/syscallent-n64.h ([5327], [5328]): Likewise.
* linux/mips/syscallent-o32.h ([4367], [4368]): Likewise.
* linux/powerpc/syscallent.h ([388]): Wire up io_pgetevents syscall
introduced by Linux commit v4.18-rc3~14^2~2.
* linux/powerpc64/syscallent.h ([388]): Likewise.
* linux/s390/syscallent.h ([382], [383]): Wire up io_pgetevents
and rseq syscalls introduced by Linux commits v4.18-rc4~18^2~1
and v4.18-rc4~18^2, respectively.
* linux/s390x/syscallent.h([382], [383]): Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agomaint: improve the tag message
Eugene Syromyatnikov [Fri, 22 Jun 2018 11:26:06 +0000 (13:26 +0200)]
maint: improve the tag message

* maint/gen-tag-message.sh: Align the wording of the changes section
header with the one used in NEWS, add a reference to CREDITS in
"Contributors" section.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoUpgrade invalid -e kvm= argument to a fatal error
Dmitry V. Levin [Tue, 10 Jul 2018 16:10:38 +0000 (16:10 +0000)]
Upgrade invalid -e kvm= argument to a fatal error

* filter_qualify.c (qualify_kvm): Call error_msg_and_die instead of
error_msg in case of invalid -e kvm= argument.
* tests/options-syntax.test: Check it.

6 years agoMention -e inject option in "strace -h" output
Dmitry V. Levin [Tue, 10 Jul 2018 16:10:38 +0000 (16:10 +0000)]
Mention -e inject option in "strace -h" output

* strace.c (usage): Mention inject argument of -e option.

6 years agotests: check decoding of vcpu auxstr
Masatake YAMATO [Sat, 7 Jul 2018 07:49:13 +0000 (16:49 +0900)]
tests: check decoding of vcpu auxstr

* tests/ioctl_kvm_run_common.c: Rename from ioctl_kvm_run.c.
(run_kvm): Parametrize printing of KVM_RUN ioctl with print_KVM_RUN
invocation.
(main): Invoke optional KVM_NO_CPUID_CALLBACK macro when the old kernel
behavior is detected.
* tests/Makefile.am (EXTRA_DIST): Add ioctl_kvm_run_common.c.
* tests/ioctl_kvm_run.c: New file, a wrapper around
ioctl_kvm_run_common.c.
* ioctl_kvm_run_auxstr_vcpu.c: Likewise.
* tests/gen_tests.in (ioctl_kvm_run_auxstr_vcpu): New test.
* tests/pure_executables.list: Add ioctl_kvm_run_auxstr_vcpu.
* tests/.gitignore: Likewise.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agostrace.1.in: document -e kvm=vcpu option
Masatake YAMATO [Sat, 7 Jul 2018 07:49:12 +0000 (16:49 +0900)]
strace.1.in: document -e kvm=vcpu option

* strace.1.in (-e kvm=vcpu): Document new option.
* NEWS: Mention -e kvm=vcpu option.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agokvm: attach the exit reason of vcpu as auxstr to KVM_RUN output
Masatake YAMATO [Sat, 7 Jul 2018 07:49:11 +0000 (16:49 +0900)]
kvm: attach the exit reason of vcpu as auxstr to KVM_RUN output

In KVM, a virtual machine implementation like Qemu can access a vcpu
via ioctl.  KVM_RUN is an ioctl command to enter vcpu.  The command
returns control for various reasons: needs of device emulation or
consuming time slices are the typical ones.  The vmi takes a different
action for the reason.

We, strace users, want to know the reason to understand kvm.  This
change prints the reason as auxstr if "-e kvm=vcpu" option is given,
and if strace runs on Linux 4.16.0 or higher, which includes commit
e46b469278a59781f9b25ff608af84892963821b, "kvm: embed vcpu id to dentry
of vcpu anon inode."

The way to get the reason is a bit complicated because the ioctl does
not return it to the userspace directly.  Instead, the vmi and kvm
communicate via an area of the process virtual memory where the fd of
vcpu is mmap'ed.  strace must peek the area to know the reason.

The change does three things: (1) recording the area for the given vcpu
when the target calls VCPU_CREATE to vcpu_info_list per tcb data field,
(2) verifying the data recorded in vcpu_info_list before doing (3), and
(3) decoding the exit reason field of the area.

The change is complicated because there is a case that strace
does not have a chance to do (1) if -p option is used.
In this case, vcpu_info data created in the step (2).

The area has more fields than "exit reason",
dumping them may be implemented in the future.

* defs.h (struct tcb) [HAVE_LINUX_KVM_H]: Add vcpu_info_list field.
[HAVE_LINUX_KVM_H]: (kvm_run_structure_decoder_init,
kvm_vcpu_info_free): New declarations.
* strace.c (usage): Add "kvm" as a new expression for -e option.
(droptcb): Call kvm_vcpu_info_free.
* filter_qualify.c (qualify_kvm): New function calling
kvm_run_structure_decoder_init to enable for attaching the exit
reason to auxstr.
(qual_options): Add "kvm" as an entry.
* xlat/kvm_exit_reason.in: New file.
* kvm.c: Include xmalloc.h and mmap_cache.h.
(dump_kvm_run_structure): New static variable.
(kvm_run_structure_decoder_init): New function.
(vcpu_info): New struct definition representing the 3-tuple: vcpu file
descriptor, id of the vcpu, and mmap'ed entry.
(vcpu_find, vcpu_alloc, vcpu_register, vcpu_getinfo,
kvm_vcpu_info_free): New functions to access tcb's vcpu_info_list
field and vcpu_info data type.
(is_map_for_file, map_len): New helper functions.
(kvm_ioclt_run_attach_auxstr, kvm_ioctl_decode_run): New functions
decoding vcpu exit reason and attaching the decoded data to auxstr
field of tcb.
(kvm_ioctl_create_vcpu): Call vcpu_register to make an entry mapping
a file descriptor and the vcpu id associated with the fd.
(kvm_ioctl): Call kvm_ioctl_decode_run.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agommap_cache: add customizable search function
Masatake YAMATO [Sat, 7 Jul 2018 07:49:10 +0000 (16:49 +0900)]
mmap_cache: add customizable search function

* mmap_cache.c (mmap_cache_search_custom): New function.
* mmap_cache.h (mmap_cache_search_fn): New type.
(mmap_cache_search_custom): New function prototype.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agotests: check verbose decoding of kvm ioctl
Pierre Marsais [Thu, 28 Jun 2018 02:37:45 +0000 (03:37 +0100)]
tests: check verbose decoding of kvm ioctl

* tests/ioctl_kvm_run-v.c: New file.
* tests/ioctl_kvm_run.c: Include xlat.h and xlat/kvm_cpuid_flags.h.
(print_kvm_segment, print_kvm_sregs, print_kvm_regs): New functions.
(run_kvm): Use them.
(print_cpuid_ioctl) [VERBOSE]: Print verbose ioctl decoding.
* tests/gen_tests.in (ioctl_kvm_run-v): New entry.
* tests/pure_executables.list: Add ioctl_kvm_run-v.
* tests/.gitignore: Likewise.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
6 years agotests: check decoding of kvm ioctls related to struct kvm_cpuid2
Pierre Marsais [Thu, 28 Jun 2018 02:37:44 +0000 (03:37 +0100)]
tests: check decoding of kvm ioctls related to struct kvm_cpuid2

* tests/ioctl_kvm_run.c [!HAVE_STRUCT_KVM_CPUID2]: Skip the test.
(KVM_MAX_CPUID_ENTRIES): New macro.
(print_cpuid_ioctl): New function.
(main): Add tests for cpuid related ioctl.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
6 years agokvm: decode the argument of KVM_SET_CPUID2 and KVM_GET_*_CPUID ioctl commands
Pierre Marsais [Thu, 28 Jun 2018 02:37:43 +0000 (03:37 +0100)]
kvm: decode the argument of KVM_SET_CPUID2 and KVM_GET_*_CPUID ioctl commands

* configure.ac (AC_CHECK_TYPES): Add struct kvm_cpuid2.
* xlat/kvm_cpuid_flags.in: New file.
* kvm.c [HAVE_STRUCT_KVM_CPUID2]: Include "xlat/kvm_cpuid_flags.h".
[HAVE_STRUCT_KVM_CPUID2] (print_kvm_cpuid_entry, kvm_ioctl_decode_cpuid2):
New functions.
(kvm_ioctl) [HAVE_STRUCT_KVM_CPUID2]: Use kvm_ioctl_decode_cpuid2.
* NEWS: Mention this improvement.

Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agonet: fix a typo in print_tpacket_stats
Zhibin Li [Thu, 5 Jul 2018 14:43:25 +0000 (22:43 +0800)]
net: fix a typo in print_tpacket_stats