summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Prepare for 5.16 releasev5.16Dmitry V. Levin2022-01-101-1/+2
| | | | * NEWS: Update for 5.16 release.
* .mailmap: add more entries to avoid duplication in CREDITSDmitry V. Levin2022-01-101-0/+1
| | | | | * .mailmap: Add another email address of Paul Chaignon to avoid duplication in CREDITS file.
* Update copyright headersDmitry V. Levin2022-01-0915-15/+15
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* Fix preprocessor indentationDmitry V. Levin2022-01-091-5/+5
| | | | | | | | | 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
* net: remove PACKET_ADD_MEMBERSHIP #ifdef guardsEugene Syromyatnikov2022-01-092-9/+6
| | | | | | | | | 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.
* net: remove PACKET_RX_RING and PACKET_TX_RING #ifdef guardsEugene Syromyatnikov2022-01-091-6/+0
| | | | | | | | | 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"
* net: remove IPV6_ADD_MEMBERSHIP and IPV6_{JOIN,LEAVE}_ANYCAST guardsEugene Syromyatnikov2022-01-091-8/+0
| | | | | | | | | | | | 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"
* Remove MCAST_JOIN_GROUP #ifdef guardsEugene Syromyatnikov2022-01-092-12/+0
| | | | | | | | | | | | | | 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"
* net: remove IP_ADD_MEMBERSHIP #ifdef guardsEugene Syromyatnikov2022-01-091-4/+0
| | | | | | | | | | | | | 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"
* net: remove PACKET_STATISTICS #ifdef guardsEugene Syromyatnikov2022-01-091-4/+0
| | | | | | | | | | | | 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"
* net: initialise struct icmp_filter read buffer with ~0Eugene Syromyatnikov2022-01-091-1/+1
| | | | | | | 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.
* net: fix SO_ERROR socket option len clampingEugene Syromyatnikov2022-01-091-1/+1
| | | | | | | | | | | 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)"
* tests: check decoding of futex_waitv syscallDmitry V. Levin2022-01-094-0/+139
| | | | | | | * 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 arrayDmitry V. Levin2022-01-095-1/+233
| | | | | | | | | | | | | | * 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.
* Implement decoding of futex_waitv syscallAndré Almeida2022-01-093-0/+32
| | | | | | | | | | 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.
* xlat: update NDA_* constantsDmitry V. Levin2022-01-082-1/+2
| | | | | | * 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_* constantsDmitry V. Levin2022-01-084-3/+7
| | | | | | | | | | | | | | | | | * 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_* constantsDmitry V. Levin2022-01-082-1/+2
| | | | | | * 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_* constantsDmitry V. Levin2022-01-082-2/+3
| | | | | | * 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_* constantsDmitry V. Levin2022-01-082-1/+2
| | | | | | * 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_* constantsDmitry V. Levin2022-01-082-1/+3
| | | | | | * 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_* constantsDmitry V. Levin2022-01-083-3/+5
| | | | | | | * 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_* constantsDmitry V. Levin2022-01-081-0/+1
| | | | | * 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-rc8Dmitry V. Levin2022-01-0813-29/+128
| | | | | | | | | | | | | | | | | | * 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.
* xlat: update AUDIT_* constantsDmitry V. Levin2022-01-072-1/+5
| | | | | | | | | | * 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_* constantsDmitry V. Levin2022-01-072-2/+12
| | | | | | | | | | * 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_* constantsDmitry V. Levin2022-01-072-2/+10
| | | | | | * 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.
* Update copyright year number rangeDmitry V. Levin2022-01-063-3/+3
| | | | | | * COPYING: Update copyright year number range. * tests/COPYING: Likewise. * debian/copyright: Likewise.
* mips: remove redundant include of syscall_dummy.hDmitry V. Levin2022-01-061-1/+0
| | | | | | | 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".
* Rework personality_designators and personality_namesDmitry V. Levin2022-01-056-25/+27
| | | | | | | | | | | | | | | 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.
* Remove linux/generic/arch_defs_.hDmitry V. Levin2022-01-042-2/+0
| | | | | | | | | | | | 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"
* Implement displaying of expected context upon mismatchRenaud Métrich2022-01-0414-113/+453
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. (secontext_bits): New enum. (secontext_set, qualify_secontext, selinux_set_format): New declarations. * src/strace.c (SECONTEXT_E_QUAL): New macro. (usage): Use it, describe --secontext. (init) [ENABLE_SECONTEXT]: Call qualify_secontext, rename GETOPT_SECONTEXT to GETOPT_QUAL_SECONTEXT, use is_number_in_set instead of selinux_context. (init) [ENABLE_SECONTEXT] (secontext_qual): New variable. (init) [ENABLE_SECONTEXT] <GETOPT_QUAL_SECONTEXT>: Use it. * tests/.gitignore: Add *--secontext_full_mismatch, *--secontext_full_mismatch.c, *--secontext_mismatch, and *--secontext_mismatch.c. * tests/gen_secontext.sh: Generate *--secontext_full_mismatch.c and *--secontext_mismatch.c. * tests/gen_tests.in (access--secontext_full_mismatch, access--secontext_mismatch, chmod--secontext_full_mismatch, chmod--secontext_mismatch, execve--secontext_full_mismatch, execve--secontext_mismatch, execveat--secontext_full_mismatch, execveat--secontext_mismatch, faccessat--secontext_full_mismatch, faccessat--secontext_mismatch, faccessat-y--secontext_full_mismatch, faccessat-y--secontext_mismatch, fanotify_mark--secontext_full_mismatch, fanotify_mark--secontext_mismatch, fchmod--secontext_full_mismatch, fchmod--secontext_mismatch, fchmod-y--secontext_full_mismatch, fchmod-y--secontext_mismatch, fchmodat--secontext_full_mismatch, fchmodat--secontext_mismatch, fchownat--secontext_full_mismatch, fchownat--secontext_mismatch, file_handle--secontext_full_mismatch, file_handle--secontext_mismatch, linkat--secontext_full_mismatch, linkat--secontext_mismatch, open--secontext_full_mismatch, open--secontext_mismatch, openat--secontext_full_mismatch, openat--secontext_mismatch): New tests. * tests/linkat.c: Include <string.h>. (main) [PRINT_SECONTEXT_MISMATCH]: Check context mismatch. * tests/options-syntax.test: Check --secontext and -e secontext syntax. * tests/secontext.h (secontext_field): New enum. (secontext_full_file, secontext_short_file): Add "mismatch" argument. (update_secontext_type): Rename to update_secontext_field, add "field" argument. (SECONTEXT_FILE): Conditionalize "mismatch" argument passed to secontext_full_file and secontext_short_file on PRINT_SECONTEXT_MISMATCH. * tests/secontext.c: Include <sys/stat.h> and <selinux/label.h>. (get_type_from_context, raw_expected_secontext_full_file, raw_expected_secontext_short_file): New functions. (raw_secontext_short_file, raw_secontext_short_pid): Use get_type_from_context. (secontext_full_file): Add "mismatch" argument, use raw_expected_secontext_full_file if mismatch is enabled. (secontext_short_file): Add "mismatch" argument, use raw_expected_secontext_short_file if mismatch is enabled. (update_secontext_type): Rename to update_secontext_field, add "field" argument. Co-authored-by: Dmitry V. Levin <ldv@strace.io>
* Update .mailmapDmitry V. Levin2022-01-031-0/+2
| | | | | * .mailmap: Add both email addresses of Ahelenia Ziemiańska to avoid duplication in CREDITS file.
* Regenerate OpenZFS ioctls with vdev propsнаб2022-01-031-1/+3
| | | | | * src/ioctls_zfs.h (ZFS_IOC_VDEV_GET_PROPS, ZFS_IOC_VDEV_SET_PROPS): New entries.
* tests: bring lists back to the sorted orderDmitry V. Levin2022-01-024-50/+50
| | | | | | | * tests/Makefile.am (check_PROGRAMS): Make the list sorted again. * tests/gen_tests.in: Likewise. * tests/pure_executables.list: Likewise. * tests/.gitignore: Likewise.
* Use a separate manpage date for strace-log-merge.1Dmitry V. Levin2022-01-015-7/+16
| | | | | | | | | | | | | | | strace-log-merge.1 used cause confusion by sharing the manpage date with strace.1. * Makefile.am (dist-hook): Rename MANPAGE_DATE to STRACE_MANPAGE_DATE, generate $(distdir)/doc/.strace-log-merge.1.in.date. * configure.ac (manpage_date): Rename to strace_manpage_date. (slm_manpage_date): Define from doc/strace-log-merge.1.in. (MANPAGE_DATE): Rename to STRACE_MANPAGE_DATE. (SLM_MANPAGE_DATE): Define to slm_manpage_date. * doc/strace-log-merge.1.in: Replace MANPAGE_DATE with SLM_MANPAGE_DATE. * doc/strace.1.in: Replace MANPAGE_DATE with STRACE_MANPAGE_DATE. * strace.spec.in: Likewise, generate doc/.strace-log-merge.1.in.date.
* btrfs: add decoding of fs_info checksum, generation and metadataSahil Kang2021-12-305-1/+144
| | | | | | | | | | | | | | | | | | * src/xlat/btrfs_csum_types.in: New file. * src/xlat/btrfs_fs_info_flags.in: Likewise. * src/btrfs.c: Include "xlat/btrfs_csum_types.h" and "xlat/btrfs_fs_info_flags.h". (btrfs_ioctl): Print csum_type, csum_size, flags, generation, and metadata_uuid fields of struct btrfs_ioctl_fs_info_args. * NEWS: Mention it. * tests/btrfs.c: Include "print_utils.h", "xlat/btrfs_csum_types.h", and "xlat/btrfs_fs_info_flags.h". (print_hex, print_uuid, btrfs_print_fs_info_args, btrfs_fs_info_args_subtest): New functions. (btrfs_test_fs_info_ioctl): New function for write_ok mode. (main): Use btrfs_test_fs_info_ioctl. Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com>
* tests: fix btrfs read-write testsSahil Kang2021-12-301-7/+2
| | | | | | | | * tests/btrfs.c (btrfs_test_subvol_ioctls): Remove deprecated BTRFS_SUBVOL_CREATE_ASYNC flag to prevent -EOPNOTSUPP. (btrfs_test_ino_path_ioctls): Add fe_flags= field prefix to printed output. Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com>
* bpf: add support for new fields in struct bpf_prog_infoPaul Chaignon2021-12-303-2/+31
| | | | | | | | | | | | * src/bpf_attr.h (struct bpf_prog_info_struct): Add recursion_misses and verified_insns fields. (expected_bpf_prog_info_struct_size): Update. * src/bpf.c (print_bpf_prog_info): Decode recursion_misses and verified_insns fields introduced by Linux kernel commits v5.12-rc1~200^2~28^2~28 and v5.16-rc1~159^2~2^2~43^2~1. * tests/bpf-obj_get_info_by_fd.c (main): Update expected output. Signed-off-by: Paul Chaignon <paul@isovalent.com>
* bpf: support commands BPF_LINK_GET_*_IDPaul Chaignon2021-12-304-0/+32
| | | | | | | | | | | | | | | | | | * src/bpf.c (BEGIN_BPF_CMD_DECODER(BPF_LINK_GET_FD_BY_ID): Decode the BPF_LINK_GET_FD_BY_ID command. (decode_BPF_BTF_GET_NEXT_ID): New macro. (SYS_FUNC(bpf)): Decode the commands. * src/bpf_attr.h (BPF_LINK_GET_FD_BY_ID_struct): New structure introduced by Linux commit v5.8-rc1~165^2~343^2~16^2~8. (BPF_LINK_GET_FD_BY_ID_struct_size): New macro. * NEWS: Mention this. * tests/bpf.c (union bpf_attr_data): Add BPF_LINK_GET_FD_BY_ID. (BPF_LINK_GET_FD_BY_ID_checks): Test for the BPF_LINK_GET_FD_BY_ID command. (BPF_LINK_GET_NEXT_ID_checks): New macro. (main) <checks>: Add BPF_LINK_GET_NEXT_ID and BPF_LINK_GET_FD_BY_ID. Signed-off-by: Paul Chaignon <paul@isovalent.com>
* bpf: support new fields for BPF_PROG_TEST_RUNPaul Chaignon2021-12-305-5/+24
| | | | | | | | | | | | | * src/bpf_attr.h (BPF_PROG_TEST_RUN_struct): Add flags and cpu fields introduced by Linux kernel commit v5.10-rc1~107^2~96^2~36. (expected_BPF_PROG_TEST_RUN_struct_size): Update. * src/xlat/bpf_test_run_flags.in: New file. * src/bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_TEST_RUN)): Decode the new fields. * NEWS: Mention this. * tests/bpf.c (BPF_PROG_TEST_RUN_check): Update expected output. Signed-off-by: Paul Chaignon <paul@isovalent.com>
* bpf: implement decoding of BPF_PROG_LOAD fd_array fieldPaul Chaignon2021-12-306-6/+18
| | | | | | | | | | | | | | * src/bpf_attr.h (BPF_PROG_LOAD_struct): Add fd_array field introduced by Linux kernel commit v5.6-rc1~151^2~46^2~37^2~5. (expected_BPF_PROG_LOAD_struct_size): Update. * src/bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Decode the new field. * NEWS: Mention this. * tests/bpf-obj_get_info_by_fd.c (print_prog_load): Update expected output. * tests/bpf.c (BPF_PROG_LOAD_checks): Likewise. * tests/kernel_version.c (print_bpf_attr): Likewise. Signed-off-by: Paul Chaignon <paul@isovalent.com>
* bpf: implement decoding of BPF_MAP_CREATE map_extra fieldPaul Chaignon2021-12-305-3/+40
| | | | | | | | | | | | | | | | * src/bpf_attr.h (BPF_MAP_CREATE_struct): Add map_extra field introduced by Linux kernel commit v5.6-rc1~151^2~46^2~37^2~5. (bpf_map_info_struct): Likewise. (expected_BPF_MAP_CREATE_struct_size, expected_bpf_map_info_struct_size): Update. * src/bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Decode the new field. * NEWS: Mention this. * tests/bpf-obj_get_info_by_fd.c (print_map_create): Update expected output. * tests/bpf.c (BPF_MAP_CREATE_checks): Add a check that includes the map_extra field. Signed-off-by: Paul Chaignon <paul@isovalent.com>
* bpf: update BPF_* constantsPaul Chaignon2021-12-304-5/+8
| | | | | | | | | | | | * src/xlat/bpf_map_types.in (BPF_MAP_TYPE_BLOOM_FILTER): New constant introduced in Linux kernel commit v5.16-rc1~159^2~2^2~20^2~4. * src/xlat/bpf_attach_types.in (BPF_PERF_EVENT): New constant introduced in Linux kernel commit v5.15-rc1~157^2~22^2~33^2~12. * tests/bpf.c (BPF_MAP_CREATE_checks, BPF_PROG_QUERY_checks): Update checks and their expected output. * NEWS: Mention this. Signed-off-by: Paul Chaignon <paul@isovalent.com>
* Move some gcc-agnostic macros from gcc_compat.h to macros.hDmitry V. Levin2021-12-263-11/+35
| | | | | | | | * src/gcc_compat.h (SAME_TYPE): Document it, rename to IS_SAME_TYPE. (FAIL_BUILD_ON_ZERO, MUST_BE_ARRAY): Move ... * src/macros.h: ... here, document them. (IS_NOT_ARRAY): New macro. * src/xstring.h: Include "macros.h" instead of "gcc_compat.h".
* tests/ptrace: fix expected output for riscv64Dmitry V. Levin2021-12-251-4/+1
| | | | | | | * tests/ptrace.c (print_prstatus_regset] [__riscv]: Do not print delimiters before regs->pc. Fixes: v5.13~255 "riscv64: implement PTRACE_{G,S}ETREGSET NT_PRSTATUS regset decoding"
* tests: fix riscv64 supportDmitry V. Levin2021-12-254-6/+6
| | | | | | | | | | | | | | | Apparently, the preprocessor macro defined by gcc for riscv64 is __riscv instead of __riscv__ as one might expect. * tests/bpf.c: Replace __riscv__ with __riscv. * tests/cur_audit_arch.h: Likewise. * tests/io_uring_register.c: Likewise. * tests/ptrace.c: Likewise. Fixes: v4.22~18 "bpf: use print_big_u64_addr" Fixes: v5.5~41 "io_uring: add support for IORING_REGISTER_FILES_UPDATE" Fixes: v5.13~255 "riscv64: implement PTRACE_{G,S}ETREGSET NT_PRSTATUS regset decoding" Fixes: v5.15~210 "tests: add cur_audit_arch.h"
* Fix building for older AndroidChih-Hsuan Yen2021-12-172-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the following commands, $ ./bootstrap $ _pkg_arch=aarch64 $ export PATH="/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH" $ CC=$_pkg_arch-linux-android21-clang \ ./configure --prefix=/opt/android-libs/${_pkg_arch/_/-} \ --host=$_pkg_arch-linux-android \ --without-libunwind \ --enable-mpers=no \ --disable-gcc-Werror $ make Building fails with error diagnostics like this: In file included from sync_file_range.c:12: ./xlat/sync_file_range_flags.h:7:16: error: use of undeclared identifier 'SYNC_FILE_RANGE_WAIT_BEFORE' static_assert((SYNC_FILE_RANGE_WAIT_BEFORE) == (1), "SYNC_FILE_RANGE_WAIT_BEFORE != 1"); This is a build regression from bd87cc95120b3707a6fe55129451bb0453730a6d, where "#unconditional" is added given that <linux/fs.h> is bundled, but the latter is not explicitly #include'd. As a side note, SYNC_FILE_RANGE* symbols are not available with ANDROID_API__ < 26 [1]. [1] https://android.googlesource.com/platform/bionic/+/refs/tags/android-12.0.0_r15/libc/include/fcntl.h#98 * src/sync_file_range.c: Include <linux/fs.h>. * src/sync_file_range2.c: Likewise. Fixes: v5.15~76 "xlat: add #unconditional to sync_file_range_flags"
* Update ioctl entries from linux v5.16Gleb Fotengauer-Malinovskiy2021-12-138-20/+93
| | | | | | | | | | | | * src/linux/32/ioctls_inc_align16.h: Update from linux v5.16-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.16-rc5Gleb Fotengauer-Malinovskiy2021-12-131-0/+1
| | | | | * maint/ioctls_sym.sh: Workaround incompatible definition of __alloc_size__ macro introduced by the Linux commit v5.16-rc1~106^2~224.