Sync from SUSE:SLFO:Main libbpf revision 4144248e62c573c6def0ad57299d4481

This commit is contained in:
Adrian Schröter 2024-05-03 14:36:59 +02:00
commit 9623c4a5fa
5 changed files with 457 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
libbpf1

BIN
libbpf-1.2.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

345
libbpf.changes Normal file
View File

@ -0,0 +1,345 @@
-------------------------------------------------------------------
Tue May 2 08:03:30 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 1.2.0:
* completely overhauled "Libbpf overview" landing documentation
page;
* support for BPF link-based `struct_ops` programs:
* `SEC(".struct_ops.link")` annotations;
* `bpf_map__attach_struct_ops()` attach API;
* `bpf_link__update_map()` link update API;
* support sleepable `SEC("struct_ops.s")` programs
* improved thread-safety of libbpf print callbacks and
`libbpf_set_print()`
* improve handling and reporting of missing BPF kfuncs
* `bpf_{btf,link,map,prog}_get_info_by_fd()` APIs
* `bpf_xdp_query_opts()` supports fetching XDP/XSK supported
features;
* `perf_buffer__new()` allows customizing notification/sampling
period now;
* BPF verifier logging improvements:
* pass-through BPF verifier log level and flags to kernel as
is
* support `log_true_size` for getting required log buffer size
to fit BPF verifier log completely;
* allow precise control over kprobe/uprobe attach mode: legacy,
perf-based, link-based.
* fix legacy kprobe events names sanitization;
* fix clobbering errno in some cases;
* fix BPF map's `BPF_F_MMAPABLE` flag sanitization;
* fix BPF-side USDT support code on s390x architecture;
* fix `BPF_PROBE_READ{_STR}_INTO()` on s390x architecture;
* fix kernel version setting for Debian kernels;
* fix netlink protocol handling in some cases;
* improve robustness of attaching to legacy kprobes and
uprobes;
* fix double-free during static linking empty ELF sections;
* a bunch of other small fixes here and there.
-------------------------------------------------------------------
Thu Jan 5 07:02:19 UTC 2023 - Shung-Hsi Yu <shung-hsi.yu@suse.com>
- Remove requirement of linux-glibc-devel >= 5.16 for devel package
-------------------------------------------------------------------
Thu Dec 22 07:08:39 UTC 2022 - Dirk Müller <dmueller@suse.com>
- update to v1.1.0:
User space-side features and APIs:
* user-space ring buffer (BPF_MAP_TYPE_USER_RINGBUF) support;
* new documentation page listing all recognized SEC() definitions;
* BTF dedup improvements:
* unambiguous fwd declaration resolution for structs and unions;
* better handling of some corner cases with identical structs and arrays;
* mixed enum and enum64 forward declaration resolution logic;
* bpf_{link,btf,pro,mapg}_get_fd_by_id_opts() and bpf_get_fd_by_id_opts()
APIs;
* libbpf supports loading raw BTF for BPF CO-RE from known search paths;
* support for new cgroup local storage (BPF_MAP_TYPE_CGRP_STORAGE);
* libbpf will only add BPF_F_MMAPABLE flag for data maps with global
(i.e., non-static) vars;
* latest Linux UAPI headers with lots of changes synced into
include/uapi/linux.
BPF-side features and APIs;
* BPF_PROG2() macro added that supports struct-by-value arguments;
* new BPF helpers:
* bpf_user_ringbuf_drain();
* cgrp_storage_get() and cgrp_storage_delete().
Bug fixes
* better handling of padding corner cases;
* btf__align_of() determines packed structs better now;
* improved handling of enums of non-standard sizes;
* USDT spec parsing improvements;
* overflow handling fixes for ringbufs;
* Makefile fixes to support cross-compilation for 32-bit targets;
* fix crash if SEC("freplace") programs don't have attach_prog_fd set;
* better handling of file existence checks when running as non-root with
enhanced capabilities;
* a bunch of small fixes:
* ELF handling improvements;
* fix memory leak in USDT argument parsing logic;
* fix NULL dereferences in few corner cases;
* improved netlink attribute iteration handling.
- drop libbpf-Use-elf_getshdrnum-instead-of-e_shnum.patch,
libbpf-Fix-use-after-free-in-btf_dump_name_dups.patch,
libbpf-Fix-memory-leak-in-parse_usdt_arg.patch
libbpf-Fix-null-pointer-dereference-in-find_prog_by_.patch (upstream)
-------------------------------------------------------------------
Tue Nov 8 06:03:55 UTC 2022 - Shung-Hsi Yu <shung-hsi.yu@suse.com>
- Fix out-of-bound heap write (boo#1194248 boo#1194249 CVE-2021-45940 CVE-2021-45941)
+ libbpf-Use-elf_getshdrnum-instead-of-e_shnum.patch
- Fix use-after-free in btf_dump_name_dups (boo#1204391 CVE-2022-3534)
+ libbpf-Fix-use-after-free-in-btf_dump_name_dups.patch
- Fix memory leak in parse_usdt_arg() (boo#1204393 CVE-2022-3533)
+ libbpf-Fix-memory-leak-in-parse_usdt_arg.patch
- Fix null pointer dereference in find_prog_by_sec_insn() (boo#1204502 CVE-2022-3606)
+ libbpf-Fix-null-pointer-dereference-in-find_prog_by_.patch
-------------------------------------------------------------------
Tue Oct 4 17:22:08 UTC 2022 - Dirk Müller <dmueller@suse.com>
- update to 1.0.1:
* fix inadvertently changed struct bpf_object_open_opts memory layout;
* fix btf.h header relying on struct enum64 type defined in kernel UAPI headers;
* fix NULL pointer exception in API btf_dump__dump_type_data;
* remove struct btf_map_def accidentally left in bpf_helpers.h header.
* All deprecated APIs and features removed!
* support for syscall-specific kprobe/kretprobe
(SEC("ksyscall/<syscall_name>") and SEC("kretsyscall/<syscall_name>"));
* support for sleepable uprobe BPF programs (SEC("uprobe.s"));
* support for per-cgroup LSM BPF programs (SEC("lsm_cgroup"));
* support for new BPF CO-RE relocation TYPE_MATCHES;
* bpf_prog_load() and bpf_map_create() are now smarter about handling program
and map name on old kernels (it will be ignored if kernel doesn't support
names);
* BTF_KIND_ENUM64 support;
* increase tracing attachment (kprobe/uprobe/tracepoint) robustness by using
tracefs or debugfs, whichever is mounted;
* new APIs for converting BPF enums to their string representation:
* libbpf_bpf_prog_type_str();
* libbpf_bpf_map_type_str();
* libbpf_bpf_link_type_str();
* libbpf_bpf_attach_type_str();
* bpf_program__set_autoattach() and bpf_program__autoattach() to allow opting
out from auto-attaching of BPF program by BPF skeleton;
* perf_buffer__buffer() API to give access to underlying per-CPU buffer for BPF ringbuf;
* bpf_obj_get_opts() API for more flexible fetching of BPF kernel objects' information.
- see https://github.com/libbpf/libbpf/releases/tag/v1.0.0 for detailed changelog
-------------------------------------------------------------------
Wed Aug 3 13:55:13 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- Update to release 0.8.1:
* make shared xsk creation network namespace aware
-------------------------------------------------------------------
Thu May 19 03:00:36 UTC 2022 - Shung-Hsi Yu <shung-hsi.yu@suse.com>
- Update to release 0.8.0
* New features and APIs:
- support auto-resolution of binaries and shared libraries from PATH, if necessary;
- support attaching by function names (only by IP was supported before);
- support attaching to USDTs (SEC("usdt/...") and
bpf_program__attach_usdt()) with initially supported architectures:
x86-64 (amd64); x86 (i386); s390x; ARM64 (aarch64); RISC V (riscv);
- improved BPF verifier log reporting for CO-RE relocation failures (no
more obscure "invalid func unknown#195896080" errors);
- auto-adjust BPF ringbuf size according to host kernel's page size requirements;
- high-level BPF map APIs: bpf_map__lookup_elem(), bpf_map__update_elem(),
etc that validate key/value buffer sizes;
- bpf_link_create() can create all bpf_link-based (including raw_tp,
fentry/fexit, etc), falling back to bpf_raw_tracepoint_open() on old
kernels transparently;
- support opting out from auto-loading BPF programs declaratively with
SEC("?...");
- support opting out from auto-creation of declarative BPF maps with
bpf_map__set_autocreate();
- support multi-kprobes (SEC("kprobe.multi/...") and
bpf_program__attach_kprobe_multi_opts());
- support target-less SEC() programs (e.g., SEC("kprobe"), SEC("tp"), etc);
- support BPF sub-skeletons for "incomplete" BPF object files (requires
matching bpftool to generate .subskel.h);
- BPF cookie support for fentry/fexit/fmod_ret BPF programs
(bpf_program__attach_trace_opts());
- support for custom SEC() handlers (libbpf_register_prog_handler()).
* BPF-side API
- BPF-side USDT APIs. See new usdt.bpf.h header:
* BPF_USDT() program wrapper macro; bpf_usdt_arg(), bpf_usdt_arg_cnt(),
* bpf_usdt_cookie() helpers;
- new bpf_core_field_offset() CO-RE helper and support
bpf_core_field_size(type, field) forms;
- barrier() and barrier_var() macros for improving BPF code generation;
- __kptr and __kptr_ref tags added;
- ARC architecture support in bpf_tracing.h header;
- new BPF helpers:
* bpf_skb_set_tstamp();
* bpf_ima_file_hash();
* bpf_kptr_xchg();
* bpf_map_lookup_percpu_elem().
* Bug fixes
- netlink bug fixes;
- libbpf.pc fixes to support patch releases properly;
- BPF_MAP_TYPE_PERF_EVENT_ARRAY map auto-pinning fix;
- minor CO-RE fixes and improvements for some corner cases;
- various other small fixes and improvements.
-------------------------------------------------------------------
Thu Mar 10 18:28:17 UTC 2022 - Jeff Mahoney <jeffm@suse.com>
- Enable building and packaging of static library.
Explicitly enable fat LTO objects.
-------------------------------------------------------------------
Mon Mar 7 11:52:14 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
- Python is not used during build; remove it and help break
a cycle.
-------------------------------------------------------------------
Fri Mar 4 10:18:54 UTC 2022 - Jan Engelhardt <jengelh@inai.de>
- Update to release 0.7.0
* legacy BPF map definitions (using struct bpf_map_def) are
deprecated when LIBBPF_STRICT_MAP_DEFINITIONS is passed to
libbpf_set_strict_mode(). Please use BTF-defined map
definitions.
* ability to control and capture BPF verifier log output on
per-object and per-program level
* CO-RE support and other improvements for "light skeleton"
* improved compilation when system BTF UAPI headers are outdated
-------------------------------------------------------------------
Sat Dec 11 10:37:27 UTC 2021 - Jan Engelhardt <jengelh@inai.de>
- Update to release 0.6.1
* Introduce legacy kprobe events support
* Add legacy uprobe attaching support
* Support uniform BTF-defined key/value specification across
all BPF maps
* Support kernel module function calls
* Support detecting and attaching of writable tracepoint
program
* Add bloom filter map implementation
* Add typeless and weak ksym support to gen_loader
* Add RISC-V (RV64) support to bpf_tracing.h
* Deprecate AF_XDP support
* Support BTF_KIND_TYPE_TAG
-------------------------------------------------------------------
Mon Sep 27 11:02:49 UTC 2021 - Shung-Hsi Yu <shung-hsi.yu@suse.com>
- Update to 0.5.0:
+ New features and user-space APIs:
- libbpf_set_strict_mode() allowing to opt-in into backwards incompatible libbpf-1.0 changes. See "Libbpf: the road to 1.0" and "Libbpf 1.0 migration guide" for more details.
- streamlined error reporting for low-level APIs, high-level error-returning APIs, and pointer-returning APIs (as a libbpf-1.0 opt-in);
- "Light" BPF skeleton support;
- BPF_PROG_TYPE_SYSCALL support;
- BPF perf link support for kprobe, uprobe, tracepoint, and perf_event BPF programs;
- BPF cookie support for kprobe, uprobe, tracepoint, and perf_event BPF programs through bpf_program__attach_[ku]probe_opts() APIs;
- allow to specify ref_ctr_off for USDT semaphores through bpf_program__attach_uprobe_opts() API;
- btf_custom_path support in bpf_object_open_opts, allowing to specify custom BTF for CO-RE relocations;
- sk_reuseport/migrate program type support;
- btf_dump__dump_type_data() API, allowing to dump binary data according to BTF type description;
- btf__load_into_kernel() and btf__load_from_kernel_by_id(), and split BTF variants of them;
- btf__load_vmlinux_btf() and btf__load_module_btf() APIs;
- bpf_map__initial_value() API to get initial value of mmap-ed BPF maps;
- bpf_map_lookup_and_delete_elem_flags() API.
+ BPF-side APIs and features:
- support for weak typed __ksym externs;
- BPF timer helpers: bpf_timer_init(), bpf_timer_set_callback(), bpf_timer_start(), bpf_timer_cancel();
- bpf_get_attach_cookie() helper to get BPF cookie from BPF program side;
- bpf_get_func_ip() helper;
- bpf_sys_bpf() helper;
- bpf_task_pt_regs() helper;
- bpf_btf_find_by_name_kind() helper;
- usability improvements for bpf_tracing.h when target architecture is missing.
+ Bug fixes and compatibility improvements:
- improve BPF support detection on old Red Hat kernels with backported BPF patches;
- improvements for LTO builds with GCC 10+;
- pass NLM_F_EXCL when creating TC qdisc;
- better support of BPF map reuse on old kernels;
- fix the bug resulting in sometimes closing FD 0, which wasn't created and owned by libbpf itself.
- Remove patches merged upstream
+ libdir.patch
+ libbpf-Fix-build-with-latest-gcc-binutils-with-LTO.patch
-------------------------------------------------------------------
Fri Aug 27 06:20:53 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Fix LTO build (bsc#1188749).
+ libbpf-Fix-build-with-latest-gcc-binutils-with-LTO.patch
-------------------------------------------------------------------
Fri Aug 20 08:47:47 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- Depend on new enough Linux headers.
-------------------------------------------------------------------
Mon Aug 2 11:00:28 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Create libbpf0-32bit needed by libdwarves1-32bit
-------------------------------------------------------------------
Sat Jul 17 15:38:52 UTC 2021 - Michal Suchanek <msuchanek@suse.com>
- libbpf is now a separate project, stop building from the kernel
(bsc#1188419 jsc#SLE-17288 jsc#SLE-18805).
- Fix LIBSUBDIR
+ libdir.patch
-------------------------------------------------------------------
Mon Jun 8 23:52:39 UTC 2020 - Michał Rostecki <mrostecki@suse.com>
- Add python3 as a build dependency.
-------------------------------------------------------------------
Sun Feb 2 19:50:55 UTC 2020 - Michał Rostecki <mrostecki@opensuse.org>
- Build libbpf from kernel sources, not from github sources, for
consistency with bpftool package.
-------------------------------------------------------------------
Tue Jan 7 14:36:44 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Reflect SUSE CFLAGS
- Do not bother with obscpio if we are fetching direct releases
- Remove patch 0001-makefile-Fix-install-target.patch seems
to build/install without it just fine
- Update to 0.0.6:
+ New features
- new extensible bpf_object__open_{file,mem} APIs and
DECLARE_LIBBPF_OPTS() macro to go with them
- bpf_helpers.h, bpf_endian.h, and bpf_tracing.h are now
distributed with libbpf
- BPF CO-RE: added field size, field existence, and bitfield
relocation support
- BPF CO-RE: BPF_CORE_READ(), bpf_core_field_exists(),
bpf_core_field_size() and other BPF CO-RE related helpers
available through bpf_core_read.h header
- bpf_object__open() API now auto-detects program type from
its section name
- BPF_PROG_TRACING programs support (incuding BTF-typed raw
tracepoints, fentry/fexit programs)
- mmap() support for BPF global variables
- declarative map pinning support added
- probe_read_{user,kernel}[_str]() BPF helpers added
- bpf_get_link_xdp_info() function to get more XDP information
added
- a bunch of other AF_XDP changes
+ Usability improvements
- no need for int version SEC('version') = 1; anymore
- raw_tp/tp and uprobe/uretprobe section prefixes added
- new bpf_program__get_{type,expected_attach_type} getters
- preserve error code on program load failure
+ Fixes
- btf_dump padding handling
- bpf_object__name() returning name, not path
- ELF section handling off-by-one bug fix
- mem leak/double free fix in BPF program relocation code
-------------------------------------------------------------------
Tue Oct 1 09:15:18 UTC 2019 - Michał Rostecki <mrostecki@opensuse.org>
- Initial release

85
libbpf.spec Normal file
View File

@ -0,0 +1,85 @@
#
# spec file for package libbpf
#
# Copyright (c) 2023 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/
#
%define sover_major 1
%define libname libbpf%{sover_major}
Name: libbpf
Version: 1.2.0
Release: 0
Summary: C library for managing eBPF programs and maps
License: LGPL-2.1-only
URL: https://github.com/libbpf/libbpf
Source: https://github.com/libbpf/libbpf/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source99: baselibs.conf
BuildRequires: libelf-devel
BuildRequires: linux-glibc-devel >= 4.5
BuildRequires: zlib-devel
%description
libbpf is a C library which provides API for managing eBPF programs and maps.
%package -n %{libname}
Summary: C library for managing eBPF programs and maps
%description -n %{libname}
libbpf is a C library which provides API for managing eBPF programs and maps.
%package devel
Summary: Development files for libbpf
Requires: %{libname} = %{version}
%description devel
libbpf is a C library which provides API for managing eBPF programs and maps.
%package devel-static
Summary: Static library for libbpf
Requires: %{libname} = %{version}
Requires: %{name}-devel = %{version}
%description devel-static
libbpf is a C library which provides API for managing eBPF programs and maps.
%prep
%autosetup -p1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
cd src
%make_build V=1 CFLAGS="%{optflags}"
%install
cd src
%make_install V=1
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname}
%{_libdir}/%{name}.so.%{sover_major}*
%files devel
%license LICENSE LICENSE.BSD-2-Clause LICENSE.LGPL-2.1
%doc README.md
%{_includedir}/bpf
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%files devel-static
%{_libdir}/%{name}.a
%changelog