sockaddr: add X.25 socket address decoding support
* sockaddr.c: Include <linux/x25.h>.
(print_sockaddr_data_x25): New function.
(sa_printers) <[AF_X25]>: New socket address handler.
* tests/net-sockaddr.c (check_x25): New function.
(main): Use it to check X.25 socket address decoding.
net: add support for AX.25 protocols and socket option names decoding
* xlat/ax25_protocols.in: New file.
* xlat/sock_ax25_options.in: Likewise.
* net.c: Include "xlat/ax25_protocols.h" and "xlat/sock_ax25_options.h".
* (SYS_FUNC(socket)): <[AF_AX25]>: Print protocol name using
ax25_protocols xlat.
(print_sockopt_fd_level_name) <[SOL_AX25]>: Print socket option name
using sock_ax25_options xlat.
* defs.h (print_ax25_addr): New prototype.
* print_fields.h (PRINT_FIELD_AX25_ADDR): New macro.
* sockaddr.c: Include <linux/ax25.h>.
(check_ax25_address, ax25_addr2str, print_ax25_addr_raw,
print_ax25_addr, print_sockaddr_data_ax25): New functions.
(sa_printers) <[AF_AX25]>: New printer.
* tests/net-sockaddr.c (AX25_ADDR): New macro.
(check_ax25): New function.
(main): Use it to check AX.25 socket address decoding.
In order to be able to obtain sanitised device name internally.
* defs.h (get_ifname): New declaration.
* print_ifindex.c (get_ifname): Refactor, leaving out addition
of if_nametoindex("") part.
(sprint_ifname): New function, adds if_nametoindex("")
to get_ifname's output.
(print_ifindex): Use sprint_ifname instead of get_ifname.
socketutils: store more information in protocols table
This also allows getting rid of all these *_v[46]_get calls.
* socketutils.c (unix_get, inet_get, netlink_gen): Add family, protocol,
and proto_name paramteres, use them where appropriate.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Remove.
(protocols): Add family and proto fields to the structure, call inet_get
for IP/IPv6 protocols.
(get_sockaddr_by_inode_uncached): Update protocols->get calls.
netlink: honor custom xlat style setting during nlmsg flags printing
Commit v4.23~343 introduced xlat style argument to printflags_ex, but
XLAT_STYLE_DEFAULT was introduced only in the next commit v4.23~342,
which led to missing out fixing the sole external user of this
peculiar extended interface.
* netlink.c (decode_nlmsg_flags): Use XLAT_STYLE_DEFAULT instead of
XLAT_STYLE_ABBREV in printflags_ex call.
xlat: add ability to specify a default string to print_xlat_ex
In order to avoid dealing with xlat verbosity styles outside xlat code
as much as possible.
* defs.h (xlat_style_private_flag_bits): Rename from
print_array_flag_bits, add PXF_DEFAULT_STR_BIT.
(xlat_style_private_flags): Rename from print_array_flags, add
FLAG_(PXF_DEFAULT_STR).
* xlat.c (print_xlat_ex): Handle PXF_DEFAULT_STR by interpreting str
as a default value (print both value and str in XLAT_STYLE_ABBREV).
netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value
* xlat/sock_shutdown_flags.in: New file.
* netlink_smc_diag.c: Include "xlat/sock_shutdown_flags.h".
(decode_smc_diag_shutdown): New function.
(smc_diag_msg_nla_decoders) <[SMC_DIAG_SHUTDOWN]>: Use
decode_smc_diag_shutdown.
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_SHUTDOWN.
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.
* 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.
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.
* 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.
* 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.
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.
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.
* 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.
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.
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.
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"
* 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>
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.
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>
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>
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.
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.
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.