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

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

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

2022-03-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Decode set_mempolicy_home_node syscall.
	Introduced by Linux commits v5.17-rc1~79^2~49 and v5.17-rc1~79^2~48.

	* src/linux/generic/syscallent-common.h ([BASE_NR + 450]): Add
	set_mempolicy_home_node syscall entry.
	* src/numa.c (SYS_FUNC(set_mempolicy_home_node)): New syscall decoder.
	* tests/.gitignore: Add set_mempolicy_home_node.
	* tests/pure_executables.list: Likewise.
	* tests/set_mempolicy_home_node.c: New file.
	* tests/gen_tests.in (set_mempolicy_home_node): New test.
	* NEWS: Mention it.

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

	printpidfd: print pidfd path if pidfd_get_pid fails.
	* src/util.c (printpidfd): If the path associated with the given
	descriptor is "anon_inode:[pidfd]", print the path if pidfd_get_pid
	fails.

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

	printsocket: print socket path if get_sockaddr_by_inode fails.
	* src/util.c (printsocket): If the path associated with the given
	descriptor has a form of "socket:[inode]", print the path if
	get_sockaddr_by_inode fails.

	util: introduce get_inode_of_socket_path.
	* src/util.c (get_inode_of_socket_path): New function.
	(getfdinode, printsocket): Use it.

	util: introduce print_string_in_angle_brackets.
	* src/util.c (print_string_in_angle_brackets): New function.
	(printsocket): Use it.

2022-03-10  Masatake YAMATO  <yamato@redhat.com>

	tests: fix a typo in tests.h.
	* tests/tests.h (error_msg_and_fail): Fix the condition wrapping
	the definition.

	Fixes: v4.21~95 "tests: add file:line to perror_msg_and_fail/error_msg_and_fail output"

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

	xlat: update KEY_* constants.
	* bundled/linux/include/uapi/linux/input-event-codes.h: Update
	to headers_install'ed Linux kernel v5.17-rc7.
	* src/xlat/evdev_keycode.in (KEY_DASHBOARD): Rename to
	KEY_ALL_APPLICATIONS introduced by Linux kernel commit v5.17-rc7~5^2.
	(KEY_DICTATE): New constant introduced by Linux kernel commit
	v5.17-rc7~5^2~1.
	* NEWS: Mention this change.

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

	xlat: update KVM_* constants.
	* src/xlat/kvm_cap.in (KVM_CAP_PPC_AIL_MODE_3): New constant introduced
	by Linux kernel commit v5.17-rc6~27^2~2^2.

2022-02-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v5.17.
	* src/linux/32/ioctls_inc_align16.h: Update from linux v5.17-rc5
	  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/i386/ioctls_arch0.h: Likewise.
	* src/linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux v5.17-rc5.
	* maint/ioctls_sym.sh (x86_list): Add KVM_GET_XSAVE2 ioctl.

2022-02-12  Sean Young  <sean@mess.org>

	Add lirc ioctl decoding.
	* NEWS: Mention this change.
	* bundled/linux/include/uapi/linux/lirc.h: New file.
	* bundled/Makefile.am (EXTRA_DIST): Add it.
	* src/lirc_ioctl.c: New file.
	* src/Makefile.am (libstrace_a_SOURCES): Add it.
	* src/defs.h (DECL_IOCTL(lirc)): New declaration.
	* src/ioctl.c (ioctl_decode) <case 'i'>: Call kd_ioctl.
	* src/xlat/lirc_features.in: New file.
	* src/xlat/lirc_modes.in: Likewise.
	* tests/ioctl_lirc.c: New file.
	* tests/ioctl_lirc-success.c: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add ioctl_lirc-success.
	* tests/gen_tests.in (ioctl_lirc, ioctl_lirc-success): New tests.
	* tests/pure_executables.list: Add ioctl_lirc.
	* tests/.gitignore: Add ioctl_lirc and ioctl_lirc-success.

	Reviewed-by: Eugene Syromyatnikov <evgsyr@gmail.com>
	Reviewed-by: Dmitry V. Levin <ldv@strace.io>

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

	tests: use ATTRIBUTE_FORMAT for static functions, too.
	* tests/keyctl.c (append_str): Add ATTRIBUTE_FORMAT.
	(kckdfp_to_str): Fix -Wformat warning.

	error_prints: use ATTRIBUTE_FORMAT for static functions, too.
	* src/error_prints.c (verror_msg): Add ATTRIBUTE_FORMAT.

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

	bundled: update linux/version.h.
	* bundled/linux/include/uapi/linux/version.h: Update to
	headers_install'ed Linux kernel v5.17-rc2.

	Fixes: v5.16-39-g19b787bbf "bundled: update linux UAPI headers to v5.17-rc2"

2022-02-07  Jonathan Borne  <jborne@kalray.eu>

	tests: add missing <stdint.h> in fanotify_mark.c.
	With musl libc, fanotify_mark.c compilation fails with 'uintptr_t'
	undeclared.

	Following POSIX specification uintptr_t should be defined in <stdint.h>.
	However, fanotify_mark.c does not include <stdint.h> directly.  Instead,
	it includes <sys/fanotify.h>.  With glibc or uclibc-ng, fanotify_mark.c
	compiles because the provided <sys/fanotify.h> includes <stdint.h>.
	This is not the case with musl libc.

	* tests/fanotify_mark.c: Include <stdint.h>.

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

	tests: check decoding of SEGV_ACCERR.
	* tests/segv_accerr.c: New file.
	* tests/gen_tests.in (segv_accerr): New test.
	* tests/Makefile.am (check_PROGRAMS): Add segv_accerr.
	* tests/.gitignore: Likewise.

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

	tests: check decoding of SEGV_PKUERR.
	* tests/segv_pkuerr.c: New file.
	* tests/gen_tests.in (segv_pkuerr): New test.
	* tests/Makefile.am (check_PROGRAMS): Add segv_pkuerr.
	* tests/.gitignore: Likewise.
	* tests/ptrace.c (main) [HAVE_SIGINFO_T_SI_PKEY]: Check decoding
	of SEGV_PKUERR.

2022-02-02  Slava Bacherikov  <slava@bacher09.org>

	printsiginfo: decode siginfo_t.si_pkey field.
	This adds decoding of si_pkey field which is set on SIGSEGV in case
	of memory access violation on some modern CPUs (these have pku flag
	in /proc/cpuinfo).

	* NEWS: Mention this change.
	* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_pkey.
	* src/printsiginfo.c (print_si_info) <case SIGSEGV>
	[HAVE_SIGINFO_T_SI_PKEY]: Decode si_pkey field.

2022-02-01  Sven Schnelle  <svens@linux.ibm.com>

	tests/membarrier: add additional return value.
	linux commit 809232619f5b ("sched/membarrier: Fix membarrier-rseq fence
	command missing from query bitmask") changed the returned value, so we
	need to adjust the strace test as well.

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

	prctl: implement PR_SET_VMA decoding for non-Android platforms.
	PR_SET_VMA used to be specific to Android until Linux kernel commit
	v5.17-rc1~79^2~89.

	* NEWS: Mention this change.
	* src/xlat/prctl_options.in (PR_SET_VMA): Remove __ANDROID__ guard.
	* src/xlat/pr_set_vma.in: New file.
	* src/prctl.c [__ANDROID__ && !PR_SET_VMA]: Remove.
	[__ANDROID__ && !PR_SET_VMA_ANON_NAME]: Likewise.
	(SYS_FUNC(prctl)) <PR_SET_VMA>: Remove __ANDROID__ guard, enhance
	decoding.
	* tests/prctl-set_vma.c: New file.
	* tests/gen_tests.in (prctl-set_vma): New test.
	* tests/pure_executables.list: Add prctl-set_vma.
	* tests/.gitignore: Likewise.

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

	xlat: update IORING_* and IOSQE_* constants.
	* NEWS: Mention this change.
	* src/xlat/uring_setup_features.in (IORING_FEAT_CQE_SKIP): New constant
	introduced by Linux kernel commit v5.17-rc1~118^2~25.
	* src/xlat/uring_sqe_flags.in (IOSQE_CQE_SKIP_SUCCESS): Likewise.
	* tests/io_uring_register.c (main): Update expected output.

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

	rtnl_link: decode IFLA_GRO_MAX_SIZE attribute.
	This netlink attribute was introduced by Linux kernel commit
	v5.17-rc1~170^2~46.

	* NEWS: Mention this change.
	* src/rtnl_link.c (ifinfomsg_nla_decoders) Add IFLA_GRO_MAX_SIZE.
	* src/xlat/rtnl_link_attrs.in (IFLA_GRO_MAX_SIZE): New constant.

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

	bundled: update linux UAPI headers to v5.17-rc2.
	* bundled/linux/include/uapi/linux/btrfs_tree.h: Update to
	headers_install'ed Linux kernel v5.17-rc2.
	* bundled/linux/include/uapi/linux/if_link.h: Likewise.
	* bundled/linux/include/uapi/linux/io_uring.h: Likewise.
	* bundled/linux/include/uapi/linux/perf_event.h: Likewise.
	* bundled/linux/include/uapi/linux/prctl.h: Likewise.
	* bundled/linux/include/uapi/linux/rtnetlink.h: Likewise.
	* bundled/linux/include/uapi/linux/v4l2-controls.h: Likewise.
	* bundled/linux/include/uapi/linux/videodev2.h: Likewise.

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

	xlat: update KVM_* constants.
	* src/xlat/kvm_cap.in (KVM_CAP_SYS_ATTRIBUTES): New constant introduced
	by Linux kernel commit v5.17-rc2~24^2~8.

2022-01-25  WANG Xuerui  <git@xen0n.name>

	loongarch64: make use of the newly exposed orig_a0 field for ptrace.
	* src/linux/loongarch64/get_syscall_args.c: Use orig_a0 for first
	syscall argument.
	* src/linux/loongarch64/arch_prstatus_regset.c: Print the new field.
	* tests/ptrace.c (print_prstatus_regset) [__loongarch__]: Update
	expected output.

2022-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	s390: fix infmname printing check.
	As it is a EBCDIC string, it is supposed to be checked
	with IS_ARRAY_ZERO, similarly to other EBCDIC strings.
	Also, it induces a warning with GCC 12:

	    s390.c: In function 'print_sthyi_machine':
	    s390.c:565:30: error: the comparison will always evaluate as 'true' for the
	    address of 'infmname' will never be NULL [-Werror=address]
	      565 |                 if (name_val || hdr->infmname) {
	          |                              ^~
	    s390.c:119:18: note: 'infmname' declared here
	      119 |         char     infmname[8];  /**< EBCDIC Machine Name */
	          |                  ^~~~~~~~

	* src/s390.c (print_sthyi_machine): Use IS_ARRAY_ZERO for hdr->infmname
	non-emptiness check.

	Fixes: v4.21~73 "Introduce s390_sthyi system call decoder"
	Reported-by: Dmitry V. Levin <ldv@strace.io>

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

	Remove remaining bits of Travis CI support.
	Given that in foreseeable future Travis CI is not going to welcome free
	software projects back, there is no use to keep the remaining bits of
	Travis CI support.

	* .gitignore: Remove "/travis_wait_*.log".
	* .travis.yml: Remove.

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

	rtnl_tc_action: implement TCA_ACT_IN_HW_COUNT decoding.
	* src/rtnl_tc_action.c (tcamsg_nla_decoders): Add TCA_ACT_IN_HW_COUNT.
	* tests/nlattr_tcamsg.c [!HAVE_DECL_TCA_ACT_IN_HW_COUNT]
	(TCA_ACT_IN_HW_COUNT): New constant.
	(main): Check TCA_ACT_IN_HW_COUNT decoding.
	* NEWS: Mention this change.

	xlat: update TCA_ACT_* constants.
	* src/xlat/rtnl_tc_action_attrs.in (TCA_ACT_IN_HW_COUNT): New constant
	introduced by Linux kernel commit v5.7-rc1~146^2~25^2.
	* src/xlat/rtnl_tca_act_flags.in (TCA_ACT_FLAGS_SKIP_HW,
	TCA_ACT_FLAGS_SKIP_SW): New constants introduced by Linux kernel commit
	v5.17-rc1~170^2~158^2~6.
	* tests/nlattr_tcamsg.c (main): Update expected output.
	* NEWS: Mention this change.

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

	xlat: update MODULE_INIT_* constants.
	* src/xlat/module_init_flags.in (MODULE_INIT_COMPRESSED_FILE): New constant
	introduced by Linux kernel commit v5.17-rc1~65^2~4.
	* tests/finit_module.c (main): Update expected output.
	* NEWS: Mention this change.

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

	xlat: update *_MAGIC constants.
	* src/xlat/fsmagic.in (EXFAT_SUPER_MAGIC): New constant introduced
	by Linux kernel commit v5.17-rc1~74^2~2.
	(SMB2_MAGIC_NUMBER): Rename to SMB2_SUPER_MAGIC introduced by Linux
	kernel commit v5.17-rc1~57^2~1.
	(CIFS_MAGIC_NUMBER): Rename to CIFS_SUPER_MAGIC introduced by the same
	commit.
	* NEWS: Mention this change.

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

	xlat: update KVM_* constants.
	* src/xlat/kvm_cap.in (KVM_CAP_VM_GPA_BITS): New constant introduced
	by Linux kernel commit v5.17-rc1~15^2~95^2~4.
	(KVM_CAP_XSAVE2): New constant introduced by Linux kernel commit
	v5.17-rc1~15^2~53.
	* NEWS: Mention this change.

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

	xlat: update FAN_* constants.
	* src/xlat/fan_event_flags.in (FAN_RENAME): New constant introduced
	by Linux kernel commit v5.17-rc1~105^2~3.
	* src/xlat/fan_init_flags.in (FAN_REPORT_TARGET_FID): New constant
	introduced by Linux kernel commit v5.17-rc1~105^2~8.
	* tests/fanotify_init.c (main): Update expected output.
	* tests/fanotify_mark.c: Likewise.
	* NEWS: Mention this change.

	tests: fix typo in comment.
	* tests/test_printpath.c (test_printpath_at): Fix typo in comment.

2022-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	secontext: refacor SELinux context printing.
	This is mostly done to enable proper quoting of the printed context,
	as these are raw xattrs that may contain anything:

	    $ sudo setfattr -n security.selinux -v "$(echo -e '\1\2\3\4\5\6\7\8\9\10\13\26\27')" ttt
	    $ strace -efadvise64 --secontext cat ttt
	    $ [unconfined] fadvise64(3 [\8\9
	    ], 0, 0, POSIX_FADV_SEQUENTIAL) = 0
	    ^[[?1;2c+++ exited with 0 +++

	* src/secontext.c (getcontext): Rename to...
	(parse_secontext): ...this, return pointer in the original context
	string and its size instead of a string copy, do not call freecon()
	on the original secontext.
	(get_expected_filecontext, selinux_getpidcon): Do not call getcontext
	on the result.
	(selinux_getfdcon, selinux_getfilecon): Do not call getcontext on the
	result, return expected context as-is.
	(print_context, selinux_printfdcon, selinux_printfilecon,
	selinux_printpidcon): New functions.
	* src/secontext.h (selinux_getfdcon, selinux_getfilecon,
	selinux_getpidcon, selinux_set_format): Remove declarations.
	(selinux_printfdcon, selinux_printfilecon, selinux_printpidcon): New
	declarations.
	* src/strace.c (printleader): Call selinux_printpidcon
	instead of selinux_getpidcon.
	* src/util.c (printfd_pid): Call selinux_printfdcon
	instead of selinux_getfdcon.
	(printpathn): Call selinux_printfilecon instead of selinux_getfilecon.

2022-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: add ability to override xflag setting via string_quote style.
	* src/defs.h (QUOTE_OVERWRITE_HEXSTR, QUOTE_HEXSTR_SHIFT,
	QUOTE_HEXSTR_MASK, QUOTE_HEXSTR_NONE, QUOTE_HEXSTR_ALL,
	QUOTE_HEXSTR_NON_ASCII, QUOTE_HEXSTR_NON_ASCII_CHARS): New macro
	constants.
	(QUOTE_FORCE_HEX): Re-define to (QUOTE_OVERWRITE_HEXSTR |
	QUOTE_HEXSTR_ALL).
	* src/util.c (string_quote) <xstyle>: New local variable.
	(string_quote): Use xstyle instead of xflag/style checks for hexadecimal
	character printing checks.

	tests/linkat: reset context to the expected one if a mismatch has been detected
	* tests/secontext.h (reset_secontext_file): New declaration.
	* tests/secontext.c (reset_secontext_file): New function.
	* tests/linkat.c (main): Check that there is no initial mismatch
	in the sample_1 context, reset it otherwise.

	tests/secontext: eliminate separate secontext_format declaration.
	* tests/secontext.c (secontext_format): Remove declaration, supply
	the attributes to the definition.

	tests/linkat: provide fallback values for secontext fields changes.
	* tests/linkat.c (mangle_secontext_field): New function.
	(main): Replace calls to update_secontext_field
	with mangle_secontext_field calls.

	tests/secontext: add secontext field getters.
	* tests/secontext.h (get_secontext_field, get_secontext_field_file): New
	declarations.
	* tests/secontext.c (get_type_from_context): Rename to...
	(get_secontext_field): ...this;  remove "static" qualifier;  add "field"
	argument, use it.
	(raw_expected_secontext_short_file, raw_secontext_short_pid): Replace
	get_type_from_context call with get_secontext_field.
	(get_secontext_field_file): New function.
	(raw_secontext_short_file): Replace body with get_secontext_field_file
	call.

2022-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/linkat: reset errno before SELinux context manipulation.
	To avoid printing a stale error information in case of mismatch check
	failure.

	* tests/linkat.c: Include <errno.h>.
	(main): Add "errno = 0" before update_secontext_field calls.

2022-01-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	doc/strace.1: wfix.
	* doc/strace.1.in (.SH DESCRIPTION): Replace "simple pointers"
	with "pointers to basic types";  add definite article before "elements"
	in "pointers to basic types and arrays are printed using square brackets
	with commas separating elements."

2022-01-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	doc/strace.1: align -e inject/--inject syntax description to the left.
	That eliminates warnings about inability to fill the line (that has become
	rather long over the time):

	    <standard input>:1287: warning [p 9, 5.8i, div `an-div', 0.0i]: cannot adjust line
	    <standard input>:1287: warning [p 9, 5.8i, div `an-div', 0.2i]: can't break line

	(as there are indeed no spaces in the syntax line to accomodate such filling).
	Also, provide additional breakpoints to make it look a bit better.

	* doc/strace.1.in (.SS Tampering): Add ".ad b" before "-e inject" option
	syntax line and ".ad b" after "--inject" option syntax line;  add "\:"
	between option parameters for additional breaking points.

	Reported-by: Dmitry V. Levin <ldv@strace.io>

2022-01-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	doc/strace.1: update strace example output.
	 - struct timespec has field names in the ouput since
	   v4.14-135-gacdb08613;
	 - the signal mask rt_sigreturn argument is decoded since v4.17~171;
	 - articulate siginfo in the SIGLARM signal trace message.

	* doc/strace.1.in (.SH DESCRIPTION): Add "tv_sec" and "tv_nsec" field
	names to clock_gettime example output;  replace "0xe" with "{mask=[]}"
	in rt_sigreturn example output;  replace ellipsis with "{si_signo=SIGALRM,
	si_code=SI_KERNEL}" in SIGALRM example output.

2022-01-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	doc/strace.1: add references to syscall(2) and signal(7) to SEE ALSO.
	These contain some pertinent information about architecture-specific
	syscall caveats and signal handling.

	* doc/strace.1.in (.SH "SEE ALSO"): Add references to syscall(2)
	and signal(7).

2022-01-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	doc/strace.1: refer to syscalls(2) for syscall names reference.
	* doc/strace.1.in (.SS Filtering) <.I syscall>: Add a reference
	to syscalls(2) in the description.

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

	Enhance rejection of invalid syscall numbers in syscall specification expressions
	We used to allow any number that does not exceed the maximum syscall
	number for the given personality, including those that do not correspond
	to real syscalls.

	* NEWS: Mention this.
	* src/arch_defs.h [!ARCH_NEEDS_NON_SHUFFLED_SCNO_CHECK]
	(ARCH_NEEDS_NON_SHUFFLED_SCNO_CHECK): Define to 0.
	* src/linux/x32/arch_defs_.h (ARCH_NEEDS_NON_SHUFFLED_SCNO_CHECK):
	Define to 1.
	* src/linux/x86_64/arch_defs_.h: Likewise.
	* src/basic_filters.c (qualify_syscall_number): Use shuffle_scno to
	obtain the internal syscall number, use scno_pers_is_valid to reject
	invalid syscall numbers.
	* tests/filtering_syscall-syntax.test: Check this.

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

	Introduce scno_pers_in_range and scno_pers_is_valid.
	* src/defs.h (scno_pers_in_range, scno_pers_is_valid): New functions.
	* src/syscall_name.c (syscall_name_arch): Use scno_pers_is_valid.

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

	Extend personality designation syntax to support all@pers.
	* NEWS: Mention this.
	* src/basic_filters.c (lookup_class): Change to support zero flags,
	handle "all" as a class with zero flags.
	(qualify_syscall_class): Update to new lookup_class semantics.
	* src/strace.c (usage): Update --trace description.
	* doc/strace.1.in (.SS Filtering): Likewise.
	* tests/filtering_syscall-syntax.test: Update expected output.
	* tests/qualify_personality_all.sh: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/gen_tests.in (trace_personality_all_32,
	trace_personality_all_64, trace_personality_all_x32): New tests.

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

	tests: extend personality designation syntax checks.
	* tests/filtering_syscall-syntax.test: Repeat some checks also with
	a correct personality designator.

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

	tests: move current personality designator detection code to init.sh.
	This functionality is going to be used in different tests.

	* tests/init.sh (print_current_personality_designator): New function.
	* tests/qualify_personality.sh: Use it.

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

	Extend personality designation syntax to support %class@pers.
	* NEWS: Mention this.
	* src/basic_filters.c (qualify_syscall_number,
	qualify_syscall_number_personality): Squash into a new function
	qualify_syscall_number taking personality as an argument instead of
	iterating over all personalities, remove personality designation syntax
	support.
	(qualify_syscall_regex): Change to take personality as an argument
	instead of iterating over all personalities, remove personality
	designation syntax support.
	(qualify_syscall_class): Change to take personality as an argument
	instead of iterating over all personalities.
	(qualify_syscall_name): Remove.
	(qualify_syscall_name_personality): Rename to qualify_syscall_name.
	(qualify_syscall_pers): New function.
	(qualify_syscall): Use it to iterate over all supported personalities,
	add personality designation syntax support.
	* src/strace.c (usage): Update --trace description.
	* doc/strace.1.in (.SS Filtering): Likewise.
	* tests/options-syntax.test: Update expected output.
	* tests/trace_personality_statfs_32.in: New file.
	* tests/trace_personality_statfs_64.in: Likewise.
	* tests/trace_personality_statfs_x32.in: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Add them.
	* tests/gen_tests.in (trace_personality_statfs_32,
	trace_personality_statfs_64, trace_personality_statfs_x32): New tests.

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

	Use the last @ as a starting point of the personality designator.
	There is no difference from a practical point of view as long as
	we don't have syscall names containing @ symbol.

	* src/basic_filters.c (qualify_syscall_separate_personality): Use
	the last @ of the syscall trace expression as a starting point of
	the personality designator.

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

	tests: add more checks of --trace=number@pers support.
	* tests/print_scno_getcwd.sh: New file.
	* tests/trace_personality_number_32.in: Likewise.
	* tests/trace_personality_number_64.in: Likewise.
	* tests/trace_personality_number_x32.in: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Add them.
	* tests/gen_tests.in (trace_personality_number_32,
	trace_personality_number_64, trace_personality_number_x32): New tests.

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

	Make sprint_hwaddr and sprint_mac_addr functions static.
	Apparently, these functions are not used beyond the file where they are
	defined.

	* src/defs.h (sprint_hwaddr, sprint_mac_addr): Remove.
	* src/print_mac.c (sprint_hwaddr, sprint_mac_addr): Add static
	qualifier.

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

	Remove unused function ts_mul.
	The last user of this function was removed by commit v5.3~71.

	* src/defs.h (ts_mul): Remove.
	* src/util.c: Likewise.

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

	loongarch64: implement NT_PRSTATUS and NT_FPREGSET regsets decoding.
	* src/linux/loongarch64/arch_fpregset.c: New file.
	* src/linux/loongarch64/arch_fpregset.h: Likewise.
	* src/linux/loongarch64/arch_prstatus_regset.c: Likewise.
	* src/linux/loongarch64/arch_prstatus_regset.h: Likewise.
	* src/Makefile.am (EXTRA_DIST): Add them.
	* tests/ptrace.c [__loongarch__] (TRACEE_REGS_STRUCT): Define.
	(print_prstatus_regset, print_fpregset) [__loongarch__]: Update
	expected output.

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

	xlat: add AUDIT_ARCH_LOONGARCH* constants.
	* src/xlat/audit_arch.in (AUDIT_ARCH_LOONGARCH32,
	AUDIT_ARCH_LOONGARCH64): New constants.

	Link: https://lore.kernel.org/lkml/20211013063656.3084555-4-chenhuacai@loongson.cn/

2022-01-13  WANG Xuerui  <git@xen0n.name>

	Add 64-bit LoongArch support.
	This is based on the WIP Linux port still under review, but the port is
	re-using asm-generic syscall numbers and parameters, so breakage should
	be minimal when the port is eventually merged, if at all.

	Currently only the LP64* ABIs are implemented in the toolchains, so only
	support the host type "loongarch64".

	* NEWS: Mention this.
	* configure.ac [$host_cpu == loongarch64]: Define LOONGARCH64.
	* src/linux/loongarch64/arch_defs_.h: New file.
	* src/linux/loongarch64/arch_regs.c: Likewise.
	* src/linux/loongarch64/get_error.c: Likewise.
	* src/linux/loongarch64/get_scno.c: Likewise.
	* src/linux/loongarch64/get_syscall_args.c: Likewise.
	* src/linux/loongarch64/ioctls_arch0.h: Likewise.
	* src/linux/loongarch64/ioctls_inc0.h: Likewise.
	* src/linux/loongarch64/raw_syscall.h: Likewise.
	* src/linux/loongarch64/set_error.c: Likewise.
	* src/linux/loongarch64/set_scno.c: Likewise.
	* src/linux/loongarch64/syscallent.h: Likewise.
	* src/Makefile.am (EXTRA_DIST): Add them.
	* src/xlat/elf_em.in: Add EM_LOONGARCH.

	Link: https://lore.kernel.org/lkml/20211013063656.3084555-1-chenhuacai@loongson.cn/

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

	Remove unused function syscall_name.
	The last user of this function was removed by commit v5.15~209.

	* src/defs.h (syscall_name): Remove.
	* src/syscall_name.c: Likewise.

2022-01-11  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 5.16-1.
	* strace.spec.in: Likewise.

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

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

	.mailmap: add more entries to avoid duplication in CREDITS.
	* .mailmap: Add another email address of Paul Chaignon to avoid
	duplication in CREDITS file.

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

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

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

	Fix preprocessor indentation.
	Indent the C preprocessor directives to reflect their nesting
	using the following script:

	$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' src tests |grep -v '\.sh$') |while read f; do
		cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
	done

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: remove PACKET_ADD_MEMBERSHIP #ifdef guards.
	Both PACKET_ADD_MEMBERSHIP and struct packet_mreq are provided by
	<linux/if_packet.h> at least since Linux 2.6.12.

	* src/xlat/packet_mreq_type.in: Add #value_indexed, provide fallback
	definitions.
	* src/net.c: Remove PACKET_ADD_MEMBERSHIP #ifdef guards.

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: remove PACKET_RX_RING and PACKET_TX_RING #ifdef guards.
	All of them as well as struct tpacket_req are provided by
	<linux/if_packet.h> at least since Linux 2.6.12.

	* src/net.c: Remove PACKET_RX_RING and PACKET_TX_RING #ifdef guards.

	Complements: v5.15~139 "xlat: add fallback values to sock_packet_options"

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: remove IPV6_ADD_MEMBERSHIP and IPV6_{JOIN,LEAVE}_ANYCAST guards.
	All of them are present since at least Linux 2.6.12 and glibc-2.3.3~616.

	* src/net.c [!IPV6_ADD_MEMBERSHIP] (print_mreq6): Enable function
	declaration.
	[!IPV6_ADD_MEMBERSHIP || !IPV6_JOIN_ANYCAST || !IPV6_LEAVE_ANYCAST] (print_setsockopt):
	Enable case IPV6_ADD_MEMBERSHIP, case IPV6_DROP_MEMBERSHIP,
	case IPV6_JOIN_ANYCAST, and case IPV6_LEAVE_ANYCAST.

	Complements: v5.15~140 "xlat: add fallback values to sock_ipv6_options"

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Remove MCAST_JOIN_GROUP #ifdef guards.
	These are long defined (before Linux 2.6.12 and since glibc-2.3.4~748),
	so there seems to be no need to conditionalise on them.

	* src/net.c [!MCAST_JOIN_GROUP]: Enable case MCAST_JOIN_GROUP
	and case MCAST_LEAVE_GROUP.
	* src/print_group_req.c [!MCAST_JOIN_GROUP]: Enable
	DEF_MPERS_TYPE(struct_group_req) include, struct_group_req typedef,
	and print_group_req function.

	Complements: v5.15~141 "xlat: add fallback values to sock_ip_options"
	Complements: v5.15~140 "xlat: add fallback values to sock_ipv6_options"

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: remove IP_ADD_MEMBERSHIP #ifdef guards.
	IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP are always defined since commit
	v5.15~141 "xlat: add fallback values to sock_ip_options", and the struct
	ip_mreq definition is present in UAPI since at least v2.6.12, so simply
	remove the #ifdef guards.

	* src/net.c [!IP_ADD_MEMBERSHIP] (print_mreq): Provide definition.
	[!IP_ADD_MEMBERSHIP] (print_setsockopt): Enable case IP_ADD_MEMBERSHIP
	and case IP_DROP_MEMBERSHIP.

	Complements: v5.15~141 "xlat: add fallback values to sock_ip_options"

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: remove PACKET_STATISTICS #ifdef guards.
	The constant is always defined since v5.15~139 "xlat: add fallback values
	to sock_packet_options", and the decoder function does not require
	any extra definitions, so the #fidef guards are now superficial.

	* src/net.c [!PACKET_STATISTICS] (print_tpacket_stats): Make available.
	[!PACKET_STATISTICS] (print_getsockopt) <case SOL_PACKET: case
	PACKET_STATISTICS>: Call print_tpacket_stats.

	Complements: v5.15~139 "xlat: add fallback values to sock_packet_options"

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: initialise struct icmp_filter read buffer with ~0.
	Since only the unset bits are printed, this avoids printing
	of bits not returned by the kernel when a short read is performed.

	* src/net.c (print_icmp_filter): Set filter.data to ~0U.

2022-01-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: fix SO_ERROR socket option len clamping.
	Looks like a typo: err is set if len is too big instead of len.
	Fixes possible out-of-bounds read on umoven_or_printaddr when len
	is too big.

	* src/net.c (print_get_error) <if (len > sizeof(err))>: Set len
	to sizeof(err) and not err.

	Fixes: v4.26~45 "net: enhance decoding of getsockopt(SO_ERROR)"

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

	tests: check decoding of futex_waitv syscall.
	* tests/futex_waitv.c: New file.
	* tests/gen_tests.in (futex_waitv): New test.
	* tests/pure_executables.list: Add futex_waitv.
	* tests/.gitignore: Likewise.

	futex_waitv: implement decoding of struct futex_waitv array.
	* bundled/linux/include/uapi/linux/futex.h: New file, imported from
	headers_install'ed Linux kernel v5.16-rc8.
	* bundled/Makefile.am (EXTRA_DIST): Add it.
	* src/xlat/futex_waiter_flags.in: New file.
	* src/futex_waitv.c: Include <linux/futex.h> and
	"xlat/futex_waiter_flags.h".
	(print_waiter_data): New struct.
	(print_waiter, print_waiter_array): New functions.
	(SYS_FUNC(futex_waitv)): Use print_waiter_array to print the first
	argument of futex_waitv syscall.
	* NEWS: Mention this change.

2022-01-09  André Almeida  <andrealmeid@collabora.com>

	Implement decoding of futex_waitv syscall.
	This is an initial implementation of the new futex_waitv syscall
	introduced by Linux kernel commit v5.16-rc1~200^2~12.

	* src/futex_waitv.c: New file.
	* src/Makefile.am (libstrace_a_SOURCES): Add it.
	* src/linux/generic/syscallent-common.h ([BASE_NR + 449]): Add
	futex_waitv syscall entry.

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

	xlat: update NDA_* constants.
	* src/xlat/rtnl_neigh_attrs.in (NDA_FLAGS_EXT): New constant
	introduced by Linux kernel commit v5.16-rc1~159^2~222^2~1.
	* NEWS: Mention this change.

	xlat: update V4L2_* constants.
	* src/xlat/v4l2_control_id_bases.in (V4L2_CID_USER_ALLEGRO_BASE): New
	constant introduced by Linux kernel commit v5.16-rc1~173^2~15.
	* src/xlat/v4l2_control_ids.in (V4L2_CID_NOTIFY_GAINS): New constant
	introduced by Linux kernel commit v5.16-rc1~173^2~231.
	* src/xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_SUNXI_TILED_NV12): Rename
	to V4L2_PIX_FMT_NV12_32L32, renamed by Linux kernel commit
	v5.16-rc1~173^2~279.
	(V4L2_PIX_FMT_HM12): Rename to V4L2_PIX_FMT_NV12_16L16, renamed by Linux
	kernel commit v5.16-rc1~173^2~278.
	(V4L2_PIX_FMT_NV12_4L4): New constant introduced by Linux kernel commit
	v5.16-rc1~173^2~277.
	(V4L2_PIX_FMT_MM21): New constant introduced by Linux kernel commit
	v5.16-rc1~173^2~262.
	* NEWS: Mention this change.

	xlat: update KVM_* constants.
	* src/xlat/kvm_exit_reason.in (KVM_EXIT_RISCV_SBI): New constant
	introduced by Linux kernel commit v5.16-rc1~153^2~50^2~2.
	* NEWS: Mention this change.

	xlat: update DEVCONF_* constants.
	* src/xlat/inet6_devconf_indices.in (DEVCONF_NDISC_EVICT_NOCARRIER):
	New constant introduced by Linux kernel commit v5.16-rc1~159^2~3^2~1.
	* NEWS: Mention this change.

	xlat: update IPV4_DEVCONF_* constants.
	* src/xlat/inet_devconf_indices.in (IPV4_DEVCONF_ARP_EVICT_NOCARRIER-1):
	New constant introduced by Linux kernel commit v5.16-rc1~159^2~3^2~2.
	* NEWS: Mention this change.

	xlat: update ETH_P_* constants.
	* src/xlat/ethernet_protocols.in (ETH_P_REALTEK): New constant
	introduced by Linux kernel commit v5.16-rc1~159^2~168^2~6.
	* NEWS: Mention this change.

	xlat: update FAN_* constants.
	* src/xlat/fan_event_flags.in (FAN_FS_ERROR): New constant introduced
	by Linux kernel commit v5.16-rc1~101^2~16.
	* tests/fanotify_mark.c (main): Update expected output.
	* NEWS: Mention this change.

	xlat: update BTRFS_* constants.
	* src/xlat/btrfs_send_flags.in (BTRFS_SEND_FLAG_VERSION): New constant
	introduced by Linux kernel commit v5.16-rc1~203^2~6.

	bundled: update linux UAPI headers to v5.16-rc8.
	* bundled/linux/include/uapi/asm-generic/fcntl.h: Update to
	headers_install'ed Linux kernel v5.16-rc8.
	* bundled/linux/include/uapi/linux/btrfs.h: Likewise.
	* bundled/linux/include/uapi/linux/io_uring.h: Likewise.
	* bundled/linux/include/uapi/linux/mctp.h: Likewise.
	* bundled/linux/include/uapi/linux/neighbour.h: Likewise.
	* bundled/linux/include/uapi/linux/netfilter/nf_tables.h: Likewise.
	* bundled/linux/include/uapi/linux/nfc.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/prctl.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/linux/vm_sockets.h: Likewise.

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

	xlat: update AUDIT_* constants.
	* xlat/nl_audit_types.in (AUDIT_URINGOP): New constant introduced
	by Linux kernel commit v5.16-rc1~162^2~18.
	(AUDIT_OPENAT2): New constant introduced by Linux kernel commit
	v5.16-rc1~161^2~1.
	(AUDIT_DM_CTRL, AUDIT_DM_EVENT): New constants introduced by Linux
	kernel commit v5.16-rc1~77^2~12.
	* NEWS: Mention this change.

	xlat: update SO_VM_* constants.
	* bundled/linux/include/uapi/linux/vm_sockets.h: Update to
	headers_install'ed Linux kernel v5.16-rc8.
	* src/xlat/sock_vsock_options.in (SO_VM_SOCKETS_CONNECT_TIMEOUT): Rename
	to SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD, renamed by Linux kernel commit
	v5.16-rc1~159^2~251.
	(SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW): New constant introduced by the same
	commit.

	xlat: update SO_* constants.
	* src/xlat/sock_options.in (SO_RESERVE_MEM): New constant introduced
	by Linux kernel commit v5.16-rc1~159^2~317^2~2.
	* NEWS: Mention this change.

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

	Update copyright year number range.
	* COPYING: Update copyright year number range.
	* tests/COPYING: Likewise.
	* debian/copyright: Likewise.

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

	mips: remove redundant include of syscall_dummy.h.
	As syscall_dummy.h is already included by syscall.h, there is no need
	to include it once more in syscallent.h.

	* src/linux/mips/syscallent.h: Do not include "syscall_dummy.h".

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

	Rework personality_designators and personality_names.
	Move personality_designators definition to the same file with
	its sole user, move arch-specific initialization to arch_defs.h.

	* src/linux/x32/arch_defs_.h (PERSONALITY_DESIGNATORS,
	PERSONALITY_NAMES): New macros.
	* src/linux/x86_64/arch_defs_.h: Likewise.
	* src/arch_defs.h [!PERSONALITY_DESIGNATORS, !PERSONALITY_NAMES]:
	Likewise.
	* src/basic_filters.c (personality_designators): New array.
	* src/defs.h (personality_designators): Remove.
	* src/syscall.c: Likewise.
	(personality_names): Use PERSONALITY_NAMES, add static_assert.

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

	Remove linux/generic/arch_defs_.h.
	Starting with commit v5.15~212, every supported architecture has to
	define PERSONALITY0_AUDIT_ARCH which effectively means that every
	supported architecture has its own arch_defs_.h file, and the generic
	arch_defs_.h is no longer needed.

	* src/Makefile.am (EXTRA_DIST): Remove linux/generic/arch_defs_.h.
	* src/linux/generic/arch_defs_.h: Remove.

	Complements: v5.15~212 "src/linux: add PERSONALITY0_AUDIT_ARCH definitions where possible"

2022-01-04  Renaud Métrich  <rmetrich@redhat.com>
	    Dmitry V. Levin  <ldv@strace.io>

	Implement displaying of expected context upon mismatch.
	New option to --secontext=... (also available as -e secontext=...)
	- mismatch: print expected context on mismatch

	When using 'mismatch', an additional check is made on the context by
	reading the context database and comparing the output after stripping
	the unwanted part (e.g. stripping nothing in 'full' mode, keeping the
	type only in default mode):
	- if it differs, prints the expected context after printing '!!'
	- if not, don't print anything

	Example with /home/rmetrich/GIT/strace/autom4te.cache/output.3 file:

	----
	$ matchpathcon /home/rmetrich/GIT/strace/autom4te.cache/output.3
	/home/rmetrich/GIT/strace/autom4te.cache/output.3	unconfined_u:object_r:user_home_t:s0

	$ ls -Z /home/rmetrich/GIT/strace/autom4te.cache/output.3
	system_u:object_r:user_home_t:s0 /home/rmetrich/GIT/strace/autom4te.cache/output.3
	----

	From above, we see the user part differs ('unconfined_u' vs 'system_u')

	Output in '!full' mode (no diff found on type):

	----
	$ strace --secontext=mismatch -e statx stat /home/rmetrich/GIT/strace/autom4te.cache/output.3
	... statx(AT_FDCWD, "/home/rmetrich/GIT/strace/autom4te.cache/output.3" [user_home_t], ...
	----

	Output in 'full' mode (diff found on user):

	----
	... statx(AT_FDCWD, "/home/rmetrich/GIT/strace/autom4te.cache/output.3" [system_u:object_r:user_home_t:s0!!unconfined_u:object_r:user_home_t:s0], ...
	----

	* NEWS: Mention this change.
	* doc/strace.1.in: Document it.
	* m4/st_selinux.m4 (st_SELINUX): Check for selabel_open
	and selabel_lookup.
	* src/filter_qualify.c [ENABLE_SECONTEXT]: Include "secontext.h".
	[ENABLE_SECONTEXT] (secontext_set): New variable.
	[ENABLE_SECONTEXT] (secontextstr_to_uint, qualify_secontext): New
	functions.
	(qual_options) [ENABLE_SECONTEXT]: Add "secontext".
	* src/secontext.c: Include <sys/stat.h>, <unistd.h>, <selinux/label.h>,
	"largefile_wrappers.h", "number_set.h", and "xmalloc.h".
	(selinux_context, selinux_context_full): Remove.
	(getcontext): Use is_number_in_set instead of selinux_context_full.
	(selinux_getpidcon): Use is_number_in_set instead of selinux_context.
	(get_expected_filecontext): New function.
	(selinux_getfdcon, selinux_getfilecon): Use it to print context mismatch
	if SECONTEXT_MISMATCH is set in secontext_set.
	* src/secontext.h (selinux_context, selinux_context_full): Remove.
