Reinstate function needed by bpftrace-0.10

bpftrace still relies on `bpf_detach_kfunc` which was removed in
bcc-0.15.0. It doesn't do anything, so there is no harm on adding it
back until bpftrace is updated.

Signed-off-by: Rafael dos Santos <rdossant@redhat.com>
This commit is contained in:
Rafael dos Santos 2020-07-02 10:56:00 +02:00
parent 2fbe0999a1
commit b7e33d2e55
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 0b9a7f0de847d945bc5dd83961136e04d6c890ec Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Wed, 1 Jul 2020 17:52:51 +0200
Subject: [PATCH] Reinstate bpf_detach_kfunc
It doesn't do anything, but bpftrace still calls it.
---
src/cc/libbpf.c | 7 +++++++
src/cc/libbpf.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/src/cc/libbpf.c b/src/cc/libbpf.c
index 010d1222..4c43218f 100644
--- a/src/cc/libbpf.c
+++ b/src/cc/libbpf.c
@@ -1186,6 +1186,13 @@ bool bpf_has_kernel_btf(void)
return libbpf_find_vmlinux_btf_id("bpf_prog_put", 0) > 0;
}
+int bpf_detach_kfunc(int prog_fd, char *func)
+{
+ UNUSED(prog_fd);
+ UNUSED(func);
+ return 0;
+}
+
int bpf_attach_kfunc(int prog_fd)
{
int ret;
diff --git a/src/cc/libbpf.h b/src/cc/libbpf.h
index 61471b5b..bcae5c99 100644
--- a/src/cc/libbpf.h
+++ b/src/cc/libbpf.h
@@ -94,6 +94,8 @@ int bpf_detach_tracepoint(const char *tp_category, const char *tp_name);
int bpf_attach_raw_tracepoint(int progfd, const char *tp_name);
+ int bpf_detach_kfunc(int prog_fd, char *func);
+
int bpf_attach_kfunc(int prog_fd);
int bpf_attach_lsm(int prog_fd);
--
2.25.4

View File

@ -9,7 +9,7 @@
Name: bcc
Version: 0.15.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: BPF Compiler Collection (BCC)
License: ASL 2.0
URL: https://github.com/iovisor/bcc
@ -17,6 +17,8 @@ URL: https://github.com/iovisor/bcc
Source0: %{url}/releases/download/v%{version}/%{name}-src-with-submodule.tar.gz
#Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: %{name}-%{version}-Reinstate-bpf_detach_kfunc.patch
# Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches
ExclusiveArch: x86_64 %{power64} aarch64 s390x
@ -179,6 +181,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/
%changelog
* Thu Jul 02 2020 Rafael dos Santos <rdossant@redhat.com> - 0.15.0-2
- Reinstate a function needed by bpftrace
* Tue Jun 23 2020 Rafael dos Santos <rdossant@redhat.com> - 0.15.0-1
- Rebase to latest upstream version (#1849239)