Rebase bpftrace to 0.23.5

Resolves: RHEL-78998

Upstream dropped usage of lldb for parsing DWARF and replaced it by
using libdw (from elfutils).

We can drop one of the patches as it's already present.

Finally, drop an old usage of `USE_SYSTEM_BPF_BCC=ON` as it's no longer
used by the project.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
This commit is contained in:
Viktor Malik 2025-10-06 14:12:55 +02:00
parent 62168edf74
commit e25c93e4e8
No known key found for this signature in database
GPG Key ID: AF7A2E1F6EE74FB3
5 changed files with 36 additions and 33 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@
/bpftrace-0.21.1.tar.gz
/bpftrace-0.22.1.tar.gz
/bpftrace-0.23.5.tar.gz
/bpftrace-0.24.1.tar.gz

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.1
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,7 +61,6 @@ 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
@ -80,13 +80,11 @@ 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.
@ -94,6 +92,9 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
%exclude %{_datadir}/%{name}/tools/biolatency-kp.bt
%changelog
* 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)

View File

@ -1,2 +1,2 @@
SHA512 (bpftrace-0.23.5.tar.gz) = 1e040bce7636da4e2ebeffc1c8fc3944feb26ef2c371ff287b323123ef89b839fbaa492a61e8164efedc7579e73aebc489f168ecad903f3cac6144d8bbc4b6f1
SHA512 (bpftrace-0.24.1.tar.gz) = 97ce3d909c6d6fe021afc6db4ea67dd70fa85502358ee89314d8cf58cb8727ce091bbbdf23f73d9eaadae59d8244d76530dda89993b499deebe7f90edd21cda7
SHA512 (cereal-1.3.2.tar.gz) = 98d306d6292789129675f1c5c5aedcb90cfcc1029c4482893a8f9b23f3c9755e5ed4762d7a528f215345cae6392e87cd8d89467115b6f031b41c8673d6b4b109