summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ioctl: implement KD* ioctl decodingesyr/kdEugene Syromyatnikov2021-10-1246-1/+3653
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/kd_ioctl.c: New file. * src/kd_mpers_ioctl.c: Likewise. * src/Makefile.am (strace_SOURCES): Add them. * src/defs.h (DECL_IOCTL(kd)): New declaration. * src/ioctl.c (ioctl_decode) <case 'K'>: Call kd_ioctl. * src/xlat/kd_default_led_flags.in: New file. * src/xlat/kd_font_flags.in: Likewise. * src/xlat/kd_font_ops.in: Likewise. * src/xlat/kd_ioctl_cmds.in: Likewise. * src/xlat/kd_kbd_modes.in: Likewise. * src/xlat/kd_kbd_types.in: Likewise. * src/xlat/kd_key_ascii_keys.in: Likewise. * src/xlat/kd_key_brl_keys.in: Likewise. * src/xlat/kd_key_cur_keys.in: Likewise. * src/xlat/kd_key_dead_keys.in: Likewise. * src/xlat/kd_key_fn_key_vals.in: Likewise. * src/xlat/kd_key_fn_keys.in: Likewise. * src/xlat/kd_key_lock_keys.in: Likewise. * src/xlat/kd_key_pad_keys.in: Likewise. * src/xlat/kd_key_shift_keys.in: Likewise. * src/xlat/kd_key_slock_keys.in: Likewise. * src/xlat/kd_key_spec_keys.in: Likewise. * src/xlat/kd_key_tables.in: Likewise. * src/xlat/kd_key_types.in: Likewise. * src/xlat/kd_keymap_flags.in: Likewise. * src/xlat/kd_led_flags.in: Likewise. * src/xlat/kd_meta_vals.in: Likewise. * src/xlat/kd_modes.in: Likewise. * tests/.gitignore: Add ioctl_kd, ioctl_kd-Xabbrev, ioctl_kd-Xraw, ioctl_kd-Xverbose, ioctl_kd-success, ioctl_kd-success-Xabbrev, ioctl_kd-success-Xraw, ioctl_kd-success-Xverbose, ioctl_kd-success-s1024, ioctl_kd-success-s1024-Xabbrev, ioctl_kd-success-s1024-Xraw, and ioctl_kd-success-s1024-Xverbose. * tests/pure_executables.list: Add ioctl_kd, ioctl_kd-Xabbrev, ioctl_kd-Xraw, and ioctl_kd-Xverbose. * tests/Makefile.am: Add ioctl_kd-success, ioctl_kd-success-Xabbrev, ioctl_kd-success-Xraw, ioctl_kd-success-Xverbose, ioctl_kd-success-s1024, ioctl_kd-success-s1024-Xabbrev, ioctl_kd-success-s1024-Xraw, and ioctl_kd-success-s1024-Xverbose. * tests/gen_tests.in (ioctl_kd, ioctl_kd-Xabbrev, ioctl_kd-Xraw, ioctl_kd-Xverbose, ioctl_kd-success, ioctl_kd-success-Xabbrev, ioctl_kd-success-Xraw, ioctl_kd-success-Xverbose, ioctl_kd-success-s1024, ioctl_kd-success-s1024-Xabbrev, ioctl_kd-success-s1024-Xraw, ioctl_kd-success-s1024-Xverbose): New tests. * tests/ioctl_kd-Xabbrev.c: New file. * tests/ioctl_kd-Xraw.c: Likewise. * tests/ioctl_kd-Xverbose.c: Likewise. * tests/ioctl_kd-success-Xabbrev.c: Likewise. * tests/ioctl_kd-success-Xraw.c: Likewise. * tests/ioctl_kd-success-Xverbose.c: Likewise. * tests/ioctl_kd-success-s1024-Xabbrev.c: Likewise. * tests/ioctl_kd-success-s1024-Xraw.c: Likewise. * tests/ioctl_kd-success-s1024-Xverbose.c: Likewise. * tests/ioctl_kd-success-s1024.c: Likewise. * tests/ioctl_kd-success.c: Likewise. * tests/ioctl_kd.c: Likewise. * NEWS: Mention it.
* ioctl: fix printing of ioctl numbers in -Xverbose modeEugene Syromyatnikov2021-10-121-4/+4
| | | | | | | | | | | When NULL is passed as dflt to printflags, nothing is printed at all if flags is 0. (Ab)use the fact that comment printing is not triggered for an empty string and pass "" instead of NULL. * src/ioctl.c (ioctl_print_code, evdev_decode_number, evdev_decode_number): Pass "" as dflt instead of NULL if abbrev is false. Fixes: v5.3~10 "ioctl: do not print comments twice in -Xverbose"
* util: handle QUOTE_0_TERMINATED|QUOTE_EXPECT_TRAILING_0 in printstr_exEugene Syromyatnikov2021-10-121-0/+6
| | | | | | | | | | | | | There is a number of places in kernel where the last character of a string-typed structure field is not fetched and/or overwritten with '\0'. So far, it was difficult to signify this in strace output done via printstr_ex; this commit adds logic that decreases size passed to print_quoted_string in order to signify that, while there is an additional non-NUL character in the field, it will be ignored by the kernel. * src/util.c (printstr_ex): Decrease size before print_quoted_string call if both QUOTE_0_TERMINATED and QUOTE_EXPECT_TRAILING_0 set.
* tests/tests.h: introduce XLAT_KNOWN_FMT and XLAT_UNKNOWN_FMT macrosEugene Syromyatnikov2021-10-121-0/+9
| | | | * tests/tests.h (XLAT_KNOWN_FMT, XLAT_UNKNOWN_FMT): New macros.
* Introduce sprint_char/print_charEugene Syromyatnikov2021-10-123-32/+67
| | | | | | | | | | | | | Helper functions for printing separate characters. * src/print_fields.h (PRINT_FIELD_CHAR): New macro. * src/print_utils.h (BYTE_HEX_CHARS_PRINTF, BYTE_HEX_CHARS_PRINTF_QUOTED): Remove. (is_print): Move up. (SPRINT_CHAR_BUFSZ, print_char): New macros. (enum sprint_char_flag_bits, enum sprint_char_flags): New enumerations. (sprint_char): New function. * src/v4l2.c (print_pixelformat): Use print_char.
* prctl: handle PR_SPEC_L1D_FLUSH PR_[GS]ET_SPECULATION_CTRL prctl sub-commandEugene Syromyatnikov2021-10-124-5/+9
| | | | | | | | | | * src/xlat/pr_spec_cmds.in (PR_SPEC_L1D_FLUSH): New constant, introduced by Linux commit v5.15-rc1~193^2~1. * src/prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL, case PR_SET_SPECULATION_CTRL>: Handle PR_SPEC_L1D_FLUSH in arg2. * tests/prctl-spec-inject.c (prctl-spec-inject): Adjust expected "-a" option value. * tests/prctl-spec-inject.c: Update expected output.
* xlat: add DM_IMA_MEASUREMENT_FLAG to dm_flagsEugene Syromyatnikov2021-10-123-2/+4
| | | | | | | * src/xlat/dm_flags.in (DM_IMA_MEASUREMENT_FLAG): New constant, introduced by Linux commit v5.15-rc1~161^2~14. * tests/ioctl_dm.c: Update expected output. * NEWS: Mention it.
* xlat: update btrfs_features_compat_ro and btrfs_key_typesEugene Syromyatnikov2021-10-123-1/+4
| | | | | | | | * src/xlat/btrfs_features_compat_ro.in (BTRFS_FEATURE_COMPAT_RO_VERITY): New constant, introduced by Linux commit v5.15-rc1~35^2~48. * src/xlat/btrfs_key_types.in (BTRFS_VERITY_DESC_ITEM_KEY, BTRFS_VERITY_MERKLE_ITEM_KEY): Likewise. * NEWS: Mention it.
* src/xlat: add #sorted directive to btrfs_key_typesEugene Syromyatnikov2021-10-121-2/+1
| | | | | | | * src/xlat/btrfs_key_types.in: Add #sorted. (BTRFS_BALANCE_ITEM_KEY, BTRFS_DEV_STATS_KEY): Remove obsolete constants that duplicate BTRFS_TEMPORARY_ITEM_KEY and BTRFS_PERSISTENT_ITEM_KEY, respectively.
* xlat/gen.sh: add a compile-time check for sorted xlat orderEugene Syromyatnikov2021-10-121-2/+37
| | | | | | | | | | | | * src/xlat/gen.sh (check_sort_order): New function. (cond_def): Accept xlat_type parameter, call check_sort_order if xlat_type is XT_SORTED. (gen_header): Call check_sort_order for lines that start with "[A-Z_]*" (only of $unconditional is set to non-empty string: otherwise, call is done inside cond_def), "'1<<'[A-Z_]*", and "[0-9]*" if xlat_type is XT_SORTED. Suggested-by: Dmitry V. Levin <ldv@strace.io>
* xlat: fix constant order in elf_emEugene Syromyatnikov2021-10-121-1/+1
| | | | | | * src/xlat/elf_em.in (EM_CYGNUS_M32R): Move before EM_CYGNUS_V850. Fixes: v5.3~87 "xlat: add elf_em.in"
* tests: try to avoid excessive filter_seccomp-perf false positivesEugene Syromyatnikov2021-10-122-2/+2
| | | | | | | | Increase test time threefold and relax minimum expected ratio a bit. * tests/filter_seccomp-perf.c (main): Set alarm to 3 seconds instead of 1. * tests/filter_seccomp-perf.test (min_ratio): Change from 6 to 5.
* tests: try to make pidns-cache test a bit more robustEugene Syromyatnikov2021-10-121-2/+8
| | | | | | | | | | | Increase SYSCALL_COUNT tenfold in an attempt to get more stable time measurements. While at it, print some additional information about the time spent. * tests/pidns-cache.c (SYSCALL_COUNT): Change from 1000 to 10000. (main): Store original run time in orig_us variable, print it along with the run time under the PID NS test harness in a message to stderr.
* tests/pidns.c: allow skipping tests inside the pidns harnessEugene Syromyatnikov2021-10-121-2/+9
| | | | * tests/pidns.c (pidns_fork): Handle exit code 77 from the child.
* block: decode BLKGETDISKSEQ ioctlEugene Syromyatnikov2021-10-127-0/+7
| | | | | | | | | | | | | Introduced by Linux commit v5.15-rc1~161^2~41. * src/block.c (block_ioctl) <case BLKGETDISKSEQ>: Decode using printnum_in64. * src/linux/32/ioctls_inc_align16.h: Add BLKGETDISKSEQ entry. * 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: Likewse. * tests/ioctl_block.c: Add a check for NULL pointer for BLKGETDISKSEQ.
* xlat: add FAN_REPORT_PIDFD to fan_init_flagsEugene Syromyatnikov2021-10-123-4/+5
| | | | | | | * src/xlat/fan_init_flags.in (FAN_REPORT_PIDFD): New constant, introduced by Linux commit v5.15-rc1~219^2~4. * tests/fanotify_init.c: Update expected output. * NEWS: Mention this.
* io_uring: implement IORING_REGISTER_IOWQ_MAX_WORKERS op decodingEugene Syromyatnikov2021-10-124-2/+76
| | | | | | | | | | | | | | Introduced by Linux commit v5.15-rc1~83^2~22. * src/xlat/uring_iowq_acct.in: New file. * src/io_uring.c: Include "xlat/uring_iowq_acct.h". (print_io_uring_iowq_acct): New function. (SYS_FUNC(io_uring_register)) <case IORING_REGISTER_IOWQ_MAX_WORKERS>: Decode, call print_io_uring_iowq_acct. * src/xlat/uring_register_opcodes.in (IORING_REGISTER_IOWQ_MAX_WORKERS): New constant. * tests/io_uring_register.c: Update expected output, add IORING_REGISTER_IOWQ_MAX_WORKERS checks.
* tests: add io_uring_register-success* testsEugene Syromyatnikov2021-10-128-31/+112
| | | | | | | | | | | | | | | * tests/.gitignore: Add io_uring_register-success, io_uring_register-success-Xabbrev, io_uring_register-success-Xraw, and io_uring_register-success-Xverbose. * tests/Makefile.am (check_PROGRAMS): Likewise. * tests/gen_tests.in (io_uring_register-success, io_uring_register-success-Xabbrev, io_uring_register-success-Xraw, io_uring_register-success-Xverbose): New tests. * tests/io_uring_register-success-Xabbrev.c: New file. * tests/io_uring_register-success-Xraw.c: Likewise. * tests/io_uring_register-success-Xverbose.c: Likewise. * tests/io_uring_register-success.c: Likewise. * tests/io_uring_register.c: Update expected output.
* io_uring: print struct io_cqring_offsets.flags as integer and not flagsEugene Syromyatnikov2021-10-123-10/+5
| | | | | | | | | | | | | Since this is the offset of the cq_flags field in struct io_rings and not the flags themselves. * src/xlat/uring_cqring_flags.in: Remove. * src/io_uring.c: Remove "xlat/uring_cqring_flags.h" include. (print_io_cqring_offsets): Print flags using PRINT_FIELD_U. * tests/io_uring_setup.c: Remove "xlat/uring_cqring_flags.h"; update expected output. Fixes: v5.8~57 "io_uring: Add io_cqring_offset flags"
* io_uring: cap io_uring_probe element count to nargs on exitingEugene Syromyatnikov2021-10-121-3/+5
| | | | | | | | | | | | While a sane kernel would set ops_len to a sane value, its tampering may lead to strace reading out of probe value bounds. While at it, set PAF_ARRAY_TRUNCATED in cases when nargs is less than probe->ops_len. * src/io_uring.c (print_io_uring_probe): Print minimum of nargs and probe->ops_len probe->ops array elements on exiting, set PAF_ARRAY_TRUNCATED flag if nargs is less than probe->ops_len. Fixes: v5.6~94 "io_uring: support IORING_REGISTER_PROBE io_uring_register command"
* util: print ellipsis inside an empty array if PAF_ARRAY_TRUNCATED is setEugene Syromyatnikov2021-10-121-0/+2
| | | | | * src/util.c (print_array_ex) <!nmemb>: Call tprint_more_data_follows() if PAF_ARRAY_TRUNCATED is set in flags.
* io_uring: decode IORING_REGISTER_IOWQ_AFF io_uring_register opEugene Syromyatnikov2021-10-122-0/+69
| | | | | | | * src/io_uring.c (SYS_FUNC(io_uring_register)) <case IORING_REGISTER_IOWQ_AFF>: Decode, call print_affinitylist. * tests/io_uring_register.c: Add checks for IORING_REGISTER_IOWQ_AFF op deocding.
* xlat: update printxvals_ex doxygenEugene Syromyatnikov2021-10-121-6/+7
| | | | * src/xlat.c (printxvals_ex): Update the doxygen comment.
* tests/sched_xetaffinity: add a check for a non-properly-sized CPU setEugene Syromyatnikov2021-10-121-0/+15
| | | | | * tests/sched_xetaffinity.c: Add a check for sched_setaffinity with size of 7 bytes.
* affinity: make print_affinitylist externally availableEugene Syromyatnikov2021-10-122-1/+13
| | | | | | | As it is to be used in other files. * src/affinity.c (print_affinitylist): Remove "static" qualifier. * src/defs.h (print_affinitylist): New declaration.
* affinity: print cpuset of len 0 as "[]"Eugene Syromyatnikov2021-10-122-1/+25
| | | | | | | | To be consistent with print_array_ex behaviour. * src/affinity.c (print_affinitylist): Handle "!len" and "!cpu" cases separately; print "[]" in the former. * tests/sched_xetaffinity.c: Add a check for a cpuset of size 0.
* affinity: use MIN and ROUNDUP macros in print_affinitylistEugene Syromyatnikov2021-10-121-3/+2
| | | | | * src/affinity.c (print_affinitylist): Use MIN macro to calculate umove_size; use ROUNDUP macro to calculate size.
* xlat: no longer interpret NULL xlat as continuationEugene Syromyatnikov2021-10-122-17/+4
| | | | | | | | | | | | | | | | | | | | | | | | This feature, originally introduced by commit v4.23~52 "xlat.c: handle NULL xlat in lookup routines as incremental search", was poorly documented, was of limited use (the only use case was in print_array_ex, introduced in commit v4.23~91 "print_array: add support for printing array indices" (which means that between the two aforementioned commits printing xlats in indices was broken)), of limited value (it was actually useful only for sorted xlats, which are lg2(N) anyway, and even there an iteration from the saved cursor position is preferable for search continuation rather than bsearch), and ultimately was rendered non-operational by commit v5.3~105 "Add xlat description structure". * src/util.c (print_array_ex): Do not pass NULL as xlat in printxval_ex call. * src/xlat.c (xlookup): Remove x local static variable; remove static qualifier from idx and init it to 0; remove x, idx initialisation when xlat in non-NULL; remove xlat argument to x. (printxvals_ex): Remove the last local static variable and related logic. Reverts: v4.23~52 "xlat.c: handle NULL xlat in lookup routines as incremental search"
* io_uring: decode struct io_uring_rsrc_register and io_uring_rsrc_update2Eugene Syromyatnikov2021-10-122-2/+430
| | | | | | | | | | | | | * src/io_uring.c (print_io_uring_rsrc_data, print_io_uring_rsrc_tags, print_io_uring_register_rsrc, print_io_uring_update_rsrc): New functions. (SYS_FUNC(io_uring_register)) <case IORING_REGISTER_FILES2, case IORING_REGISTER_BUFFERS2>: Call print_io_uring_register_rsrc. (SYS_FUNC(io_uring_register)) <case IORING_REGISTER_FILES_UPDATE2, case IORING_REGISTER_BUFFERS_UPDATE>: Call print_io_uring_update_rsrc. * tests/io_uring_register.c (BIG_ADDR_MASK): New macro. (path_null, path_full): New constants, moved out of main. (print_rsrc_data, print_rsrc_tags): New functions. (main): Add checks for new decoders.
* io_uring: decode IORING_REGISTER_FILES_SKIP in IORING_REGISTER_FILES_UPDATEEugene Syromyatnikov2021-10-123-4/+24
| | | | | | | | | | Introduced by Linux commit v5.12~270^2~95. * src/xlat/uring_files_update_fds.in: New file. * src/io_uring.c (print_files_update_array_member): New function. (print_io_uring_files_update): Use print_files_update_array_member instead of print_fd_array_member. * tests/io_uring_register.c: Add checks for printing of fds -1, -2, -3.
* io_uring: deсode IORING_REGISTER_RESTRICTIONS io_uring_register opEugene Syromyatnikov2021-10-125-1/+264
| | | | | | | | | | | | | | Implemented in Linux commit v5.10-rc1~167^2~51. * src/io_uring.c (print_io_uring_restriction, print_io_uring_restrictions): New functions. (SYS_FUNC(io_uring_register)) <case IORING_REGISTER_RESTRICTIONS>: New decoder, calls print_io_uring_restrictions. * src/xlat/uring_restriction_opcodes.in: New file. * src/xlat/uring_sqe_flags.in: Likewise. * tests/io_uring_register.c: Add checks for IORING_REGISTER_RESTRICTIONS. * NES: Mention this.
* src: use is_bigendianEugene Syromyatnikov2021-10-122-12/+3
| | | | | | | | * src/disable_ptrace_request.c (ARG_OFFSET): Remove. (main): Use is_bigendian-conditioned ternary operator instead of ARG_OFFSET. * src/sockaddr.c (btohs): Conditionalise return value on is_bigendian value.
* tests: add io_uring_register-X* testsEugene Syromyatnikov2021-10-127-52/+100
| | | | | | | | | | | | | * tests/.gitignore: Add io_uring_register-Xabbrev, io_uring_register-Xraw, and io_uring_register-Xverbose. * tests/pure_executables.list: Likewise. * tests/gen_tests.in (io_uring_register-Xabbrev, io_uring_register-Xraw, io_uring_register-Xverbose): Add tests. * tests/io_uring_register-Xabbrev.c: New file. * tests/io_uring_register-Xraw.c: Likewise. * tests/io_uring_register-Xverbose.c: Likewise. * tests/io_uring_register.c: Update to produce output in accordance with XLAT_* definitions presence.
* xlat: update uring_opsEugene Syromyatnikov2021-10-123-7/+10
| | | | | | | | | | | * src/xlat/uring_ops.in (IORING_OP_MKDIRAT): New constant, introduced by Linux commit v5.15-rc1~184^2~2. (IORING_OP_SYMLINKAT): New constant, introduced by Linux commit v5.15-rc1~184^2~1. (IORING_OP_LINKAT): New constant, introduced by Linux commit v5.15-rc1~184^2. * tests/io_uring_register.c: Update expected output. * NEWS: Mention it.
* io_uring: explicitly list io_uring_register ops without argEugene Syromyatnikov2021-10-112-0/+9
| | | | | | | | | | * src/io_uring.c (SYS_FUNC(io_uring_register)): Add IORING_UNREGISTER_BUFFERS, IORING_UNREGISTER_FILES, IORING_UNREGISTER_EVENTFD, IORING_REGISTER_PERSONALITY, IORING_UNREGISTER_PERSONALITY, IORING_REGISTER_ENABLE_RINGS, and IORING_UNREGISTER_IOWQ_AFF to the opcode switch statement. * tests/io_uring_register.c: Add checks for IORING_REGISTER_ENABLE_RINGS and IORING_UNREGISTER_IOWQ_AFF.
* io_uring: sort xlat includes lexicographicallyEugene Syromyatnikov2021-10-111-2/+2
| | | | | | * src/io_uring.c: Move "xlat/uring_enter_flags.h" and "xlat/uring_cqring_flags.h" forward to establish a lexicographical order of includes.
* defs: update print_array_ex doxygenEugene Syromyatnikov2021-10-111-13/+16
| | | | | | | | | | | | | | This change updates the description of index_xlat (as xlat is no longer a naked array, but rather a description structure), removes index_xlat_size description, and adds description for the return value semantics. Interestingly, the change that introduced index_xlat_size description (v5.3~15 "Add support for printing local arrays to print_array") was applied after the change that removed the argument (v5.3~105 "Add xlat description structure"). Complements: v5.3~15 "Add support for printing local arrays to print_array" * src/defs.h (print_array_ex): Update description.
* util: unify differently-sized variants of print_{,u,x}int_array_memberEugene Syromyatnikov2021-10-1135-169/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Different functions are more or less unnecessary, since the argument size is passed in elem_size parameter anyway, and without any check of it the only thing differently-sized function variants do is concealing the discrepancies between the printed and fetched element size (as it was with bpf_prog_info.map_ids). All the callers are updated automatically using sed -i 's/print_\([xu]\)\?int\(8\|16\|32\|64\)_array_member/print_\1int_array_member/g' \ `git grep -l 'print_.*int.*_array_member'` with additional manual cleanup in src/linux/*/arch_*.c. * src/defs.h (print_int8_array_member, print_uint8_array_member, print_xint8_array_member, print_int32_array_member, print_uint32_array_member, print_xint32_array_member, print_uint64_array_member, print_xint64_array_member, print_xlong_array_member, print_kulong_array_member): Remove. (print_int_array_member, print_uint_array_member, print_xint_array_member): New declarations. * src/util.c (print_int8_array_member, print_uint8_array_member, print_xint8_array_member, print_int32_array_member, print_uint32_array_member, print_xint32_array_member, print_uint64_array_member, print_xint64_array_member): Remove. (print_int_array_member, print_uint_array_member, print_xint_array_member): New functions. * src/bpf.c (print_bpf_prog_info, BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use print_uint_array_member instead of print_uint32_array_member. * src/btrfs.c (btrfs_print_qgroup_inherit): Use print_uint_array_member instead of print_uint64_array_member. * src/clone.c (SYS_FUNC(clone3)): Use print_int_array_member instead of print_int32_array_member. * src/evdev.c (decode_bitset): Use print_xint_array_member instead of print_xlong_array_member. (mtslots_ioctl): Use print_int_array_member instead of print_int32_array_member. * src/gpio_ioctl.c (print_gpiohandle_request): Use print_uint_array_member instead of print_uint32_array_member and print_uint8_array_member. (print_gpiohandle_data, print_gpiohandle_set_config): Use print_uint_array_member instead of print_uint8_array_member. (print_gpio_v2_line_request): Use print_uint_array_member instead of print_uint32_array_member. * src/io_uring.c (SYS_FUNC(io_uring_setup), print_io_uring_probe): Use print_xint_array_member instead of print_xint32_array_member. * src/keyctl.c (keyctl_dh_compute, print_pkey_query, fetch_print_pkey_params): Likewise. * src/msghdr.c (print_cmsg_uint): Use print_uint_array_member instead of print_uint32_array_member. (print_cmsg_xint8_t): Use print_xint_array_member instead of print_xint8_array_member. * src/mtd.c (print_xint32x2_array_member, decode_nand_oobinfo, decode_nand_ecclayout_user): Use print_xint_array_member instead of print_xint32_array_member. * src/net.c (print_getsockopt): Use print_uint_array_member instead of print_uint32_array_member. * src/nlattr.c (decode_nla_meminfo): Likewise. * src/numa.c (SYS_FUNC(move_pages)): Use print_int_array_member instead of print_int32_array_member. * src/perf_ioctl.c (perf_ioctl_query_bpf): Use print_uint_array_member instead of print_uint32_array_member. * src/print_statfs.c (print_f_fsid): Use print_xint_array_member instead of print_xint64_array_member. * src/ptrace_syscall_info.c (print_psi_entry, print_psi_seccomp): Likewise. * src/rtnl_link.c (decode_ifla_bridge_id): Use print_uint_array_member instead of print_uint8_array_member. (decode_ifla_inet_conf, decode_ifla_inet6_conf): Use print_int_array_member instead of print_int32_array_member. (decode_ifla_inet6_stats, decode_ifla_inet6_icmp6_stats): Use print_uint_array_member instead of print_uint64_array_member. * src/seccomp_ioctl.c (print_struct_seccomp_data): Use print_xint_array_member instead of print_xint64_array_member. * src/sysinfo.c (SYS_FUNC(sysinfo)): Use print_uint_array_member instead of print_kulong_array_member. * src/v4l2.c (print_v4l2_queryctrl): Use print_xint_array_member instead of print_xint32_array_member. (print_v4l2_query_ext_ctrl): Use print_uint_array_member instead of print_uint32_array_member; use print_xint_array_member instead of print_xint32_array_member. * src/linux/aarch64/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint64_array_member. * src/linux/arm/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint32_array_member. * src/linux/i386/arch_fpregset.c (arch_decode_fpregset): Likewise. * src/linux/mips/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint32_array_member and print_xint64_array_member. * src/linux/mips/arch_pt_regs.c (arch_decode_pt_regs): Use print_xint_array_member instead of print_xint64_array_member. * src/linux/powerpc/arch_fpregset.c (arch_decode_fpregset): Likewise. * src/linux/powerpc/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint32_array_member and print_xint64_array_member. * src/linux/powerpc/arch_pt_regs64.c (decode_pt_regs64): Use print_xint_array_member instead of print_xint64_array_member * src/linux/s390/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint32_array_member and print_xint64_array_member. (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint32_array_member. * src/linux/sparc/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint32_array_member. * src/linux/sparc/arch_pt_regs.c (arch_decode_pt_regs): Likewise. * src/linux/sparc64/arch_prstatus_regset.c (arch_decode_prstatus_regset): Use print_xint_array_member instead of print_xint64_array_member. * src/linux/sparc64/arch_pt_regs64.c (decode_pt_regs64): Likewise. * src/linux/x86_64/arch_fpregset.c (arch_decode_fpregset): Use print_xint_array_member instead of print_xint32_array_member.
* bpf: fix bpf_prog_info.map_ids array printingEugene Syromyatnikov2021-10-113-87/+150
| | | | | | | | | | | | | | map_id_buf had an incorrect storage size (8 bytes instead of 4), which led to incorrect fetching of map_ids array elements, so only odd/even-indexed elements (on big/little-endian architectures, respectively) were printed. * src/bpf.c (print_bpf_prog_info): Change map_id_buf type from uint64_t to uint32_t. * tests/bpf-obj_get_info_by_fd.c: Create second bpf map, use it in the bpf program, and add additional checks regarding map_ids printing. * NEWS: Mention this. Fixes: v4.23~99 "bpf: decode bpf_attr.info field used by BPF_OBJ_GET_INFO_BY_FD command"
* Decode process_mrelease syscallEugene Syromyatnikov2021-10-118-0/+84
| | | | | | | | | | | | | | Introduced by Linux commits v5.14-159-g884a7e5964e0 and v5.14-160-gdce491039628. * src/linux/generic/syscallent-common.h ([BASE_NR + 448]): Add process_mrelease syscall entry. * src/mem.c (SYS_FUNC(process_mrelease)): New syscall decoder. * tests/.gitignore: Add process_mrelease and process_mrelease-y. * tests/gen_tests.in (process_mrelease, process_mrelease-y): New tests. * tests/process_mrelease.c: New file. * tests/process_mrelease-y.c: Likewise. * NEWS: Mention it.
* xlat: add MPOL_PREFERRED_MANY to mpol_modesEugene Syromyatnikov2021-10-114-11/+19
| | | | | | | | * src/xlat/mpol_modes.in (MPOL_PREFERRED_MANY): New constant, introduced by Linux commit v5.14-152-gb27abaccf8e8. * tests/mbind.c: Add MPOL_PREFERRED_MANY check, update expected output. * tests/set_mempolicy.c: Likewise. * NEWS: Mention the change.
* bundled: update linux UAPI headers to v5.15-rc4Dmitry V. Levin2021-10-1015-12/+148
| | | | | | | | | | | | | | | | | | | | * bundled/linux/include/uapi/linux/btrfs.h: Update to headers_install'ed Linux kernel v5.15-rc4. * bundled/linux/include/uapi/linux/btrfs_tree.h: Likewise. * bundled/linux/include/uapi/linux/dm-ioctl.h: Likewise. * bundled/linux/include/uapi/linux/fs.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/in6.h: Likewise. * bundled/linux/include/uapi/linux/io_uring.h: Likewise. * bundled/linux/include/uapi/linux/mount.h: Likewise. * bundled/linux/include/uapi/linux/netfilter/nfnetlink_conntrack.h: Likewise. * bundled/linux/include/uapi/linux/pkt_sched.h: Likewise. * bundled/linux/include/uapi/linux/prctl.h: Likewise. * bundled/linux/include/uapi/linux/socket.h: Likewise. * bundled/linux/include/uapi/linux/v4l2-controls.h: Likewise. * bundled/linux/include/uapi/linux/version.h: Likewise.
* tests: use BE_LE macro in more placesEugene Syromyatnikov2021-10-095-64/+19
| | | | | | | | | | | It makes reading the code where only little pieces are switched on WORDS_BIGENDIAN a little bit easier. * tests/io_uring_register.c (BE_LE): Move it... * tests/tests.h (BE_LE): ...here. * tests/bpf.c (bpf_attr_check): Use BE_LE instead of #ifdef WORDS_BIGENDIAN. * tests/clone3.c: Likewise. * tests/nlattr_ifla_linkinfo.c: Likewise.
* tests/test_nlattr.h: helper macros for integer attr testingEugene Syromyatnikov2021-10-091-0/+49
| | | | | | | | | | It is one of the most common attribute type decoder flavours, so it should be as trivial to test as possible. * tests/test_nlattr.h (DEF_NLATTR_INTEGER_CHECK_, TEST_NLATTR_VAL): New macros. (check_u32_nlattr, check_x32_nlattr): New functions, defined using DEF_NLATTR_INTEGER_CHECK_.
* tests/test_nlattr.h: provide TEST_NLATTR_OBJECT_ and TEST_NLATTR_ARRAY_Eugene Syromyatnikov2021-10-091-7/+25
| | | | | | | | | | So they can be used along with custom nla_type string format. * tests/test_nlattr.h (TEST_NLATTR_OBJECT_): New macro, a wrapper for TEST_NLATTR_OBJECT_EX_. (TEST_NLATTR_ARRAY_): Rename from TEST_NLATTR_ARRAY, add nla_type_str_ argument. (TEST_NLATTR_ARRAY): New macro, a wrapper for TEST_NLATTR_ARRAY_.
* tests/tests.h: add struct strval16 typeEugene Syromyatnikov2021-10-091-0/+5
| | | | | | Analogous to strval32 and strval64. * tests/tests.h (struct strval16): New type.
* tests/test_nlattr: allow TEST_NLATTR_EX_ usage with various xlat verbosityEugene Syromyatnikov2021-10-091-2/+2
| | | | | | * tests/test_nlattr.h (TEST_NLATTR_EX_): Wrap MSG_DONTWAIT printing in XLAT_FMT/XLAT_ARG so it can be used with different xlat verbosity levels.
* rtnl_route: make encap type decoder globally availableEugene Syromyatnikov2021-10-092-6/+7
| | | | | | | | | And rename it to decode_nla_lwt_encap_type. * src/nlattr.h (DECL_NLA(lwt_encap_type)): New declaration. * src/rtnl_route.c (decode_rta_encap_type): Rename it to... (decode_nla_lwt_encap_type): ...this. (rtmsg_nla_decoders) <[RTA_ENCAP_TYPE]>: Use decode_nla_lwt_encap_type.
* nlattr: make xval/flag nlattr printing a bit more structuredEugene Syromyatnikov2021-10-092-12/+10
| | | | | | | | | | | | | | | Since the only usage for prefix/suffix was to enframe the xval/flag output in a function call syntax (that is inverse to process_fn), let's simply provide fn_str and print it using tprints_arg_begin and tprint_arg_end. * src/nlattr.h (decode_nla_xlat_opts): Remove prefix and suffix fields, add fn_str field. * src/nlattr.c (decode_nla_xval, decode_nla_flags): Output fn_str using tprints_arg_begin, call tprint_arg_end if fn_str is non-NULL. (decode_nla_ether_proto): Pass "htons" in fn_str field of the opts structure instead of "htons(" and ")" as prefix and suffix, respectively.
* ipc_msg: sign-extend msgtypEugene Syromyatnikov2021-10-091-1/+1
| | | | | | | | | | | Most of the architectures have indirect IPC calls for compat, but not ARM, and that unraveled a missing sign extension of the msgtyp argument before printing. * src/ipc_msg.c (tprint_msgrcv): Sign-extend msgtyp using truncate_klong_to_current_klongsize. Reported-by: Dmitry V. Levin <ldv@strace.io>