Rebuild for libbpf 0.6.0

This is needed to build bpf-ksnoop. We can also remove a few revert we
needed to build on libbpf-0.5.0.

Related: rhbz#2010428
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
Jerome Marchand 2022-07-01 12:55:57 +02:00
parent 222ec7a9d9
commit b6f327fcd1
3 changed files with 17 additions and 42 deletions

View File

@ -1,4 +1,4 @@
From fcd43bfd82e52450c0beae0e0e87d39822366d32 Mon Sep 17 00:00:00 2001
From a81f219d7f2bfc70dba1eb12208e3e6ab7c81b50 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Thu, 24 Mar 2022 16:08:17 +0100
Subject: [PATCH] C9S: libpbf version fixes
@ -9,17 +9,12 @@ provided in C9S doesn't provide the new APIs.
Remove BPF_MAP_TYPE_BLOOM_FILTER from bps since the libbpf version in
C9S, doesn't provide bloom filter map.
Rename btf__load_vmlinux_btf into libbpf_find_kernel_btf. The function
has been renamed upstream for naming consistency, but C9S libbpf still
uses the old name.
Add definition of struct bpf_core_relo.
---
introspection/bps.c | 1 -
libbpf-tools/ksnoop.c | 2 +-
src/cc/bcc_btf.cc | 73 ++++++++++++++++++++++++++++++++++++-
src/cc/libbpf.c | 84 +++++++------------------------------------
4 files changed, 85 insertions(+), 75 deletions(-)
src/cc/bcc_btf.cc | 73 +++++++++++++++++++++++++++++++++++++++-
src/cc/libbpf.c | 82 ++++++---------------------------------------
3 files changed, 83 insertions(+), 73 deletions(-)
diff --git a/introspection/bps.c b/introspection/bps.c
index 232b23d4..6ec02e6c 100644
@ -33,19 +28,6 @@ index 232b23d4..6ec02e6c 100644
};
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
diff --git a/libbpf-tools/ksnoop.c b/libbpf-tools/ksnoop.c
index 69c58403..a6ea6107 100644
--- a/libbpf-tools/ksnoop.c
+++ b/libbpf-tools/ksnoop.c
@@ -347,7 +347,7 @@ static struct btf *get_btf(const char *name)
name && strlen(name) > 0 ? name : "vmlinux");
if (!vmlinux_btf) {
- vmlinux_btf = btf__load_vmlinux_btf();
+ vmlinux_btf = libbpf_find_kernel_btf();
if (!vmlinux_btf) {
err = -errno;
p_err("No BTF, cannot determine type info: %s", strerror(-err));
diff --git a/src/cc/bcc_btf.cc b/src/cc/bcc_btf.cc
index 7f551ae8..c78ba823 100644
--- a/src/cc/bcc_btf.cc
@ -138,7 +120,7 @@ index 7f551ae8..c78ba823 100644
warning("Loading .BTF section failed\n");
return -1;
diff --git a/src/cc/libbpf.c b/src/cc/libbpf.c
index e6403299..7410ae1a 100644
index e6403299..68af4b35 100644
--- a/src/cc/libbpf.c
+++ b/src/cc/libbpf.c
@@ -297,25 +297,6 @@ static uint64_t ptr_to_u64(void *ptr)
@ -310,15 +292,6 @@ index e6403299..7410ae1a 100644
if (ret < 0 && errno == ENOSPC) {
// Temporary buffer size is not enough. Double it and try again.
free(tmp_log_buf);
@@ -1369,7 +1309,7 @@ int kernel_struct_has_field(const char *struct_name, const char *field_name)
struct btf *btf;
int i, ret, btf_id;
- btf = btf__load_vmlinux_btf();
+ btf = libbpf_find_kernel_btf();
ret = libbpf_get_error(btf);
if (ret)
return -1;
--
2.35.1
2.36.1

View File

@ -1442,7 +1442,7 @@ index a6ea6107..a5f59a0f 100644
name && strlen(name) > 0 ? name : "vmlinux");
if (!vmlinux_btf) {
vmlinux_btf = libbpf_find_kernel_btf();
vmlinux_btf = btf__load_vmlinux_btf();
- if (!vmlinux_btf) {
- err = -errno;
- p_err("No BTF, cannot determine type info: %s", strerror(-err));

View File

@ -25,7 +25,7 @@
Name: bcc
Version: 0.24.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: BPF Compiler Collection (BCC)
License: ASL 2.0
URL: https://github.com/iovisor/bcc
@ -35,10 +35,9 @@ Patch1: %{name}-%{version}-biolatpcts-Build-fixes-on-recent-kernels.patc
Patch2: %{name}-%{version}-tools-include-blk-mq.h-in-bio-tools.patch
Patch3: %{name}-%{version}-C9S-libpbf-version-fixes.patch
Patch4: %{name}-%{version}-Revert-libbpf-1.0-changes.patch
Patch5: %{name}-%{version}-C9S-remove-ksnoop.patch
Patch6: %{name}-%{version}-C9S-Fix-mdflush.patch
Patch7: %{name}-%{version}-biolatency-biolatpcts-biosnoop-biotop-Build-fix-for-.patch
Patch8: %{name}-%{version}-libbpf-tools-Fix-dropped-request-rq_disk-for-kernel-.patch
Patch5: %{name}-%{version}-C9S-Fix-mdflush.patch
Patch6: %{name}-%{version}-biolatency-biolatpcts-biosnoop-biotop-Build-fix-for-.patch
Patch7: %{name}-%{version}-libbpf-tools-Fix-dropped-request-rq_disk-for-kernel-.patch
# Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches
@ -60,9 +59,9 @@ BuildRequires: ncurses-devel
%if %{with lua}
BuildRequires: pkgconfig(luajit)
%endif
BuildRequires: libbpf-devel >= 0.5.0, libbpf-static >= 0.5.0
BuildRequires: libbpf-devel >= 0.6.0, libbpf-static >= 0.6.0
Requires: libbpf >= 0.5.0
Requires: libbpf >= 0.6.0
Requires: tar
Recommends: kernel-devel
@ -262,6 +261,9 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
%endif
%changelog
* Fri Jul 01 2022 Jerome Marchand <jmarchan@redhat.com> - 0.24.1-3
- Rebuild for libbpf 0.6.0
* Wed May 18 2022 Jerome Marchand <jmarchan@redhat.com> - 0.24.1-2
- Rebuild (previous build failed with UNKNOWN_KOJI_ERROR)