import CS bpftrace-0.24.2-1.el9

This commit is contained in:
AlmaLinux RelEng Bot 2026-03-30 10:17:37 -04:00
parent 20c5f4f566
commit ceca36e6c4
6 changed files with 45 additions and 247 deletions

View File

@ -1,2 +1,2 @@
4bfacb409e45f78d6882178f430bafab25f3b870 SOURCES/bpftrace-0.23.5.tar.gz
a6cf21b918b3cbf56af88abdc4b5e5777f14b6ac SOURCES/bpftrace-0.24.2.tar.gz
974ee680e1eb103c415832d69742e194b661da5c SOURCES/cereal-1.3.2.tar.gz

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/bpftrace-0.23.5.tar.gz
SOURCES/bpftrace-0.24.2.tar.gz
SOURCES/cereal-1.3.2.tar.gz

View File

@ -1,207 +0,0 @@
From 8c587382b686a776178e7fc105f3b5468cab360f Mon Sep 17 00:00:00 2001
From: Thierry Treyer <ttreyer@meta.com>
Date: Fri, 11 Apr 2025 09:04:29 -0700
Subject: [PATCH] Remove 'cstring_view'
The `cstring_view` class was a `std::string_view` with the added
guarantee that it is NULL-terminated. It was only used by BpfMap.
This commit replaces it by a `std::string`
Fixes: #4001
Signed-off-by: Thierry Treyer <ttreyer@meta.com>
---
src/bpfmap.cpp | 2 +-
src/bpfmap.h | 10 +++---
src/container/cstring_view.h | 39 -----------------------
tests/CMakeLists.txt | 1 -
tests/cstring_view.cpp | 60 ------------------------------------
5 files changed, 5 insertions(+), 107 deletions(-)
delete mode 100644 src/container/cstring_view.h
delete mode 100644 tests/cstring_view.cpp
diff --git a/src/bpfmap.cpp b/src/bpfmap.cpp
index 9464e8ed..eb65621e 100644
--- a/src/bpfmap.cpp
+++ b/src/bpfmap.cpp
@@ -12,7 +12,7 @@ libbpf::bpf_map_type BpfMap::type() const
return type_;
}
-cstring_view BpfMap::bpf_name() const
+const std::string &BpfMap::bpf_name() const
{
return name_;
}
diff --git a/src/bpfmap.h b/src/bpfmap.h
index 09153764..d48763ed 100644
--- a/src/bpfmap.h
+++ b/src/bpfmap.h
@@ -11,8 +11,6 @@ namespace libbpf {
#include "libbpf/bpf.h"
} // namespace libbpf
-#include "container/cstring_view.h"
-
namespace bpftrace {
class BpfMap {
@@ -28,12 +26,12 @@ public:
}
BpfMap(libbpf::bpf_map_type type,
- cstring_view name,
+ std::string name,
uint32_t key_size,
uint32_t value_size,
uint32_t max_entries)
: type_(type),
- name_(name),
+ name_(std::move(name)),
key_size_(key_size),
value_size_(value_size),
max_entries_(max_entries)
@@ -42,7 +40,7 @@ public:
int fd() const;
libbpf::bpf_map_type type() const;
- cstring_view bpf_name() const;
+ const std::string &bpf_name() const;
std::string name() const;
uint32_t key_size() const;
uint32_t value_size() const;
@@ -56,7 +54,7 @@ public:
private:
struct bpf_map *bpf_map_;
libbpf::bpf_map_type type_;
- cstring_view name_;
+ std::string name_;
uint32_t key_size_;
uint32_t value_size_;
uint32_t max_entries_;
diff --git a/src/container/cstring_view.h b/src/container/cstring_view.h
deleted file mode 100644
index 2e1c4602..00000000
--- a/src/container/cstring_view.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-
-#include <string>
-#include <string_view>
-
-namespace bpftrace {
-
-// cstring_view
-//
-// A restricted version of std::string_view which guarantees that the underlying
-// string buffer will be null-terminated. This can be useful when interacting
-// with C APIs while avoiding the use of char* and unnecessary copies from using
-// std::string.
-//
-// We only allow constructing cstring_view from types which are guaranteed to
-// store null-terminated strings. All modifiers or operations on cstring_view
-// will also maintain the null-terminated property.
-class cstring_view : public std::string_view {
-public:
- constexpr cstring_view(const char *str) noexcept : std::string_view{ str }
- {
- }
- constexpr cstring_view(const std::string &str) noexcept
- : std::string_view{ str }
- {
- }
- constexpr const char *c_str() const noexcept
- {
- return data();
- }
-
-private:
- // Disallow use of functions which can break the null-termination invariant
- using std::string_view::copy;
- using std::string_view::remove_suffix;
- using std::string_view::substr;
-};
-
-} // namespace bpftrace
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c5d10f9c..d012cad7 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -33,7 +33,6 @@ add_executable(bpftrace_test
clang_parser.cpp
config.cpp
collect_nodes.cpp
- cstring_view.cpp
field_analyser.cpp
function_registry.cpp
log.cpp
diff --git a/tests/cstring_view.cpp b/tests/cstring_view.cpp
deleted file mode 100644
index 5b82a990..00000000
--- a/tests/cstring_view.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "container/cstring_view.h"
-#include "gtest/gtest.h"
-
-#include <type_traits>
-
-namespace bpftrace::test::cstring_view {
-
-using bpftrace::cstring_view;
-
-TEST(cstring_view, c_string)
-{
- const char *str = "abc";
- cstring_view sv{ str };
-
- EXPECT_EQ("abc", sv);
-
- EXPECT_EQ('a', sv[0]);
- EXPECT_EQ('b', sv[1]);
- EXPECT_EQ('c', sv[2]);
- EXPECT_EQ('\0', sv[3]);
-}
-
-TEST(cstring_view, std_string)
-{
- std::string str = "abc";
- cstring_view sv{ str };
-
- EXPECT_EQ("abc", sv);
-
- EXPECT_EQ('a', sv[0]);
- EXPECT_EQ('b', sv[1]);
- EXPECT_EQ('c', sv[2]);
- EXPECT_EQ('\0', sv[3]);
-}
-
-TEST(cstring_view, std_string_view)
-{
- EXPECT_FALSE((std::is_constructible_v<cstring_view, std::string_view>));
-
- // Sanity checks:
- EXPECT_TRUE((std::is_constructible_v<cstring_view, std::string>));
- EXPECT_TRUE((std::is_constructible_v<cstring_view, const char *>));
-}
-
-TEST(cstring_view, length)
-{
- cstring_view sv{ "abc" };
-
- EXPECT_EQ("abc", sv);
- EXPECT_EQ(3, sv.size());
- EXPECT_EQ(3, sv.length());
-}
-
-TEST(cstring_view, c_str)
-{
- cstring_view sv{ "abc" };
- EXPECT_EQ(0, strcmp(sv.c_str(), "abc"));
-}
-
-} // namespace bpftrace::test::cstring_view
--
2.49.0

View File

@ -1,47 +1,49 @@
From cae27a1842c038bb59fb8e3ee48018d0e69f2a3c Mon Sep 17 00:00:00 2001
From b36872e810f4f71280ef11c0cdf58344a473e706 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Thu, 11 Jun 2020 14:56:36 +0200
Subject: [PATCH] RHEL: aarch64: fixes statsnoop and opensnoop
On aarch64 the open syscall has been dropped. Only openat remains,
wich is called by libc open() function.
On aarch64 the open syscall has been dropped. Only openat and openat2
remain, which is called by libc open() function.
The state of *stat* syscalls, is a mess. They are several generations
of the system calls, and not all arches provides all of them. For
instance, new(l)stat are missing from aarch64.
The only way I can think of fixing thess is RHEL-8 only arch specific
The only way I can think of fixing thess is RHEL-9 only arch specific
patches.
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Viktor Malik <vmalik@redhat.com>
---
tools/opensnoop.bt | 2 --
tools/statsnoop.bt | 8 ++------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/tools/opensnoop.bt b/tools/opensnoop.bt
index bbb26419..95185e5f 100755
index aafacd10..1e51197e 100755
--- a/tools/opensnoop.bt
+++ b/tools/opensnoop.bt
@@ -21,13 +21,11 @@ BEGIN
@@ -49,14 +49,12 @@ BEGIN
printf("%-6s %-16s %4s %3s %s\n", "PID", "COMM", "FD", "ERR", "PATH");
}
-tracepoint:syscalls:sys_enter_open,
tracepoint:syscalls:sys_enter_openat
tracepoint:syscalls:sys_enter_openat,
tracepoint:syscalls:sys_enter_openat2
{
@filename[tid] = args.filename;
}
-tracepoint:syscalls:sys_exit_open,
tracepoint:syscalls:sys_exit_openat
tracepoint:syscalls:sys_exit_openat,
tracepoint:syscalls:sys_exit_openat2
/@filename[tid]/
{
diff --git a/tools/statsnoop.bt b/tools/statsnoop.bt
index a76b2bcc..89c2c8ea 100755
index ebab9744..48367151 100755
--- a/tools/statsnoop.bt
+++ b/tools/statsnoop.bt
@@ -30,17 +30,13 @@ tracepoint:syscalls:sys_enter_statfs
@@ -77,17 +77,13 @@ tracepoint:syscalls:sys_enter_statfs
@filename[tid] = args.pathname;
}
@ -62,5 +64,5 @@ index a76b2bcc..89c2c8ea 100755
{
$ret = args.ret;
--
2.45.0
2.50.1

View File

@ -1,4 +1,4 @@
From 2f1573fe27de4008faedd38ee9cdadc3eec31909 Mon Sep 17 00:00:00 2001
From b5e6a5f7fbcdf49fd19aafd519e04978f04a5aa7 Mon Sep 17 00:00:00 2001
From: Viktor Malik <viktor.malik@gmail.com>
Date: Fri, 6 Jun 2025 07:54:19 +0200
Subject: [PATCH] runqlen.bt: Use old version of the tool
@ -8,17 +8,17 @@ into nr_queued") so we need to use the old name of the struct fields.
Signed-off-by: Viktor Malik <viktor.malik@gmail.com>
---
tools/old/runqlen.bt | 41 -----------------------------------------
tools/old/runqlen.bt | 40 ----------------------------------------
tools/runqlen.bt | 8 +++++---
2 files changed, 5 insertions(+), 44 deletions(-)
2 files changed, 5 insertions(+), 43 deletions(-)
delete mode 100755 tools/old/runqlen.bt
diff --git a/tools/old/runqlen.bt b/tools/old/runqlen.bt
deleted file mode 100755
index 23a7fb85..00000000
index 82627c7d..00000000
--- a/tools/old/runqlen.bt
+++ /dev/null
@@ -1,41 +0,0 @@
@@ -1,40 +0,0 @@
-#!/usr/bin/env bpftrace
-/*
- * runqlen.bt CPU scheduler run queue length as a histogram.
@ -29,7 +29,6 @@ index 23a7fb85..00000000
- * For Linux < 6.14.
- *
- * Copyright 2018 Netflix, Inc.
- * Licensed under the Apache License, Version 2.0 (the "License")
- *
- * 07-Oct-2018 Brendan Gregg Created this.
- */
@ -61,19 +60,19 @@ index 23a7fb85..00000000
- @runqlen = lhist($len, 0, 100, 1);
-}
diff --git a/tools/runqlen.bt b/tools/runqlen.bt
index 394a7b3d..23a7fb85 100755
index fb206d3c..a9fac9e1 100755
--- a/tools/runqlen.bt
+++ b/tools/runqlen.bt
@@ -5,6 +5,8 @@
*
@@ -23,6 +23,8 @@
* This is a bpftrace version of the bcc tool of the same name.
* The bcc version provides options to customize the output.
*
+ * For Linux < 6.14.
+ *
* Copyright 2018 Netflix, Inc.
* Licensed under the Apache License, Version 2.0 (the "License")
*
@@ -19,8 +21,8 @@
* 07-Oct-2018 Brendan Gregg Created this.
@@ -36,8 +38,8 @@
// your kernel version. It is from kernel/sched/sched.h:
struct cfs_rq {
struct load_weight load;
@ -84,7 +83,7 @@ index 394a7b3d..23a7fb85 100755
};
#endif
@@ -33,7 +35,7 @@ profile:hz:99
@@ -50,7 +52,7 @@ profile:hz:99
{
$task = (struct task_struct *)curtask;
$my_q = (struct cfs_rq *)$task->se.cfs_rq;
@ -94,5 +93,5 @@ index 394a7b3d..23a7fb85 100755
@runqlen = lhist($len, 0, 100, 1);
}
--
2.49.0
2.50.1

View File

@ -1,5 +1,5 @@
Name: bpftrace
Version: 0.23.5
Version: 0.24.2
Release: 1%{?dist}
Summary: High-level tracing language for Linux eBPF
License: ASL 2.0
@ -13,8 +13,7 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# for build.
Source1: https://github.com/USCiLab/cereal/archive/v%{cereal_version}/cereal-%{cereal_version}.tar.gz
Patch0: %{name}-%{version}-Remove-cstring_view.patch
Patch1: %{name}-%{version}-runqlen.bt-Use-old-version-of-the-tool.patch
Patch0: %{name}-%{version}-runqlen.bt-Use-old-version-of-the-tool.patch
Patch10: %{name}-%{version}-RHEL-aarch64-fixes-statsnoop-and-opensnoop.patch
# Arches will be included as upstream support is added and dependencies are
@ -25,6 +24,7 @@ BuildRequires: gcc-c++
BuildRequires: bison
BuildRequires: flex
BuildRequires: cmake
BuildRequires: elfutils-devel
BuildRequires: elfutils-libelf-devel
BuildRequires: zlib-devel
BuildRequires: llvm-devel
@ -33,7 +33,8 @@ BuildRequires: bcc-devel >= 0.19.0-8
BuildRequires: libbpf-devel
BuildRequires: libbpf-static
BuildRequires: binutils-devel
BuildRequires: lldb-devel
# vim-common contains xxd
BuildRequires: vim-common
%description
@ -60,19 +61,12 @@ CPATH=$PWD/cereal-%{cereal_version}/include:$CPATH
export CPATH
%cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DUSE_SYSTEM_BPF_BCC=ON \
-DBUILD_TESTING:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF
%cmake_build
%install
# The post hooks strip the binary which removes
# the BEGIN_trigger and END_trigger functions
# which are needed for the BEGIN and END probes
%global __os_install_post %{nil}
%global _find_debuginfo_opts -g
%cmake_install
# Fix shebangs (https://fedoraproject.org/wiki/Packaging:Guidelines#Shebang_lines)
@ -86,17 +80,27 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
%license LICENSE
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/tools
%dir %{_datadir}/%{name}/tools/doc
%{_bindir}/%{name}
%{_bindir}/%{name}-aotrt
%{_mandir}/man8/*
%{_datadir}/bash-completion/completions/%{name}
%attr(0755,-,-) %{_datadir}/%{name}/tools/*.bt
%{_datadir}/%{name}/tools/doc/*.txt
# Do not include old versions of tools, they do not work on RHEL 9
%exclude %{_datadir}/%{name}/tools/old
# biolatency-kp.bt attaches to kprobes which are inlined on RHEL 9.
# In addition, biolatency.bt does the same thing (with traecpoints).
%exclude %{_datadir}/%{name}/tools/biolatency-kp.bt
%changelog
* Tue Jan 13 2026 Viktor Malik <vmalik@redhat.com> - 0.24.2-1
- Rebase on bpftrace 0.24.2 (RHEL-140903)
* Mon Dec 01 2025 Viktor Malik <vmalik@redhat.com> - 0.24.1-2
- Rebuild with LLVM 21 (RHEL-108345)
* Mon Oct 06 2025 Viktor Malik <vmalik@redhat.com> - 0.24.1-1
- Rebase on bpftrace 0.24.1 (RHEL-78998)
* Fri Jun 06 2025 Viktor Malik <vmalik@redhat.com> - 0.23.5-1
- Rebase on bpftrace 0.23.5 (RHEL-78918)
- Add LLVM 20 support (RHEL-81775)