2023-02-26  Dmitry V. Levin  <ldv@strace.io>

	Prepare for 6.2 release.
	* NEWS: Update for 6.2 release.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2023-02-24  Dmitry V. Levin  <ldv@strace.io>

	Fix build on alpha.
	Workaround a bug in glibc headers that fail to provide
	si_trapno field in their definition of siginfo_t on alpha.

	Link: https://sourceware.org/bugzilla/show_bug.cgi?id=30173
	Resolves: https://github.com/strace/strace/issues/220

	* configure.ac (AC_CHECK_MEMBERS): Add siginfo_t.si_trapno.
	* src/printsiginfo.c [ALPHA]: Guard use of si_trapno with
	HAVE_SIGINFO_T_SI_TRAPNO.
	* tests/ptrace.c [ALPHA]: Likewise.
	* NEWS: Mention this fix.

2023-02-23  Dmitry V. Levin  <ldv@strace.io>

	filter_seccomp: do not call PR_SET_NO_NEW_PRIVS if privileged enough.
	If strace process is privileged enough to add SECCOMP_MODE_FILTER
	without PR_SET_NO_NEW_PRIVS, there is no need to do the latter.

	* src/filter_seccomp.c (init_seccomp_filter): Try to add
	SECCOMP_MODE_FILTER first, and if it failed with EACCES, do
	PR_SET_NO_NEW_PRIVS and try to add SECCOMP_MODE_FILTER again.

2023-02-22  Masatake YAMATO  <yamato@redhat.com>

	NEWS: mention collision resolution for overlapping ioctl commands.
	Resolves: https://github.com/strace/strace/pull/239

2023-02-21  Masatake YAMATO  <yamato@redhat.com>

	dyxlat: make the type of the xlat created by dyxlat_alloc customizable.
	* src/defs.h (dyxlat_alloc): Add xlat_type argument.
	* src/dyxlat.c (dyxlat_alloc): Likewise.
	* src/socketutils.c (genl_families_xlat): Pass XT_NORMAL to dyxlat_alloc
	invocation.

2023-02-20  Masatake YAMATO  <yamato@redhat.com>

	ioctl: use finfo as hints for resolving overlapping ioctl commands.
	Such an overlapping can be observed, e.g. when running vi under strace:

	  ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 ...

	After this change, when the file descriptor corresponds to a terminal
	device, strace would be able to resolve the collision between ioctl
	commands from different subsystems:

	  ioctl(0, TCSETS, {B38400 ...

	* src/defs.h (term_ioctl_decode_command_number): New function
	declaration.
	* src/ioctl.c (ioctl_decode_command_number): Add a new argument
	for passing finfo that can be used as hints for decoding ioctl commands.
	Handle the code `T'.
	(SYS_FUNC(ioctl)): Pass finfo as hints to ioctl_decode_command_number.
	* src/term.c: Include "xlat/term_cmds_overlapping.h".
	(term_ioctl_decode_command_number): Decode the command in
	this earlier stage if the corresponding file descriptor corresponds
	to a terminal device.
	* src/xlat/term_cmds_overlapping.in: New file listing overlapping
	tty ioctl commands.
	* tests/ioctl_termios.c (main): Extend cmds[] in checks[].
	(main::checks::cmds): Add new member "pass_invalid_fd".
	Omit " or ..." substring in case of TCSETS, TCSETSW, and TCSETSF for
	a valid tty descriptor.
	Add test commands for invalid descriptors.

2023-02-20  Masatake YAMATO  <yamato@redhat.com>

	ioctl: pass finfo to ioctl_decode() as hints for decoding.
	Just pass the data, a real use case comes in subsequent commits.

	* src/ioctl.c (ioctl_decode): Add "finfo" argument.
	(SYS_FUNC(ioctl)): Pass the finfo for the target fd to ioctl_decode.

2023-02-20  Masatake YAMATO  <yamato@redhat.com>

	ioctl: prepare finfo only when ioctl command can overlap.
	If an ioctl decoder does not deal with overlapping commands,
	avoid issuing extra syscalls required to obtain finfo.

	* src/ioctl.c (ioctl_command_overlaps): New function.
	(SYS_FUNC(ioctl)): Call getfdpath_pid only when ioctl_command_overlaps
	returns true.

2023-02-20  Masatake YAMATO  <yamato@redhat.com>

	ioctl: collect finfo just before decoding ioctl command.
	This way finfo can be used as hints for decoding ioctl commands.

	* src/defs.h (get_finfo_for_dev): New declaration.
	(printfd_with_finfo): New inline function - a thin wrapper around
	printfd_pid_with_finfo.
	* src/util.c (get_finfo_for_dev): Remove static modifier to
	make it reusable the ioctl syscall decoder.
	(SYS_FUNC(ioctl)): Call get_finfo_for_dev and printfd_with_finfo
	instead of calling printfd.

2023-02-19  Masatake YAMATO  <yamato@redhat.com>

	Allow to pass pre-filled finfo data to printdev() from upper layers.
	printdev() used to collect struct finfo data just before printing.
	However, if the finfo data can be filled somewhere else, printdev()
	does not have to collect the finfo data by itself.

	* src/defs.h (printfd_pid_with_finfo): New function declaration.
	(printfd_pid): Turn into a thin wrapper around printfd_pid_with_finfo.
	(struct finfo): New member "deleted".
	* src/util.c (get_finfo_for_dev): Initialize "deleted" member of finfo.
	(printdev): Add finfo argument.  If non-NULL is specified as finfo
	argument, omit get_finfo_for_dev invocation.
	(printfd_pid): Rename to printfd_pid_with_finfo, add finfo argument
	and pass it on to printdev.

2023-02-19  Masatake YAMATO  <yamato@redhat.com>

	util: introduce get_finfo_for_dev function.
	printdev() function does two things: it first obtains the information
	about the given fd and then prints it.  Introduce get_finfo_for_dev()
	to implement the first part of printdev().

	struct finfo is a new data structure for keeping information passed from
	get_finfo_for_dev() to printdev().

	* src/defs.h (struct finfo): New data structure.
	* src/utils.c (get_finfo_for_dev): New function derived from printdev.
	(printdev): Use it.

2023-02-19  Dmitry V. Levin  <ldv@strace.io>

	tests: enhance ptrace_syscall_info error diagnostics.
	* tests/ptrace_syscall_info.c (test_none, test_entry, test_exit): In
	case of a fatal mismatch, print more expected output before termination,
	this helps in diagnostics of linux kernel bugs.

2023-02-18  Dmitry V. Levin  <ldv@strace.io>

	Update .mailmap.
	* .mailmap: Update email addresses of Elvira Khabirova.

2023-02-18  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: remove getpid and getppid from check_PROGRAMS.
	getpid and getppid are already listed in $(PURE_EXECUTABLES).
	Remove the duplicate entries.

	* tests/Makefile.am (check_PROGRAMS): Remove getpid and getppid.

	Fixes: v4.17~123 ("tests: add tests for getpid and getppid syscalls")

2023-02-15  Dmitry V. Levin  <ldv@strace.io>

	strace: declare nflag variable as static.
	Apparently, nflag is not used outside the compilation unit where it is
	defined.

	* src/strace.c (nflag): Add static qualifier.

	Reported-by: Masatake YAMATO <yamato@redhat.com>
	Fixes: v5.9~55 "strace: add an option for printing syscall numbers"

2023-02-14  Dmitry V. Levin  <ldv@strace.io>

	treewide: replace "sed -r" with "sed -E"
	Use -E option instead of -r to enable use extended regular expression
	syntax in sed expressions.  It has been supported for years by GNU sed,
	and is now included in POSIX.

	Link: https://www.austingroupbugs.net/view.php?id=528
	Resolves: https://github.com/strace/strace/issues/216

2023-02-13  Dmitry V. Levin  <ldv@strace.io>

	xlat: update V4L2_CTRL_TYPE_* constants.
	* src/xlat/v4l2_control_types.in (V4L2_CTRL_TYPE_MPEG2_QUANTISATION,
	V4L2_CTRL_TYPE_MPEG2_SEQUENCE, V4L2_CTRL_TYPE_MPEG2_PICTURE): New
	constants introduced by Linux kernel commit v5.14-rc1~165^2~241.
	(V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR, V4L2_CTRL_TYPE_VP9_FRAME): New
	constants introduced by Linux kernel commit v5.17-rc1~114^2~207.
	(V4L2_CTRL_TYPE_HEVC_SPS, V4L2_CTRL_TYPE_HEVC_PPS,
	V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS, V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX,
	V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS): New constants introduced by Linux
	kernel commit v6.0-rc1~139^2~93.
	* NEWS: Mention this change.

	xlat: update V4L2_CTRL_FLAG_* constants.
	* src/xlat/v4l2_control_flags.in (V4L2_CTRL_FLAG_DYNAMIC_ARRAY): New
	constant introduced by Linux kernel commit v6.0-rc1~139^2~104.
	* tests/ioctl_v4l2-success.c (main): Update expected output.
	* NEWS: Mention this change.

	xlat: update V4L2_PIX_FMT_* constants.
	* src/xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_P010): New constant
	introduced by Linux kernel commit v6.0-rc1~139^2~420.
	(V4L2_PIX_FMT_YUVA32, V4L2_PIX_FMT_YUVX32): New constants
	introduced by Linux kernel commit v6.0-rc1~139^2~126.
	(V4L2_PIX_FMT_HEVC_SLICE): New constant introduced by Linux kernel
	commit v6.0-rc1~139^2~94.
	(V4L2_PIX_FMT_P010_4L4): New constant introduced by Linux kernel
	commit v6.0-rc1~139^2~73.
	(V4L2_PIX_FMT_AJPG): New constant introduced by Linux kernel commit
	v6.2-rc1~125^2~249^2~13.
	V4L2_PIX_FMT_NV12_8L128, V4L2_PIX_FMT_NV12_10BE_8L128): New constants
	introduced by Linux kernel commit v6.2-rc1~125^2~50.
	* NEWS: Mention this change.

	xlat: update V4L2_CID_* constants.
	* src/xlat/v4l2_control_id_bases.in (V4L2_CID_USER_ISL7998X_BASE): New
	constant introduced by Linux kernel commit v5.18-rc1~153^2~82^2~6.
	(V4L2_CID_USER_DW100_BASE): New constant introduced by Linux kernel
	commit v6.1-rc1~130^2~98.
	(V4L2_CID_USER_ASPEED_BASE): New constant introduced by Linux kernel
	commit v6.2-rc1~125^2~249^2~12.
	* src/xlat/v4l2_control_ids.in (V4L2_CID_COLORFX_RGB): New constant
	introduced by Linux kernel commit v5.17-rc1~114^2~388.
	* NEWS: Mention this change.

2023-02-12  Dmitry V. Levin  <ldv@strace.io>

	xlat: update NFT_MSG_* constants.
	* src/xlat/nf_nftables_msg_types.in (NFT_MSG_GETRULE_RESET): New
	constant introduced by Linux kernel commit v6.2-rc1~99^2~210^2~2.
	* src/netlink.c (decode_nlmsg_flags_netfilter) Handle it.
	* NEWS: Mention this change.

2023-02-11  Dmitry V. Levin  <ldv@strace.io>

	xlat: update NTF_EXT_* constants.
	* src/xlat/neighbor_cache_entry_ext_flags.in (NTF_EXT_LOCKED): New
	constant introduced by Linux kernel commit v6.2-rc1~99^2~297^2~1.
	* tests/nlattr_ndmsg.c (main): Update expected output.
	* NEWS: Mention this change.

2023-02-10  Dmitry V. Levin  <ldv@strace.io>

	xlat: update LANDLOCK_ACCESS_FS_* constants.
	* src/xlat/landlock_ruleset_access_fs.in (LANDLOCK_ACCESS_FS_TRUNCATE):
	New constant introduced by Linux kernel commit v6.2-rc1~138^2~8.
	* tests/landlock_add_rule.c (main): Update expected output.
	* tests/landlock_create_ruleset.c: Likewise.
	* NEWS: Mention this change.

2023-02-09  Dmitry V. Levin  <ldv@strace.io>

	xlat: update KVM_* constants.
	* src/xlat/kvm_cap.in (KVM_CAP_S390_PROTECTED_ASYNC_DISABLE): New
	constant introduced by Linux kernel commit v6.2-rc1~77^2~5^2~5.
	(KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP): New constant introduced
	by Linux kernel commit v6.2-rc1~77^2~4.
	* NEWS: Mention this change.

2023-02-08  Dmitry V. Levin  <ldv@strace.io>

	Revert "Update .mailmap"
	* .mailmap: Remove email addresses of Sven Schnelle per request.

	This reverts commit 3c26d12962a8d907f276d218bf9acc2e522e9340.

2023-02-07  Dmitry V. Levin  <ldv@strace.io>

	tests: check umovestr return value when the string crosses a page boundary
	* tests/ioctl_kd.c (check_kbdsent): New check.

2023-02-06  Dmitry V. Levin  <ldv@strace.io>

	ucopy: fix umovestr return value when the string crosses page boundaries
	* src/ucopy.c (umovestr): When the string crosses page boundaries,
	take the length on each page into account.

	Resolves: https://github.com/strace/strace/issues/217

2023-02-05  Dmitry V. Levin  <ldv@strace.io>

	src: fix typo in comments.
	* src/util.c: Replace umovenstr with umovestr in comments.

2023-01-31  Helge Deller  <deller@gmx.de>

	pc.test: Fix up order of strace messages again.
	It seems I managed to swap two lines with my last patch.
	This fixes it up again and brings it in the correct logical order.

	There is no functional change. The testcase succeeds in both cases.

	Fixes: 1b828bb0f48a ("hppa: Fix pc.test testcase on hppa architecture")

2023-01-30  Sven Schnelle  <svens@linux.ibm.com>

	membarrier: add MEMBARRIER_CMD_GET_REGISTRATIONS flag.

	* src/xlat/membarrier_cmds.in (MEMBARRIER_CMD_GET_REGISTRATIONS): New
	constant which is likely to be introduced in Linux kernel v6.3.
	* tests/membarrier.c (main): Update expected output.
	* NEWS: Mention the change.

2023-01-30  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v6.2.
	* src/linux/32/ioctls_inc_align16.h: Update from linux v6.2-rc6 using
	ioctls_gen.sh.
	* src/linux/32/ioctls_inc_align32.h: Likewise.
	* src/linux/32/ioctls_inc_align64.h: Likewise.
	* src/linux/64/ioctls_inc.h: Likewise.
	* src/linux/x32/ioctls_inc0.h: Likewise.
	* src/linux/aarch64/ioctls_arch0.h: Likewise.
	* src/linux/i386/ioctls_arch0.h: Likewise.
	* src/linux/mips/ioctls_arch0.h: Likewise.
	* src/linux/powerpc/ioctls_arch0.h: Likewise.
	* src/linux/s390/ioctls_arch0.h: Likewise.
	* src/linux/s390x/ioctls_arch0.h: Likewise.
	* src/linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

2023-01-29  Helge Deller  <deller@gmx.de>

	hppa: Fix pc.test testcase on hppa architecture.
	On hppa the lowest 2 bits of an address encodes the (parisc-specific)
	address space in which a program runs. For userspace processes the space
	number is 3, which is why an instruction at e.g. 0x100 shows up in the
	address registers as 0x103.
	This behaviour is different than on other architectures, which is
	why the pc.test testcase fails on hppa.

	Fix the testcase by simply dropping the last nibble of the address
	when comparing the output, e.g. search for "0x10?" instead of "0x100".

2023-01-29  Helge Deller  <deller@gmx.de>

	hppa: Drop special handling of fanotify syscalls on parisc.
	The fanotify syscall in the parisc kernel has been fixed by Linux kernel
	commit v3.16-rc5~6^2~1 and now behaves like the other architectures, so
	drop the special workaround for hppa.

2023-01-29  Helge Deller  <deller@gmx.de>

	hppa: Fix display of mask for rt_sigreturn syscall.
	Fix FUNC_GET_RT_SIGFRAME_ADDR to return correct address to the
	sigframe so that the mask can be shown for the rt_sigreturn syscall.

	This patch cleans up and simplifies the address calculation when
	running on Linux kernels < 5.18, where the signal trampoline code
	was stored in the executable stack.

	With kernel 5.18 we added a VDSO with the trampoline code, could drop
	the neccessarity of an executable stack and provided the offset to the
	ucontext of the rt_sigframe struct for gdb and to simplify the
	calculation sigframe address.

	With this patch the rt_sigreturn.gen.test passes for 5.16 and 6.1
	kernels on hppa.

2023-01-29  Helge Deller  <deller@gmx.de>

	hppa: Disable workaround for hppa in syscall number tampering.
	This basically disables the workaround added by commit ce494f63d2
	("hppa: workaround kernel bug in syscall number tampering").
	It's not needed any longer and has been fixed in upstream kernels
	by Linux kernel commit v5.0-rc8~9^2~1.

	Basically the remaining part of that commit could go as well,
	since hppa was the only user.

2023-01-29  Helge Deller  <deller@gmx.de>

	hppa: Switch to getregset call on hppa.
	PTRACE_GETREGSET support was introduced in the parisc kernel by Linux
	kernel commit v4.7-rc1~58^2~10.

	This fixes the tampering of syscall return values.

2023-01-26  Jan Macku  <jamacku@redhat.com>

	ci: Add missing permission `security-events`
	Differential ShellCheck requires permission `security-events: write`
	to successfully upload the SARIF file to GitHub.

	This permission might be optional for some repositories since they
	allow all permissions for all workflows in settings. But I wouldn't advise
	this setting since the best security practice is to allow only a minimal
	set of required permissions.

2023-01-21  Dmitry V. Levin  <ldv@strace.io>

	xlat: update KEY_* constants.
	* src/xlat/evdev_keycode.in (KEY_CAMERA_ACCESS_ENABLE,
	KEY_CAMERA_ACCESS_DISABLE, KEY_CAMERA_ACCESS_TOGGLE): New constants
	introduced by Linux kernel commit v6.2-rc1~116^2^2~117.
	* NEWS: Mention this.

2023-01-20  Dmitry V. Levin  <ldv@strace.io>

	xlat: update IFLA_* constants.
	* src/xlat/rtnl_ifla_brport_attrs.in (IFLA_BRPORT_MAB): New constant
	introduced by Linux kernel commit v6.2-rc1~99^2~297^2~1.
	* src/xlat/rtnl_link_attrs.in (IFLA_DEVLINK_PORT): New constant
	introduced by Linux kernel commit v6.2-rc1~99^2~296^2.
	* src/rtnl_link.c (ifla_brport_nla_decoders): Add IFLA_BRPORT_MAB.
	(ifinfomsg_nla_decoders): Add IFLA_DEVLINK_PORT.
	* tests/nlattr_ifla_brport.c (main): Update expected output.
	* tests/nlattr_ifla_linkinfo.c: Likewise.
	* NEWS: Mention this.

2023-01-16  Jan Macku  <jamacku@redhat.com>

	ci(lint): add shell linter - Differential ShellCheck.
	It performs differential ShellCheck scans and report results directly in
	pull request.

	documentation:
	https://github.com/redhat-plumbers-in-action/differential-shellcheck

2023-01-06  Dmitry V. Levin  <ldv@strace.io>

	xlat: update BPF_* constants.
	* src/xlat/bpf_map_types.in (BPF_MAP_TYPE_CGRP_STORAGE): New constant
	introduced by Linux kernel commit v6.2-rc1~99^2~309^2~7^2~6.
	* NEWS: Mention this change.
	* tests/bpf.c (BPF_MAP_CREATE_checks): Update.

2023-01-05  Dmitry V. Levin  <ldv@strace.io>

	xlat: update ALG_* constants.
	* src/xlat/sock_alg_options.in (ALG_SET_KEY_BY_KEY_SERIAL): New constant
	introduced by Linux kernel commit v6.2-rc1~87^2~128.
	* NEWS: Mention this change.

2023-01-04  Dmitry V. Levin  <ldv@strace.io>

	bundled: update linux UAPI headers to v6.2-rc2.
	* bundled/linux/include/uapi/linux/btrfs.h: Update to headers_install'ed
	Linux kernel v6.2-rc2.
	* bundled/linux/include/uapi/linux/btrfs_tree.h: Likewise.
	* bundled/linux/include/uapi/linux/dcbnl.h: Likewise.
	* bundled/linux/include/uapi/linux/fscrypt.h: Likewise.
	* bundled/linux/include/uapi/linux/if_alg.h: Likewise.
	* bundled/linux/include/uapi/linux/if_bridge.h: Likewise.
	* bundled/linux/include/uapi/linux/if_link.h: Likewise.
	* bundled/linux/include/uapi/linux/input-event-codes.h: Likewise.
	* bundled/linux/include/uapi/linux/io_uring.h: Likewise.
	* bundled/linux/include/uapi/linux/landlock.h: Likewise.
	* bundled/linux/include/uapi/linux/mptcp.h: Likewise.
	* bundled/linux/include/uapi/linux/neighbour.h: Likewise.
	* bundled/linux/include/uapi/linux/netfilter/ipset/ip_set.h: Likewise.
	* bundled/linux/include/uapi/linux/netfilter/nf_tables.h: Likewise.
	* bundled/linux/include/uapi/linux/netfilter/nfnetlink_cttimeout.h: Likewise.
	* bundled/linux/include/uapi/linux/tcp.h: Likewise.
	* bundled/linux/include/uapi/linux/v4l2-common.h: Likewise.
	* bundled/linux/include/uapi/linux/v4l2-controls.h: Likewise.
	* bundled/linux/include/uapi/linux/version.h: Likewise.
	* bundled/linux/include/uapi/linux/videodev2.h: Likewise.
	* bundled/linux/include/uapi/rdma/ib_user_verbs.h: Likewise.

2023-01-03  Dmitry V. Levin  <ldv@strace.io>

	io_uring: prepare for <linux/io_uring.h> update.
	* src/io_uring.c: Include "kernel_time_types.h".
	(UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H): New macro.
	* tests/io_uring_register.c: Likewise.
	* tests/io_uring_setup.c: Likewise.

2023-01-02  Dmitry V. Levin  <ldv@strace.io>

	tests: enable time_types.h based tests unconditionally.
	* tests/msg_control.c: Do not include <linux/time_types.h>,
	include "kernel_time_types.h" unconditionally instead.
	(test_scm_timestamp_new, test_scm_timestampns_new): Compile
	unconditionally.
	(test_sol_socket): Call them unconditionally.
	* tests/sockopt-timestamp.c: Do not include <linux/time_types.h>,
	include "kernel_time_types.h" unconditionally instead.
	(print_timestamp_new, print_timestampns_new): Compile unconditionally.
	(main): Call them unconditionally.

2023-01-01  Dmitry V. Levin  <ldv@strace.io>

	Provide fallback definitions for __kernel_sock_timeval and __kernel_timespec
	If kernel headers do not provide linux/time_types.h, provide
	fallback definitions for __kernel_sock_timeval and __kernel_timespec.

	* src/kernel_timespec.h [!HAVE_STRUCT___KERNEL_TIMESPEC]
	(__kernel_timespec): New macro.

	* src/kernel_timespec.h (struct kernel_timespec64_t,
	struct kernel_timespec32_t): New types.
	* src/kernel_time_types.h: New file.
	* src/Makefile.am (libstrace_a_SOURCES): Add it.

2022-12-31  Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint*_sysret_* helpers.
	* src/print_fields.h (tprint_sysret_begin, tprints_sysret_next,
	tprints_sysret_string, tprint_sysret_pseudo_rval, tprint_sysret_end):
	New functions.
	* src/strace.c (print_event_exit): Use them.
	* src/syscall.c (print_err_ret, print_injected_note, print_erestart,
	syscall_exiting_trace): Likewise.

2022-12-30  Dmitry V. Levin  <ldv@strace.io>

	print_syscall_resume: always update printing_tcp.
	* src/syscall.c (print_syscall_resume): Explicitly update printing_tcp
	so that printing_tcp is updated even if printleader is not invoked.
	(syscall_exiting_trace): Do not update printing_tcp after
	print_syscall_resume invocation.
	* src/strace.c (print_event_exit): Likewise.

2022-12-29  Dmitry V. Levin  <ldv@strace.io>

	printleader: do not mark output as unfinished unnecessarily.
	* src/strace.c (printleader): Do not mark staged output
	in other processes as unfinished.
	* tests/status-successful-threads.c: New file.
	* tests/status-successful-threads.test: New test.
	* tests/.gitignore: Add status-successful-threads.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(status_successful_threads_LDADD): New variable.
	(MISC_TESTS): Add status-successful-threads.test.

2022-12-28  Dmitry V. Levin  <ldv@strace.io>

	print_event_exit: do not mark output as unfinished unnecessarily.
	* src/strace.c (print_event_exit): When handling PTRACE_EVENT_EXIT for
	a process, do not mark staged output in other processes as unfinished.
	* tests/status-detached-threads.c: New file.
	* tests/status-detached-threads.test: New test.
	* tests/.gitignore: Add status-detached-threads.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(status_detached_threads_LDADD): New variable.
	(MISC_TESTS): Add status-detached-threads.test.

2022-12-27  Dmitry V. Levin  <ldv@strace.io>

	src: do not use STRACE_PRINTF outside print_fields.h.
	This macro was not intended to be used outside print_fields.h

	* src/v4l2.c (PRINT_FIELD_FRACT): Replace STRACE_PRINTF with
	tprintf_string.

2022-12-26  Dmitry V. Levin  <ldv@strace.io>

	tprints_comment: use tprint_comment_* helpers.
	* src/strace.c (tprints_comment): Use tprint_comment_begin
	and tprint_comment_end.

2022-12-25  Dmitry V. Levin  <ldv@strace.io>

	syscall: introduce print_erestart helper.
	* src/syscall.c (print_erestart): New function.
	(syscall_exiting_trace): Use it.

2022-12-24  Dmitry V. Levin  <ldv@strace.io>

	syscall: simplify syscall_exiting_trace a bit.
	* src/syscall.c (syscall_exiting_trace): Print the auxiliary string
	and the injection note just in one location.

2022-12-23  Dmitry V. Levin  <ldv@strace.io>

	syscall: print injection note after the auxiliary string.
	* src/syscall.c (syscall_exiting_trace): In all cases where injection
	note is printed, make sure it is printed after the auxiliary string,
	not before it.

2022-12-22  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint_arg_name_end helper.
	* src/defs.h (tprint_arg_name_end): New function.
	* src/clone.c (SYS_FUNC(clone)): Use it.

2022-12-21  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: rename tprints_arg_name to tprints_arg_name_begin.

2022-12-20  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: rename tprintf to tprintf_string.

2022-12-19  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: rename tprints to tprints_string.

2022-12-18  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: introduce printflags_in and printflags64_in helpers.
	* src/defs.h (printflags64_in): Rename from printflags64.
	(printflags_in): Rename from printflags.  Use printflags64_in.
	(printflags64, printflags): New functions.
	* src/capability.c (print_cap_bits): Use printflags_in instead of
	printflags.
	* src/fanotify.c (SYS_FUNC(fanotify_init)): Likewise.
	* src/ipc_msg.c (SYS_FUNC(msgget)): Likewise.
	* src/ipc_sem.c (SYS_FUNC(semget)): Likewise.
	* src/ipc_shm.c (SYS_FUNC(shmget)): Likewise.
	* src/net.c (tprint_sock_type): Likewise.
	* src/personality.c (SYS_FUNC(personality)): Likewise.
	* src/statx.c (SYS_FUNC(statx)): Likewise.
	* src/swapon.c (SYS_FUNC(swapon)): Likewise.
	* src/v4l2.c (print_v4l2_buffer_flags, print_v4l2_cid): Likewise.
	* src/clone.c (SYS_FUNC(clone)): Use printflags64_in instead of
	printflags64.
	* src/kexec.c (SYS_FUNC(kexec_load)): Likewise.
	* src/mount.c (SYS_FUNC(mount)): Likewise.
	* src/term.c (decode_oflag, decode_cflag): Likewise.

2022-12-17  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint_flags_begin and tprint_flags_end helpers.
	* src/print_fields.h (tprint_flags_begin, tprint_flags_end): New
	functions.
	(PRINT_FIELD_FLAGS_VERBOSE): Use them.
	* src/bpf_filter.c (print_bpf_filter_code): Likewise.
	* src/bpf_seccomp_filter.c (print_seccomp_filter_k): Likewise.
	* src/capability.c (print_cap_bits): Likewise.
	* src/clone.c (SYS_FUNC(clone), SYS_FUNC(clone3)): Likewise.
	* src/fanotify.c (SYS_FUNC(fanotify_init)): Likewise.
	* src/futex.c (do_futex): Likewise.
	* src/ioctl.c (ioctl_print_code): Likewise.
	* src/ipc.c (SYS_FUNC(ipc)): Likewise.
	* src/ipc_defs.h (PRINTCTL): Likewise.
	* src/ipc_msg.c (SYS_FUNC(msgget)): Likewise.
	* src/ipc_sem.c (SYS_FUNC(semget)): Likewise.
	* src/ipc_shm.c (SYS_FUNC(shmget)): Likewise.
	* src/kd_ioctl.c (kd_mk_tone): Likewise.
	* src/kexec.c (SYS_FUNC(kexec_load)): Likewise.
	* src/mem.c (print_mmap_flags): Likewise.
	* src/memfd_create.c (SYS_FUNC(memfd_create)): Likewise.
	* src/mount.c (SYS_FUNC(mount)): Likewise.
	* src/net.c (tprint_sock_type): Likewise.
	* src/netlink.c (decode_nlmsg_type_netfilter, decode_nlmsg_flags):
	Likewise.
	* src/nlattr.c (print_nlattr, decode_nla_flags): Likewise.
	* src/numa.c (print_mode): Likewise.
	* src/perf.c (print_perf_event_attr): Likewise.
	* src/personality.c (SYS_FUNC(personality)): Likewise.
	* src/sched.c (SYS_FUNC(sched_getattr)): Likewise.
	* src/scsi.c (scsi_ioctl): Likewise.
	* src/statx.c (SYS_FUNC(statx)): Likewise.
	* src/swapon.c (SYS_FUNC(swapon)): Likewise.
	* src/tee.c (tee_print_param_fn): Likewise.
	* src/term.c (decode_oflag, decode_cflag): Likewise.
	* src/v4l2.c (print_v4l2_buffer_flags, print_v4l2_cid): Likewise.
	* src/wait.c (printstatus): Likewise.

2022-12-16  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint_shift_begin and tprint_shift_end helpers.
	* src/print_fields.h (tprint_shift_begin, tprint_shift_end): New
	functions.
	* src/futex.c (do_futex): Use them.
	* src/ipc.c (SYS_FUNC(ipc)): Likewise.
	* src/ipc_shm.c (SYS_FUNC(shmget)): Likewise.
	* src/kd_ioctl.c (kd_mk_tone): Likewise.
	* src/mem.c (print_mmap_flags): Likewise.
	* src/memfd_create.c (SYS_FUNC(memfd_create)): Likewise.
	* src/netlink.c (decode_nlmsg_type_netfilter): Likewise.
	* src/perf.c (print_perf_event_attr): Likewise.
	* src/term.c (decode_cflag): Likewise.
	* src/util.c (print_abnormal_hi): Likewise.
	* src/wait.c (printstatus): Likewise.

2022-12-15  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint_array_index_equal helper.
	* src/print_fields.h (tprint_array_index_equal): Rename from
	tprint_array_index_end.
	(tprint_array_index_end): New function.
	* src/btrfs.c (btrfs_ioctl): Use them.
	* src/term.c (print_cc_char): Likewise.
	* src/util.c (print_array_ex): Likewise.

2022-12-14  Fabrice Le Fessant  <fabrice.le_fessant@ocamlpro.com>
	    Dmitry V. Levin  <ldv@strace.io>

	src: rename tprint_or to tprint_flags_or.

2022-12-13  Dmitry V. Levin  <ldv@strace.io>

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

2022-12-12  Dmitry V. Levin  <ldv@strace.io>

	Prepare for 6.1 release.
	* NEWS: Update for 6.1 release.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2022-12-11  Dmitry V. Levin  <ldv@strace.io>

	statx: decode new fields added to struct statx.
	* src/statx.h (struct_statx): Add stx_mnt_id, stx_dio_mem_align,
	and stx_dio_offset_align fields, update reserved2 field.
	* src/statx.c (SYS_FUNC(statx)): Print the new fields when
	the appropriate bits of struct statx.stx_mask are set.
	* tests/xstatx.c (print_stat) [IS_STATX]: Update expected output.
	* NEWS: Mention this change.

	statx: honor struct statx.stx_mask.
	* src/statx.c (SYS_FUNC(statx)): Make printing of optional struct statx
	fields dependent on the value of struct statx.stx_mask.
	* tests/xstatx.c (print_stat): Update expected output.

	xlat: update TLS_* constants.
	* src/xlat/tls_info_ciphers.in (TLS_CIPHER_ARIA_GCM_128,
	TLS_CIPHER_ARIA_GCM_256): New constants introduced by Linux kernel
	commit v6.1-rc1~170^2~85.
	* tests/nlattr_inet_diag_msg.c (main): Update expected output.
	* NEWS: Mention this change.

	xlat: update STATX_* constants.
	* src/xlat/statx_masks.in (STATX_DIOALIGN): New constant introduced
	by Linux kernel commit v6.1-rc1~187^2~7.
	* tests/xstatx.c (main): Update expected output.
	* NEWS: Mention this change.

	xlat: update PERF_* constants.
	* src/xlat/perf_branch_sample_type.in (PERF_SAMPLE_BRANCH_PRIV_SAVE):
	New constant introduced by Linux kernel commit v6.1-rc1~97^2~60.
	* tests/perf_event_open.c (BRANCH_TYPE_ALL, main): Update expected
	output.
	* NEWS: Mention this change.

	xlat: update NLMSGERR_* constants.
	* src/xlat/nlmsgerr_attrs.in (NLMSGERR_ATTR_MISS_TYPE,
	NLMSGERR_ATTR_MISS_NEST): New constants introduced by Linux kernel
	commit v6.1-rc1~170^2~313^2~4.
	* NEWS: Mention this change.

	xlat: update KVM_* constants.
	* src/xlat/kvm_cap.in (KVM_CAP_DIRTY_LOG_RING_ACQ_REL): New constant
	introduced by Linux kernel commit v6.1-rc1~49^2~1^2~1^2~4.
	* NEWS: Mention this change.

	xlat: update ABS_* constants.
	* src/xlat/evdev_abs.in (ABS_PROFILE): New constant introduced
	by Linux kernel commit v6.1-rc1~54^2^2~9.
	* NEWS: Mention this change.

	xlat: update IFLA_* constants.
	* src/xlat/rtnl_link_attrs.in (IFLA_ALLMULTI): New constant introduced
	by Linux kernel commit v6.1-rc1~170^2~218.
	* src/rtnl_link.c (ifinfomsg_nla_decoders) <IFLA_ALLMULTI>: New entry.
	* NEWS: Mention this change.

	xlat: update ETH_P_* constants.
	* src/xlat/ethernet_protocols.in (ETH_P_CANXL): New constant introduced
	by Linux kernel commit v6.1-rc1~170^2~209^2^2~2.
	* tests/nlattr_ifla_vfinfo.c (main): Update expected output.
	* NEWS: Mention this change.

	xlat: update COUNTER_* constants.
	* src/xlat/counter_ioctl_event_types.in (COUNTER_EVENT_CAPTURE): New
	constant introduced by Linux kernel commit v6.1-rc1~113^2~16.
	* tests/ioctl_counter.c (main): Update expected output.
	* NEWS: Mention this change.

	xlat: update BTRFS_* constants.
	* src/xlat/btrfs_features_compat_ro.in
	(BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE): New constant introduced
	by Linux kernel commit v6.1-rc1~142^2~102.
	* NEWS: Mention this change.

	xlat: update BPF_* constants.
	* src/xlat/bpf_map_types.in (BPF_MAP_TYPE_USER_RINGBUF): New constant
	introduced by Linux kernel commit v6.1-rc1~170^2~10^2~39^2~3.
	* NEWS: Mention this change.
	* tests/bpf.c (BPF_MAP_CREATE_checks): Update.

	xlat: update MADV_* constants.
	* src/xlat/madvise_cmds.in (MADV_COLLAPSE): New constant
	introduced by Linux kernel commit v6.1-rc1~21^2~577.
	* NEWS: Mention this.

2022-12-11  Dmitry V. Levin  <ldv@strace.io>

	bundled: update linux UAPI headers to v6.1.
	In addition to linux/io_uring.h that was excluded from updates because
	of non-trivial implications caused by use of linux/time_types.h in that
	header file starting with v6.0, linux/in.h is also excluded from updates
	due to its use of linux/stddef.h starting with v6.1.

	* bundled/linux/include/uapi/asm-generic/hugetlb_encode.h: Update to
	headers_install'ed Linux kernel v6.1.
	* bundled/linux/include/uapi/linux/btrfs.h: Likewise.
	* bundled/linux/include/uapi/linux/btrfs_tree.h: Likewise.
	* bundled/linux/include/uapi/linux/counter.h: Likewise.
	* bundled/linux/include/uapi/linux/if_link.h: Likewise.
	* bundled/linux/include/uapi/linux/input-event-codes.h: Likewise.
	* bundled/linux/include/uapi/linux/landlock.h: Likewise.
	* bundled/linux/include/uapi/linux/netfilter/ipset/ip_set.h: Likewise.
	* bundled/linux/include/uapi/linux/netlink.h: Likewise.
	* bundled/linux/include/uapi/linux/perf_event.h: Likewise.
	* bundled/linux/include/uapi/linux/pkt_sched.h: Likewise.
	* bundled/linux/include/uapi/linux/stat.h: Likewise.
	* bundled/linux/include/uapi/linux/tls.h: Likewise.
	* bundled/linux/include/uapi/linux/userfaultfd.h: Likewise.
	* bundled/linux/include/uapi/linux/v4l2-controls.h: Likewise.
	* bundled/linux/include/uapi/linux/version.h: Likewise.
	* bundled/linux/include/uapi/linux/videodev2.h: Likewise.
	* bundled/linux/include/uapi/mtd/mtd-abi.h: Likewise.
	* bundled/linux/include/uapi/mtd/ubi-user.h: Likewise.

2022-12-10  Dmitry V. Levin  <ldv@strace.io>

	Reduce sysctl decoder to the bare minimum.
	Given that sysctl syscall was removed by Linux kernel commit
	v5.5-rc1~102^2, do not spend limited resources on the incomplete decoder
	of sysctl syscall and reduce it to the bare minimum.  At the same time,
	add mpers support and a test for the new decoder to make sure it works
	properly.

	* src/sysctl.c: Rewrite.
	* src/xlat/sysctl_*.in: Remove.
	* tests/sysctl.c: New file.
	* tests/gen_tests.in (sysctl): New test.
	* tests/pure_executables.list: Add sysctl.
	* tests/.gitignore: Likewise.

2022-12-09  Dmitry V. Levin  <ldv@strace.io>

	ia64: use sysctl decoder.
	Apparently, sysctl syscall has never been decoded on ia64.  Although the
	syscall is now removed from the Linux kernel, it's never late to fix the
	decoder on ia64.

	* src/linux/ia64/syscallent.h (sysctl): Use the sysctl decoder
	instead of printargs.

2022-12-02  Dmitry V. Levin  <ldv@strace.io>

	.github: switch from actions/checkout@v2 to actions/checkout@v3.
	This fixes the following diagnostic warning:

	  Node.js 12 actions are deprecated. For more information see:
	  https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

	* .github/workflows/ci.yml: Replace actions/checkout@v2 with
	actions/checkout@v3.

2022-11-28  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v6.1.
	* src/linux/32/ioctls_inc_align16.h: Update from linux v6.1-rc7 using
	ioctls_gen.sh.
	* src/linux/32/ioctls_inc_align32.h: Likewise.
	* src/linux/32/ioctls_inc_align64.h: Likewise.
	* src/linux/64/ioctls_inc.h: Likewise.
	* src/linux/x32/ioctls_inc0.h: Likewise.
	* src/linux/s390/ioctls_arch0.h: Likewise.
	* src/linux/s390x/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

2022-11-28  Dmitry V. Levin  <ldv@strace.io>

	print_icmp_filter: fix icmp_filter decoding on 64-bit bigendian architectures
	* src/net.c (print_icmp_filter): Fix next_set_bit usage.

	Fixes: v6.0-27-g238f5799f "print_icmp_filter: print icmp_filter as a bitset"
	Resolves: https://github.com/strace/strace/issues/229

2022-11-27  Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint_attribute_{begin,end} helpers.
	* src/print_fields.h (tprint_attribute_begin, tprint_attribute_end):
	New inline functions.
	* src/print_instruction_pointer.c (print_instruction_pointer): Use them.
	* src/print_syscall_number.c (print_syscall_number): Likewise.
	* src/secontext.c (selinux_printfdcon, selinux_printfilecon,
	  selinux_printpidcon): Likewise.
	* src/strace.c (printleader): Likewise.
	* src/syscall.c (stub_sysent): Update sys_name.
	* tests/kill_child.c: Update comment.
	* tests/kill_child.test: Update expected output.

	src: introduce tprint_associated_info_{begin,end} helpers.
	* src/print_fields.h (tprint_associated_info_begin,
	tprint_associated_info_end): New inline functions.
	* src/open.c (print_dirfd): Use them.
	* src/strace.c (print_comm_str): Likewise.
	* src/syscall.c (syscall_exiting_trace): Likewise.
	* src/util.c (print_string_in_angle_brackets, printdev, printpidfd,
	print_quoted_string_in_angle_brackets): Likewise.

2022-11-27  Dmitry V. Levin  <ldv@strace.io>

	dm: decode dm_ioctl as a pseudoarray.
	Somewhat similar to netlink messages, dm_ioctl data is a struct dm_ioctl
	header followed by payload.

	* src/dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
	dm_decode_dm_name_list, dm_decode_dm_target_versions,
	dm_decode_dm_target_msg, dm_decode_string): Use tprint_array_next
	to print separator between payload records.
	(dm_decode_header, dm_decode_payload): New functions.
	(dm_known_ioctl): Use them.
	* tests/ioctl_dm.c (main): Update expected output.

2022-11-27  Dmitry V. Levin  <ldv@strace.io>

	src: introduce tprint_newline() helper.
	* src/print_fields.h (tprint_newline): New inline function.
	* src/strace.c (ptrace_restart, printleader, maybe_switch_tcbs,
	print_signalled, print_exited, print_stopped, print_event_exit): Use it.
	* src/syscall.c (syscall_exiting_trace): Likewise.

	src: introduce tprint_null() helper.
	* src/print_fields.h (tprint_null): New inline function.
	* src/util.c (printaddr64, printpathn, printstr_ex, print_array_ex):
	Use it.

2022-11-26  Dmitry V. Levin  <ldv@strace.io>

	print_icmp_filter: print icmp_filter as a bitset.
	* src/xlat/icmp_filter_flags.in: New file.
	* src/xlat/icmpfilterflags.in: Remove.
	* src/net.c: Include "xlat/icmp_filter_flags.h" instead of
	"xlat/icmpfilterflags.h".
	(print_icmp_filter): Print struct icmp_filter.data as a bitset.
	* tests/net-icmp_filter.c (main): Update expected output.

	print_affinitylist: use tprint_bitset_* helpers to print bitsets.
	* src/affinity.c (print_affinitylist): Replace tprint_array_* helpers
	with the corresponding tprint_bitset_* helpers.
	* tests/io_uring_register.c (main): Update expected output.
	* tests/sched_xetaffinity.c (main): Likewise.

2022-11-25  Dmitry V. Levin  <ldv@strace.io>

	mips: fix decoding of ioctl 't' commands.
	Similar to alpha, powerpc, and sparc architectures, some of tty ioctl
	commands on mips also have type 't'.

	* src/ioctl.c (ioctl_decode) [MIPS]: Handle type 't'.

2022-11-25  Dmitry V. Levin  <ldv@strace.io>

	xlat/modem_flags: fix fallback definitions for mips.
	* src/xlat/modem_flags.in [__mips__] (TIOCM_ST, TIOCM_SR, TIOCM_CTS,
	TIOCM_CAR, TIOCM_RNG, TIOCM_DSR): Provide correct fallback
	definitions.
	* tests/ioctl_tiocm.c [__mips__] (VALID_FLAGS, INVALID_FLAGS):
	Provide correct definitions.

	Fixes: v6.0-10-gebc5d9e24 "xlat: update TIOCM_* constants"

2022-11-25  Dmitry V. Levin  <ldv@strace.io>

	s390: use more print_fields.h helpers.
	* src/s390.c (decode_ebcdic, print_sthyi_machine, print_sthyi_guest,
	guard_storage_print_gscb): Use tprint_struct_next.
	(guard_storage_print_gsepl): Use tprint_struct_next,
	tprint_indirect_begin, and tprint_indirect_end.
	(SYS_FUNC(s390_guarded_storage), SYS_FUNC(s390_runtime_instr)):
	Use tprint_arg_next.
	(SYS_FUNC(s390_sthyi)): Use tprint_arg_next and PRINT_VAL_X.
	(SYS_FUNC(s390_pci_mmio_write), SYS_FUNC(s390_pci_mmio_read)):
	Use tprint_arg_next, PRINT_VAL_X, and PRINT_VAL_U.

2022-11-24  Dmitry V. Levin  <ldv@strace.io>

	strace.spec.in: skip tests for all 32-bit architectures on fedora and rhel
	gcc on the latest versions of fedora and rhel fails to compile
	strace tests not just for x86 architecture but for armv7 as well.

	* strace.spec.in (%check) [fedora >= 35 || rhel > 9]: Skip on all
	32-bit architectures.

2022-11-24  Yaakov Selkowitz  <yselkowitz@fedoraproject.org>

	strace.spec.in: skip tests for x86 architecture on ELN.
	* strace.spec.in (%check): Skip on %ix86 and rhel > 9.

2022-11-24  Dmitry V. Levin  <ldv@strace.io>

	swapon: use more print_fields.h helpers.
	* src/swapon.c (SYS_FUNC(swapon)): Use PRINT_VAL_U.

