Janosch Frank [Fri, 30 Nov 2018 15:41:39 +0000 (16:41 +0100)]
s390x: beautify sthyi data tail prints
The test already expects a ", " before the print of struct
padding. Let's add it to s390.c to make the output look a bit nicer and
fix test runs on z/VM that have padding at the end of the STHYI structs.
* s390.c (decode_ebcdic): Add missing comma.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Dmitry V. Levin [Sat, 24 Nov 2018 23:56:38 +0000 (23:56 +0000)]
Enhance error diagnostics when the first exec fails
When the first exec fails, strace used to print the trace of the child
process till its end, producing a lot of confusing output.
Enhance the diagnostics by hiding irrelevant parts of the trace.
* defs.h (TCB_CHECK_EXEC_SYSCALL): New macro. Change values of TCB_*
macros listed after TCB_CHECK_EXEC_SYSCALL.
(check_exec_syscall): New macro.
* strace.c (dispatch_event) <TE_STOP_BEFORE_EXECVE>: Clear
TCB_CHECK_EXEC_SYSCALL flag.
* syscall.c (syscall_entering_trace): Do not clear TCB_HIDE_LOG when
TCB_CHECK_EXEC_SYSCALL is set, set TCB_CHECK_EXEC_SYSCALL along with
clearing TCB_HIDE_LOG.
(syscall_exiting_decode): Set TCB_HIDE_LOG if TCB_CHECK_EXEC_SYSCALL
is set.
* tests/first_exec_failure.test: New file.
* tests/Makefile.am (MISC_TESTS): Add first_exec_failure.test.
arm: replace empty syscall entry definitions with comments
* linux/arm/syscallent.h ([222]): Remove definition, add a comment
that it was tux syscall.
([223]): Remove definition, add comment that it was unused.
([254]): Remove definition, add comment that it was reserved
for set_thread_area.
([255]): Remove definition, add comment that it was reserved
for get_thread_area.
Dmitry V. Levin [Wed, 21 Nov 2018 01:44:16 +0000 (01:44 +0000)]
Move kill_save_errno to a separate header file
This function is going to be used outside strace.c,
so make it globally available and move it to a separate header file.
* strace.c (kill_save_errno): Add "inline" keyword, change return type
from "void" to "int", move the function ...
* kill_save_errno.h: ... to this new file.
* Makefile.am (strace_SOURCES): Add it.
Dmitry V. Levin [Tue, 20 Nov 2018 04:56:30 +0000 (04:56 +0000)]
syscall_entering_trace: set TCB_FILTERED along with TCB_HIDE_LOG
This allows to remove some of hide_log() checks that became redundant.
* syscall.c (syscall_entering_trace): Set TCB_FILTERED along with
TCB_HIDE_LOG, remove now redundant hide_log(tcp) check.
(syscall_exiting_decode): Replace "filtered(tcp) || hide_log(tcp)"
with "filtered(tcp)".
Dmitry V. Levin [Mon, 12 Nov 2018 13:42:11 +0000 (13:42 +0000)]
print_inet_addr: print nameless and named addresses using the same style
* sockaddr.c (print_inet_addr): Handle var_name == NULL case in a more
structured way: use inet_addr("%s") form to print AF_INET addresses
in structureless contexts where no structure field name is available.
Likewise, use inet_pton(AF_INET6, "%s") that case.
* tests/nlattr_ifaddrmsg.c (main): Update expected output.
* tests/nlattr_ifla_af_spec.c (main): Likewise.
Complements: v4.19~76 "print_inet_addr: add support of invocations without field name"
Dmitry V. Levin [Wed, 24 Oct 2018 09:05:38 +0000 (09:05 +0000)]
arm, sparc, sparc64: wire up io_pgetevents
* linux/arm/syscallent.h ([399]): Wire up io_pgetevents syscall
introduced by Linux commit v4.19-rc7~24^2~1.
(ARM_FIRST_SHUFFLED_SYSCALL, SYS_socket_subcall): Raise from 400 to 500,
to make room for new syscalls.
* linux/sparc/syscallent.h ([361]): Wire up io_pgetevents syscall
introduced by Linux commit v4.19~31^2~5.
* linux/sparc64/syscallent.h: Likewise.
xlat: print _IOC_NONE in symbolic form even if it is equal to 0
On some architectures _IOC_NONE equals to 1, on others it is 0.
Change the way how ioctl direction flags are printed so that
_IOC_NONE is printed in symbolic form even if it is equal to 0.
* xlat/ioctl_dirs.in (_IOC_NONE): Move to the head of the list.
* tests/ioctl_inotify.c (main): Update expected output.
* tests/ioctl_loop. (main): Likewise.c
* tests/ioctl_perf.c (main): Likewise.
* tests/ioctl_scsi.c (main): Likewise.
Since configure uses git-version-gen which in turn depends
on "git describe" or a .tarball-version file, raw archives
generated by "git archive" cannot be built.
* .gitattributes: New file.
* README-github_gitlab-autogenerated-archives.txt: Likewise.
Ignore warnings about overridden initialization of hwaddr_sizes
As hwaddr_sizes array is explicitly initialized this way,
ignore potential warnings reported by gcc -Woverride-init
and clang -Winitializer-overrides.
* gcc_compat.h (CLANG_PREREQ): New macro.
(DIAG_PUSH_IGNORE_OVERRIDE_INIT, DIAG_POP_IGNORE_OVERRIDE_INIT): New
macros non-trivially defined for gcc >= 4.2 and clang >= 2.8.
* sock.c (print_ifreq): Use them to ignore warnings about overridden
initialization of hwaddr_sizes array.
* tests/execve.c (main): Explicitly mark q_envp variable as used
to workaround clang -Wunneeded-internal-declaration bug.
* tests/execveat.c (main): Likewise.
* tests/nsyscalls.c (main): Explicitly mark syscallent variable as used
to workaround clang -Wunneeded-internal-declaration bug.
* xlat/af_packet_versions.in: New file.
* netlink_packet_diag.c: Include "xlat/af_packet_versions.h".
(decode_packet_diag_req): sdiag_protocol shouldn't be decoded as a protocol,
currently it should be set to 0.
(decode_packet_diag_info): Decode pdi_version field using af_packet_versions
xlat; decode pdi_index field as an interface index.
(packet_diag_msg_nla_decoders) <PACKET_DIAG_UID>: Decode using
decode_nla_uid.
(decode_packet_diag_msg): Decode pdiag_num as an low-level protocol.
* tests/netlink_sock_diag.c: Update expected output.
* tests/nlattr_packet_diag_msg.c: Likewise.
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.