From 6bff33786f386643edcb461edea6a6a934b27af6f0c6f060afcb8ab4b7b98379 Mon Sep 17 00:00:00 2001 From: Shung-Hsi Yu Date: Wed, 20 Nov 2024 02:37:44 +0000 Subject: [PATCH] Update to 7.5.0 OBS-URL: https://build.opensuse.org/package/show/Base:System/bpftool?expand=0&rev=24 --- .gitattributes | 23 +++++ .gitignore | 1 + binutils-2.40.patch | 13 +++ bpftool-libbpf-v7.4.0-sources.tar.gz | 3 + bpftool-libbpf-v7.5.0-sources.tar.gz | 3 + bpftool.changes | 136 +++++++++++++++++++++++++++ bpftool.spec | 103 ++++++++++++++++++++ 7 files changed, 282 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 binutils-2.40.patch create mode 100644 bpftool-libbpf-v7.4.0-sources.tar.gz create mode 100644 bpftool-libbpf-v7.5.0-sources.tar.gz create mode 100644 bpftool.changes create mode 100644 bpftool.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/binutils-2.40.patch b/binutils-2.40.patch new file mode 100644 index 0000000..7546510 --- /dev/null +++ b/binutils-2.40.patch @@ -0,0 +1,13 @@ +diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile +index f610e184ce02..21cd7505e871 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -154,6 +154,8 @@ else + # Fall back on libbfd + ifeq ($(feature-libbfd),1) + LIBS += -lbfd -ldl -lopcodes ++ else ifeq ($(feature-libbfd-liberty-sframe),1) ++ LIBS += -lbfd -ldl -lopcodes -liberty -lsframe -lzstd + else ifeq ($(feature-libbfd-liberty),1) + LIBS += -lbfd -ldl -lopcodes -liberty + else ifeq ($(feature-libbfd-liberty-z),1) diff --git a/bpftool-libbpf-v7.4.0-sources.tar.gz b/bpftool-libbpf-v7.4.0-sources.tar.gz new file mode 100644 index 0000000..f2af320 --- /dev/null +++ b/bpftool-libbpf-v7.4.0-sources.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ad6f35b3a629ce1a2d892b2467d2c67b85a29da9daafd062dd7503487ac3671 +size 1485279 diff --git a/bpftool-libbpf-v7.5.0-sources.tar.gz b/bpftool-libbpf-v7.5.0-sources.tar.gz new file mode 100644 index 0000000..bc29ff3 --- /dev/null +++ b/bpftool-libbpf-v7.5.0-sources.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1468d3fb8c70698359a6593d8828f0e0a56b72244cb8632c6e1947e11b3520b9 +size 1510032 diff --git a/bpftool.changes b/bpftool.changes new file mode 100644 index 0000000..b4d3fc5 --- /dev/null +++ b/bpftool.changes @@ -0,0 +1,136 @@ +------------------------------------------------------------------- +Wed Oct 30 15:56:21 UTC 2024 - Fredrik Lönnegren + +- Update to version 7.5.0 + * Add support for attaching and detaching tcx programs with bpftool net, + along with relevant documentation and bash completion. + * When dumping BTF information, support dumping kfunc prototypes. Users + willing to use kfunc no longer have to define the prototypes themselves, + then can use the generated header file. This is also convenient to check + what kfuncs are available in the running kernel. + * Sort the output from the dump, in C format, of BTF objects. Sorting the + output helps applying diff tools on the generated header files, and helps + generate a more natural ordering in the header. + * Print richer information when dumping sockmap links. + * In BPF skeletons, auto-attach struct_ops BPF maps as part of + __attach(), define BPF_SKEL_SUPPORTS_MAP_AUTO_ATTACH accordingly. + * Improvements in libbpf bring the ability to open and work with object files + in either endianness for some operations like object linking or light BPF + skeleton creation. + * Bpftool automatically mounts the BPF virtual file system (bpffs) when + necessary, for example to pin programs. This bpffs was mounted on the + parent directory for the provided path under certain circumstances. Now + bpftool mounts the bpffs on the provided path instead, as expected. + * When loading programs and trying to pin the maps, attempt to mount the + bpffs when the provided path for the maps is not under an existing bpffs + already, as bpftool usually does for other similar commands. + * Use __typeof__() rather than typeof() in BPF skeleton, to improve + compatibility with C++. + * Fix cgroup-related queries to avoid trying to dump (inaccessible) + Netkit-related information. + * Fix backward compatibility issue related to struct_ops maps handling for + BPF skeletons used with older versions of libbpf. + * Many trivial improvements to bpftool's documentation and bash completion, + such as formatting fixes, typo fixes, or minor clarifications. + * Fix typos in error message and usage help message. + +------------------------------------------------------------------- +Wed May 22 09:43:32 UTC 2024 - Shung-Hsi Yu + +- Update LLVM version selection logic to align with bcc and bpftrace + * narrow down the dependency to clang and llvm + +------------------------------------------------------------------- +Thu Apr 11 07:02:33 UTC 2024 - Fredrik Lönnegren + +- Update to version 7.4.0 + * Kernel configuration options related to bpfilter (namely: CONFIG_BPFILTER + * and CONFIG_BPFILTER_UMH) are no longer checked with bpftool feature probe + * More information displayed for BPF links + * Generate shadow variables for struct_ops maps in program skeletons + * Mark orphaned programs as such when listing programs + * Recognize arena map types (a09e203) and global variables + * Support the addr_space_cast instruction in the disassembler for translated + programs + * In the mirror repository, fix the detection of clang-bpf-co-re (for + skeletons support) for some clang versions + * Displaying PIDs for processes holding references to BPF links when listing + links with bpftool link list on older kernels broke in v7.3.0, because the + internal program pid_iter would fail to load + +------------------------------------------------------------------- +Tue Nov 28 07:24:46 UTC 2023 - Shung-Hsi Yu + +- Update to version 7.3.0 + * deprecate keyword "dev" for specifying interface name, use + offload_dev instead + * support passing an interface name with xdpmeta_dev + with "prog load" + * show more details information when displaying BPF links + * show netfilter, tcx, and netkit information in the "net list" + * support cgroup UNIX socket attach points + * show inner map IDs (instead of raw values) with "map dump" + * support LLVM's v4 instructions in the disassembler + * fix JIT compiler global memory limit report for unprivileged + users on aarch64 +- Remove backported patches that have been included in v7.3.0 + * drop 0001-bpftool-use-a-local-copy-of-perf_event-to-fix-access.patch + * drop 0002-bpftool-define-a-local-bpf_perf_link-to-fix-accessin.patch + * drop 0003-bpftool-use-a-local-bpf_perf_event_value-to-fix-acce.patch + * drop 0004-bpftool-Use-a-local-copy-of-BPF_LINK_TYPE_PERF_EVENT.patch + +------------------------------------------------------------------- +Wed Mar 29 17:35:09 UTC 2023 - Michal Suchanek + +- Update to out-of-tree version 7.2.0 +- Use release tarball that includes the specific copy of libbpf that is needed + to build bpftool +- Fix build on Linux 5.14 + + 0001-bpftool-use-a-local-copy-of-perf_event-to-fix-access.patch + + 0002-bpftool-define-a-local-bpf_perf_link-to-fix-accessin.patch + + 0003-bpftool-use-a-local-bpf_perf_event_value-to-fix-acce.patch + + 0004-bpftool-Use-a-local-copy-of-BPF_LINK_TYPE_PERF_EVENT.patch + +------------------------------------------------------------------- +Wed Mar 1 08:15:33 UTC 2023 - Martin Liška + +- Add -lzstd as libbfd is linked against the compression library. + +------------------------------------------------------------------- +Wed Feb 22 08:21:22 UTC 2023 - Martin Liška + +- Rebase binutils-2.40.patch for v6.2. + +------------------------------------------------------------------- +Wed Feb 15 09:11:12 UTC 2023 - Martin Liška + +- Add binutils-2.40.patch where we need to explicitly link against + -lsframe. It's a workaround for an existing issue: + https://github.com/libbpf/bpftool/issues/73. + +------------------------------------------------------------------- +Fri Oct 7 16:22:21 UTC 2022 - Callum Farmer + +- Move bash-completion to subpackage so it isn't installed when + not needed + +------------------------------------------------------------------- +Fri Apr 8 15:15:39 UTC 2022 - Dirk Müller + +- add rebuild subpackage to ensure rebuild in TW + +------------------------------------------------------------------- +Thu Oct 14 11:40:44 UTC 2021 - Shung-Hsi Yu + +- Enable libbfd feature to support dumping jited form of BPF programs + +------------------------------------------------------------------- +Wed Jan 8 16:28:37 UTC 2020 - Ludwig Nussel + +- use optflags for building +- build and install man pages + +------------------------------------------------------------------- +Thu May 9 14:41:11 UTC 2019 - Michal Rostecki + +- Initial release diff --git a/bpftool.spec b/bpftool.spec new file mode 100644 index 0000000..1f021fe --- /dev/null +++ b/bpftool.spec @@ -0,0 +1,103 @@ +# +# spec file for package bpftool +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +# Use default LLVM on openSUSE unless it is not yet supported +%if 0%{?suse_version} >= 1600 || 0%{?is_opensuse} + %if 0%{?product_libs_llvm_ver} > 17 + %define llvm_major_version 17 + %else + %define llvm_major_version %{nil} + %endif +%else + # Hard-code latest LLVM for SLES, the default version is too old + %if 0%{?sle_version} == 150600 + %define llvm_major_version 17 + %else + %if 0%{?sle_version} == 150500 + %define llvm_major_version 15 + %else + %if 0%{?sle_version} == 150400 + %define llvm_major_version 11 + %endif + %endif + %endif +%endif + +Name: bpftool +Version: 7.5.0 +Release: 0 +Summary: Tool for inspection and manipulation of BPF programs and maps +License: GPL-2.0-only +Group: Development/Tools/Other +URL: https://www.kernel.org/ +Source0: https://github.com/libbpf/bpftool/releases/download/v%{version}/bpftool-libbpf-v%{version}-sources.tar.gz +Patch0: binutils-2.40.patch +BuildRequires: binutils-devel +# Needed for compiling included BPF program (i.e. skeletons) +BuildRequires: clang%{llvm_major_version} +BuildRequires: docutils +BuildRequires: libcap-devel +BuildRequires: libelf-devel +BuildRequires: libzstd-devel +# llvm-strip is needed for the included BPF program (i.e. skeletons) +BuildRequires: llvm%{llvm_major_version} + +%description +bpftool allows for inspection and simple modification of BPF objects (programs +and maps) on the system. + +%package bash-completion +Summary: Bash completion for bpftool +Group: System/Shells +Requires: %{name} +Requires: bash-completion +Supplements: (%{name} and bash-completion) + +%description bash-completion +bash command line completion support for bpftool. + +%prep +%autosetup -p1 -n bpftool-libbpf-v%{version}-sources +sed -i -e 's/CFLAGS += -O2/CFLAGS = $(RPM_OPT_FLAGS)/' src/Makefile + +%build +%make_build -C src V=1 \ + feature-reallocarray=1 \ + feature-libbfd-liberty=1 \ +%if %(if gcc -lsframe -shared 2>/dev/null ; then echo 1 ; else echo 0; fi; ) + feature-libbfd-liberty-sframe=1 \ +%endif + feature-disassembler-four-args=1 \ + all +%make_build -C docs V=1 \ + man + +%install +make -C src V=1 install DESTDIR=%{buildroot} prefix=%{_prefix} mandir=%{_mandir} +make -C docs V=1 install DESTDIR=%{buildroot} prefix=%{_prefix} mandir=%{_mandir} + +%files +%license LICENSE LICENSE.BSD-2-Clause LICENSE.GPL-2.0 +%doc README.md CHECKPOINT-COMMIT BPF-CHECKPOINT-COMMIT +%{_sbindir}/bpftool +%{_mandir}/man?/*.gz + +%files bash-completion +%{_datadir}/bash-completion/completions/bpftool + +%changelog