Rebase bcc to version 0.32.0
Rebase bcc to the lastest version. Resolves: RHEL-63886 Resolves: RHEL-50531 Resolves: RHEL-58345 Resolves: RHEL-58346 Resolves: RHEL-58803 Resolves: RHEL-58804 Resolves: RHEL-58806 Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
parent
2f8bef29f5
commit
b96c3a1568
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,3 +23,4 @@
|
||||
/bcc-0.28.0.tar.gz
|
||||
/bcc-0.29.1.tar.gz
|
||||
/bcc-0.30.0.tar.gz
|
||||
/bcc-0.32.0.tar.gz
|
||||
|
@ -1,116 +0,0 @@
|
||||
From 28a3b307bb3f11b72a6bd3f9313d7725bdf0d7ac Mon Sep 17 00:00:00 2001
|
||||
From: Rong Tao <rongtao@cestc.cn>
|
||||
Date: Sun, 19 May 2024 13:15:03 +0800
|
||||
Subject: [PATCH] Fix: startswith() is deprecated: Use starts_with instead
|
||||
(#5002)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
llvm [0] startswith() is deprecated in commit 5ac12951b4e9 ("[ADT] Deprecate
|
||||
StringRef::{starts,ends}with (#75491)"), and it's totally removed in
|
||||
commit 4ec9a662d388 ("[ADT] Remove StringRef::{startswith,endswith} (#89548)").
|
||||
|
||||
Warning detail:
|
||||
|
||||
$ make
|
||||
[...]
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:341:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||
341 | if (!A->getName().startswith("maps"))
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||
In file included from /usr/include/clang/Basic/DiagnosticIDs.h:19,
|
||||
from /usr/include/clang/Basic/Diagnostic.h:17,
|
||||
from /usr/include/clang/AST/NestedNameSpecifier.h:18,
|
||||
from /usr/include/clang/AST/Type.h:21,
|
||||
from /usr/include/clang/AST/CanonicalType.h:17,
|
||||
from /usr/include/clang/AST/ASTContext.h:18,
|
||||
from /home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:23:
|
||||
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||
| ^~~~~~~~~~
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::ProbeVisitor::assignsExtPtr(clang::Expr*, int*)’:
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:393:39: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||
393 | if (!A->getName().startswith("maps"))
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||
| ^~~~~~~~~~
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitCallExpr(clang::CallExpr*)’:
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:940:37: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||
940 | if (!A->getName().startswith("maps"))
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||
| ^~~~~~~~~~
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitVarDecl(clang::VarDecl*)’:
|
||||
/home/rongtao/Git/iovisor/bcc/src/cc/frontends/clang/b_frontend_action.cc:1458:33: warning: ‘bool llvm::StringRef::startswith(llvm::StringRef) const’ is deprecated: Use starts_with instead [-Wdeprecated-declarations]
|
||||
1458 | if (!A->getName().startswith("maps"))
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
||||
/usr/include/llvm/ADT/StringRef.h:263:29: note: declared here
|
||||
263 | "starts_with") bool startswith(StringRef Prefix) const {
|
||||
| ^~~~~~~~~~
|
||||
[ 73%] Built target clang_frontend-objects
|
||||
|
||||
[0] https://github.com/llvm/llvm-project
|
||||
|
||||
Signed-off-by: Xue Yuehua <2482887395@qq.com>
|
||||
Signed-off-by: Rong Tao <rongtao@cestc.cn>
|
||||
---
|
||||
src/cc/frontends/clang/b_frontend_action.cc | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/src/cc/frontends/clang/b_frontend_action.cc b/src/cc/frontends/clang/b_frontend_action.cc
|
||||
index 10d64fdc..95cec3cb 100644
|
||||
--- a/src/cc/frontends/clang/b_frontend_action.cc
|
||||
+++ b/src/cc/frontends/clang/b_frontend_action.cc
|
||||
@@ -338,7 +338,11 @@ bool MapVisitor::VisitCallExpr(CallExpr *Call) {
|
||||
StringRef memb_name = Memb->getMemberDecl()->getName();
|
||||
if (DeclRefExpr *Ref = dyn_cast<DeclRefExpr>(Memb->getBase())) {
|
||||
if (SectionAttr *A = Ref->getDecl()->getAttr<SectionAttr>()) {
|
||||
+#if LLVM_VERSION_MAJOR < 18
|
||||
if (!A->getName().startswith("maps"))
|
||||
+#else
|
||||
+ if (!A->getName().starts_with("maps"))
|
||||
+#endif
|
||||
return true;
|
||||
|
||||
if (memb_name == "update" || memb_name == "insert") {
|
||||
@@ -390,7 +394,11 @@ bool ProbeVisitor::assignsExtPtr(Expr *E, int *nbDerefs) {
|
||||
StringRef memb_name = Memb->getMemberDecl()->getName();
|
||||
if (DeclRefExpr *Ref = dyn_cast<DeclRefExpr>(Memb->getBase())) {
|
||||
if (SectionAttr *A = Ref->getDecl()->getAttr<SectionAttr>()) {
|
||||
+#if LLVM_VERSION_MAJOR < 18
|
||||
if (!A->getName().startswith("maps"))
|
||||
+#else
|
||||
+ if (!A->getName().starts_with("maps"))
|
||||
+#endif
|
||||
return false;
|
||||
|
||||
if (memb_name == "lookup" || memb_name == "lookup_or_init" ||
|
||||
@@ -937,7 +945,11 @@ bool BTypeVisitor::VisitCallExpr(CallExpr *Call) {
|
||||
StringRef memb_name = Memb->getMemberDecl()->getName();
|
||||
if (DeclRefExpr *Ref = dyn_cast<DeclRefExpr>(Memb->getBase())) {
|
||||
if (SectionAttr *A = Ref->getDecl()->getAttr<SectionAttr>()) {
|
||||
+#if LLVM_VERSION_MAJOR < 18
|
||||
if (!A->getName().startswith("maps"))
|
||||
+#else
|
||||
+ if (!A->getName().starts_with("maps"))
|
||||
+#endif
|
||||
return true;
|
||||
|
||||
string args = rewriter_.getRewrittenText(expansionRange(SourceRange(GET_BEGINLOC(Call->getArg(0)),
|
||||
@@ -1455,7 +1467,11 @@ int64_t BTypeVisitor::getFieldValue(VarDecl *Decl, FieldDecl *FDecl, int64_t Ori
|
||||
bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
|
||||
const RecordType *R = Decl->getType()->getAs<RecordType>();
|
||||
if (SectionAttr *A = Decl->getAttr<SectionAttr>()) {
|
||||
+#if LLVM_VERSION_MAJOR < 18
|
||||
if (!A->getName().startswith("maps"))
|
||||
+#else
|
||||
+ if (!A->getName().starts_with("maps"))
|
||||
+#endif
|
||||
return true;
|
||||
if (!R) {
|
||||
error(GET_ENDLOC(Decl), "invalid type for bpf_table, expect struct");
|
||||
--
|
||||
2.47.0
|
||||
|
@ -1,76 +0,0 @@
|
||||
From 32a47d9002269b391c0c7ff76aeb2c015deb4b59 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Fri, 17 May 2024 15:36:07 +0200
|
||||
Subject: [PATCH] clang: fail when the kheaders ownership is wrong (#4928)
|
||||
(#4985)
|
||||
|
||||
file_exists_and_ownedby() returns -1 when the file exists but its
|
||||
ownership is unexpected, which is very misleading since anything non
|
||||
zero is interpreted as true and a function with such a name is
|
||||
expected to return a boolean. So currently all this does, is write a
|
||||
warning message, and continues as if nothing is wrong.
|
||||
|
||||
Make file_exists_and_ownedby() returns false when the ownership is
|
||||
wrong and have get_proc_kheaders() fails when this happen. Also have
|
||||
all the *exists* functions return bool to avoid such issues in the
|
||||
future.
|
||||
|
||||
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||||
---
|
||||
src/cc/frontends/clang/kbuild_helper.cc | 22 +++++++++++++++++-----
|
||||
1 file changed, 17 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
|
||||
index 9409e4cc..5d3ad9c2 100644
|
||||
--- a/src/cc/frontends/clang/kbuild_helper.cc
|
||||
+++ b/src/cc/frontends/clang/kbuild_helper.cc
|
||||
@@ -140,20 +140,26 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static inline int file_exists_and_ownedby(const char *f, uid_t uid)
|
||||
+static inline bool file_exists(const char *f)
|
||||
+{
|
||||
+ struct stat buffer;
|
||||
+ return (stat(f, &buffer) == 0);
|
||||
+}
|
||||
+
|
||||
+static inline bool file_exists_and_ownedby(const char *f, uid_t uid)
|
||||
{
|
||||
struct stat buffer;
|
||||
int ret = stat(f, &buffer) == 0;
|
||||
if (ret) {
|
||||
if (buffer.st_uid != uid) {
|
||||
std::cout << "ERROR: header file ownership unexpected: " << std::string(f) << "\n";
|
||||
- return -1;
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static inline int proc_kheaders_exists(void)
|
||||
+static inline bool proc_kheaders_exists(void)
|
||||
{
|
||||
return file_exists_and_ownedby(PROC_KHEADERS_PATH, 0);
|
||||
}
|
||||
@@ -231,8 +237,14 @@ int get_proc_kheaders(std::string &dirpath)
|
||||
uname_data.release);
|
||||
dirpath = std::string(dirpath_tmp);
|
||||
|
||||
- if (file_exists_and_ownedby(dirpath_tmp, 0))
|
||||
- return 0;
|
||||
+ if (file_exists(dirpath_tmp)) {
|
||||
+ if (file_exists_and_ownedby(dirpath_tmp, 0))
|
||||
+ return 0;
|
||||
+ else
|
||||
+ // The path exists, but is owned by a non-root user
|
||||
+ // Something fishy is going on
|
||||
+ return -EEXIST;
|
||||
+ }
|
||||
|
||||
// First time so extract it
|
||||
return extract_kheaders(dirpath, uname_data);
|
||||
--
|
||||
2.44.0
|
||||
|
@ -0,0 +1,61 @@
|
||||
From 8a9da1d866dfb69ad1ca59bdc50a799ba2da3a0c Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Thu, 24 Oct 2024 16:56:14 +0200
|
||||
Subject: [PATCH] RHEL/Centos: tools: fix alignment in tp_args for bio tools
|
||||
|
||||
The padding in tp_args is wrong on RHEL 9 / c9s kernel because of the
|
||||
kernel commit 6bc27040eb90 ("sched: Add support for lazy preemption")
|
||||
which added a common field to tracepoints.
|
||||
|
||||
Now the dev field is at an offset of 12 bytes as shown by
|
||||
block_io_start/done format file.
|
||||
|
||||
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||||
---
|
||||
tools/biolatency.py | 2 +-
|
||||
tools/biosnoop.py | 2 +-
|
||||
tools/biotop.py | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/biolatency.py b/tools/biolatency.py
|
||||
index 03b48a4c..ac150ea2 100755
|
||||
--- a/tools/biolatency.py
|
||||
+++ b/tools/biolatency.py
|
||||
@@ -88,7 +88,7 @@ typedef struct ext_val {
|
||||
} ext_val_t;
|
||||
|
||||
struct tp_args {
|
||||
- u64 __unused__;
|
||||
+ u32 __unused__[3];
|
||||
dev_t dev;
|
||||
sector_t sector;
|
||||
unsigned int nr_sector;
|
||||
diff --git a/tools/biosnoop.py b/tools/biosnoop.py
|
||||
index f0fef98b..819e953f 100755
|
||||
--- a/tools/biosnoop.py
|
||||
+++ b/tools/biosnoop.py
|
||||
@@ -66,7 +66,7 @@ struct val_t {
|
||||
};
|
||||
|
||||
struct tp_args {
|
||||
- u64 __unused__;
|
||||
+ u32 __unused__[3];
|
||||
dev_t dev;
|
||||
sector_t sector;
|
||||
unsigned int nr_sector;
|
||||
diff --git a/tools/biotop.py b/tools/biotop.py
|
||||
index 879c6b8f..4c3a1c9a 100755
|
||||
--- a/tools/biotop.py
|
||||
+++ b/tools/biotop.py
|
||||
@@ -91,7 +91,7 @@ struct val_t {
|
||||
};
|
||||
|
||||
struct tp_args {
|
||||
- u64 __unused__;
|
||||
+ u32 __unused__[3];
|
||||
dev_t dev;
|
||||
sector_t sector;
|
||||
unsigned int nr_sector;
|
||||
--
|
||||
2.47.0
|
||||
|
12
bcc.spec
12
bcc.spec
@ -24,15 +24,14 @@
|
||||
|
||||
|
||||
Name: bcc
|
||||
Version: 0.30.0
|
||||
Release: 6%{?dist}
|
||||
Version: 0.32.0
|
||||
Release: 1%{?dist}
|
||||
Summary: BPF Compiler Collection (BCC)
|
||||
License: Apache-2.0
|
||||
URL: https://github.com/iovisor/bcc
|
||||
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: %%{name}-%%{version}-clang-fail-when-the-kheaders-ownership-is-wrong-4928.patch
|
||||
Patch1: %%{name}-%%{version}-Revert-Fix-bashreadline-4903.patch
|
||||
Patch2: %%{name}-%%{version}-Fix-startswith-is-deprecated-Use-starts_with-instead.patch
|
||||
Patch0: %%{name}-%%{version}-Revert-Fix-bashreadline-4903.patch
|
||||
Patch1: %%{name}-%%{version}-RHEL-Centos-tools-fix-alignment-in-tp_args-for-bio-t.patch
|
||||
|
||||
# Arches will be included as upstream support is added and dependencies are
|
||||
# satisfied in the respective arches
|
||||
@ -263,6 +262,9 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Jan 14 2025 Jerome Marchand <jmarchan@redhat.com> - 0.32.0-1
|
||||
- Rebase to the latest version (RHEL-63886)
|
||||
|
||||
* Wed Nov 06 2024 Jerome Marchand <jmarchan@redhat.com> - 0.30.0-6
|
||||
- Fix gating tests of libbpf gating.
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (bcc-0.30.0.tar.gz) = 70478ca8c18e7f106c462513ca9af46f49b4ebcca6380a9393208fca88f83895a7396f918bf5d01dce1bc4a876bccb9b95aa56d426e55d384cf11c9baaa6a89b
|
||||
SHA512 (bcc-0.32.0.tar.gz) = 3612580976f9c91a52c49bc83abdbaccc9a066c30a7f178997cb91910307e48743d831ec028e0099e776250770b55e8fc8c937bcc9b1e36fbec88370376d1df4
|
||||
|
Loading…
Reference in New Issue
Block a user