Backport bug fixes from upstream
Two bugfixes were backported: - Fix for wildcard listing bug Resolves: rhbz#2055550 - Changes to bio* tools required by new kernels Resolves: rhbz#2039661 Signed-off-by: Viktor Malik <vmalik@redhat.com>
This commit is contained in:
parent
d1570de34c
commit
a4491cdd93
72
bpftrace-0.12.1-Fix-single-arg-wildcard-listings.patch
Normal file
72
bpftrace-0.12.1-Fix-single-arg-wildcard-listings.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From b7fd0900b18c4b640926e0bb830464565a527ca1 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Xu <dxu@dxuuu.xyz>
|
||||
Date: Mon, 5 Apr 2021 14:35:08 -0700
|
||||
Subject: [PATCH] Fix single arg wildcard listings
|
||||
|
||||
The docs say we can do stuff like
|
||||
|
||||
# bpftrace -l "*sleep*"
|
||||
|
||||
so we should probably implement it. We probably regressed on this during
|
||||
the probe matching refactoring.
|
||||
---
|
||||
src/ast/attachpoint_parser.cpp | 10 +++++++---
|
||||
tests/runtime/regression | 6 ++++++
|
||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/ast/attachpoint_parser.cpp b/src/ast/attachpoint_parser.cpp
|
||||
index cfac09bc..b62549d7 100644
|
||||
--- a/src/ast/attachpoint_parser.cpp
|
||||
+++ b/src/ast/attachpoint_parser.cpp
|
||||
@@ -77,6 +77,9 @@ AttachPointParser::State AttachPointParser::parse_attachpoint(AttachPoint &ap)
|
||||
std::set<std::string> probe_types;
|
||||
if (has_wildcard(parts_.front()))
|
||||
{
|
||||
+ // Single argument listing looks at all relevant probe types
|
||||
+ std::string probetype_query = (parts_.size() == 1) ? "*" : parts_.front();
|
||||
+
|
||||
// Probe type expansion
|
||||
// If PID is specified or the second part of the attach point is a path
|
||||
// (contains '/'), use userspace probe types.
|
||||
@@ -85,12 +88,12 @@ AttachPointParser::State AttachPointParser::parse_attachpoint(AttachPoint &ap)
|
||||
(parts_.size() >= 2 && parts_[1].find('/') != std::string::npos))
|
||||
{
|
||||
probe_types = bpftrace_.probe_matcher_->expand_probetype_userspace(
|
||||
- parts_.front());
|
||||
+ probetype_query);
|
||||
}
|
||||
else
|
||||
{
|
||||
probe_types = bpftrace_.probe_matcher_->expand_probetype_kernel(
|
||||
- parts_.front());
|
||||
+ probetype_query);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -111,7 +114,8 @@ AttachPointParser::State AttachPointParser::parse_attachpoint(AttachPoint &ap)
|
||||
for (const auto &probe_type : probe_types)
|
||||
{
|
||||
std::string raw_input = ap.raw_input;
|
||||
- erase_prefix(raw_input);
|
||||
+ if (parts_.size() > 1)
|
||||
+ erase_prefix(raw_input);
|
||||
raw_input = probe_type + ":" + raw_input;
|
||||
// New attach points have ignore_invalid set to true - probe types for
|
||||
// which raw_input has invalid number of parts will be ignored (instead
|
||||
diff --git a/tests/runtime/regression b/tests/runtime/regression
|
||||
index 7f40ffdb..b7fa4653 100644
|
||||
--- a/tests/runtime/regression
|
||||
+++ b/tests/runtime/regression
|
||||
@@ -33,3 +33,9 @@ NAME c_array_indexing
|
||||
RUN bpftrace -v -e 'struct Foo { int a; uint8_t b[10]; } uprobe:testprogs/uprobe_test:function2 { $foo = (struct Foo *)arg0; printf("%c %c %c %c %c\n", $foo->b[0], $foo->b[1], $foo->b[2], $foo->b[3], $foo->b[4]) }' -c ./testprogs/uprobe_test
|
||||
EXPECT h e l l o
|
||||
TIMEOUT 5
|
||||
+
|
||||
+# https://github.com/iovisor/bpftrace/issues/1773
|
||||
+NAME single_arg_wildcard_listing
|
||||
+RUN bpftrace -l "*do_nanosleep*"
|
||||
+EXPECT kprobe:do_nanosleep
|
||||
+TIMEOUT 1
|
||||
--
|
||||
2.34.1
|
||||
|
84
bpftrace-0.12.1-Update-bio-tools-to-work-on-RHEL9.patch
Normal file
84
bpftrace-0.12.1-Update-bio-tools-to-work-on-RHEL9.patch
Normal file
@ -0,0 +1,84 @@
|
||||
From 617bb8501c091be2501b3abe4dad47804d5a4278 Mon Sep 17 00:00:00 2001
|
||||
From: Viktor Malik <viktor.malik@gmail.com>
|
||||
Date: Mon, 17 Jan 2022 11:15:26 +0100
|
||||
Subject: [PATCH] Update bio* tools to work on RHEL9
|
||||
|
||||
Kernel commit:
|
||||
9e6c144e5fee block: inline hot paths of blk_account_io_*()
|
||||
renamed some functions used in the tools.
|
||||
|
||||
Kernel commit:
|
||||
5f8d3bf600d2 block: move struct request to blk-mq.h
|
||||
moved "struct request" to a different header.
|
||||
|
||||
This fixes both issues.
|
||||
---
|
||||
tools/biolatency.bt | 4 ++--
|
||||
tools/biosnoop.bt | 6 +++---
|
||||
tools/biostacks.bt | 2 +-
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tools/biolatency.bt b/tools/biolatency.bt
|
||||
index 4ea910b4..8fb0490d 100755
|
||||
--- a/tools/biolatency.bt
|
||||
+++ b/tools/biolatency.bt
|
||||
@@ -16,12 +16,12 @@ BEGIN
|
||||
printf("Tracing block device I/O... Hit Ctrl-C to end.\n");
|
||||
}
|
||||
|
||||
-kprobe:blk_account_io_start
|
||||
+kprobe:__blk_account_io_start
|
||||
{
|
||||
@start[arg0] = nsecs;
|
||||
}
|
||||
|
||||
-kprobe:blk_account_io_done
|
||||
+kprobe:__blk_account_io_done
|
||||
/@start[arg0]/
|
||||
{
|
||||
@usecs = hist((nsecs - @start[arg0]) / 1000);
|
||||
diff --git a/tools/biosnoop.bt b/tools/biosnoop.bt
|
||||
index 38ffeb52..6519054c 100755
|
||||
--- a/tools/biosnoop.bt
|
||||
+++ b/tools/biosnoop.bt
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bpftrace
|
||||
-#include <linux/blkdev.h>
|
||||
+#include <linux/blk-mq.h>
|
||||
/*
|
||||
* biosnoop.bt Block I/O tracing tool, showing per I/O latency.
|
||||
* For Linux, uses bpftrace, eBPF.
|
||||
@@ -16,7 +16,7 @@ BEGIN
|
||||
printf("%-12s %-7s %-16s %-6s %7s\n", "TIME(ms)", "DISK", "COMM", "PID", "LAT(ms)");
|
||||
}
|
||||
|
||||
-kprobe:blk_account_io_start
|
||||
+kprobe:__blk_account_io_start
|
||||
{
|
||||
@start[arg0] = nsecs;
|
||||
@iopid[arg0] = pid;
|
||||
@@ -24,7 +24,7 @@ kprobe:blk_account_io_start
|
||||
@disk[arg0] = ((struct request *)arg0)->rq_disk->disk_name;
|
||||
}
|
||||
|
||||
-kprobe:blk_account_io_done
|
||||
+kprobe:__blk_account_io_done
|
||||
/@start[arg0] != 0 && @iopid[arg0] != 0 && @iocomm[arg0] != ""/
|
||||
|
||||
{
|
||||
diff --git a/tools/biostacks.bt b/tools/biostacks.bt
|
||||
index 58201cdf..fdd2efed 100755
|
||||
--- a/tools/biostacks.bt
|
||||
+++ b/tools/biostacks.bt
|
||||
@@ -18,7 +18,7 @@ BEGIN
|
||||
printf("Tracing block I/O with init stacks. Hit Ctrl-C to end.\n");
|
||||
}
|
||||
|
||||
-kprobe:blk_account_io_start
|
||||
+kprobe:__blk_account_io_start
|
||||
{
|
||||
@reqstack[arg0] = kstack;
|
||||
@reqts[arg0] = nsecs;
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: bpftrace
|
||||
Version: 0.12.1
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: High-level tracing language for Linux eBPF
|
||||
License: ASL 2.0
|
||||
|
||||
@ -9,6 +9,8 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: %{name}-%{version}-RHEL-9-fixes.patch
|
||||
Patch1: %{name}-%{version}-Fix-mdflush.patch
|
||||
Patch2: %{name}-%{version}-orc-Fix-build-with-clang-13.patch
|
||||
Patch3: %{name}-%{version}-Fix-single-arg-wildcard-listings.patch
|
||||
Patch4: %{name}-%{version}-Update-bio-tools-to-work-on-RHEL9.patch
|
||||
|
||||
Patch10: %{name}-%{version}-aarch64-fixes-statsnoop-and-opensnoop.patch
|
||||
|
||||
@ -83,6 +85,10 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
|
||||
%{_datadir}/%{name}/tools/doc/*.txt
|
||||
|
||||
%changelog
|
||||
* Mon Feb 21 2022 Viktor Malik <vmalik@redhat.com> - 0.12.1-8
|
||||
- Fix wildcard listing bug
|
||||
- Fix bio* tools
|
||||
|
||||
* Thu Dec 02 2021 Jerome Marchand <jmarchan@redhat.com> - 0.12.1.7
|
||||
- Bump up required bcc version.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user