Rebase bcc to version 0.35.0
Rebase to version 0.35.0 (RHEL-79002) - Fix bpf-ksnoop (RHEL-93852) - Fix bpf-javagc (RHEL-75531) Resolves: RHEL-79002 Resolves: RHEL-93852 Resolves: RHEL-75531 Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
parent
3959565119
commit
437da52b06
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@
|
||||
/bcc-0.30.0.tar.gz
|
||||
/bcc-0.32.0.tar.gz
|
||||
/bcc-0.34.0.tar.gz
|
||||
/bcc-0.35.0.tar.gz
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
From 1e2fc8bc2edc48354123633343afd1737b2325df Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Sun, 18 May 2025 04:17:34 +0200
|
||||
Subject: [PATCH 2/2] clang: Define DCONFIG_CC_IS_CLANG in
|
||||
KBuildHelper::get_flags() (#5172) (#5293)
|
||||
|
||||
On powerpc, many tools fail with an "invalid output constraint '=YZ<>'
|
||||
in asm" error. This come from the following code in
|
||||
arch/powerpc/include/asm/asm-compat.h:
|
||||
|
||||
Because CONFIG_CC_IS_CLANG is not defined in the headers, we end up
|
||||
using a constraint that is not understoog by clang.
|
||||
|
||||
Defining CONFIG_CC_IS_CLANG in KBuildHelper::get_flags() fixes this
|
||||
error and possibly other similar error.
|
||||
|
||||
Suggested-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
|
||||
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||||
---
|
||||
src/cc/frontends/clang/kbuild_helper.cc | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
|
||||
index 5d3ad9c2..4f09a398 100644
|
||||
--- a/src/cc/frontends/clang/kbuild_helper.cc
|
||||
+++ b/src/cc/frontends/clang/kbuild_helper.cc
|
||||
@@ -137,6 +137,13 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
|
||||
cflags->push_back("-Wno-pointer-sign");
|
||||
cflags->push_back("-fno-stack-protector");
|
||||
|
||||
+ /*
|
||||
+ * kernel is usually build with gcc and the kernel devel header
|
||||
+ * reflects that fact. However we build with clang and this must be
|
||||
+ * set to avoid some compilation errors
|
||||
+ */
|
||||
+ cflags->push_back("-DCONFIG_CC_IS_CLANG");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
From c0ab4f7f6ab177cf4a55f59d98c2d4fb9d258106 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Sun, 18 May 2025 01:12:30 +0200
|
||||
Subject: [PATCH 1/2] tools/biosnoop: Fix biosnoop pattern option (#5304)
|
||||
|
||||
The code to support the block_io tracepoints failed to update some
|
||||
code that is used with the -P option. That code changed the second
|
||||
argument of __trace_req_completion from 'req' to 'key', but in the
|
||||
"#ifdef INCLUDE_PATTERN" block, the use of 'req' remained unchanged.
|
||||
Of course, 'key' should be use here too.
|
||||
|
||||
Also remove the commented out line of code related to rq_disk.
|
||||
|
||||
It fixes the following error:
|
||||
$ biosnoop -P
|
||||
/virtual/main.c:213:24: error: use of undeclared identifier 'req'
|
||||
213 | data.pattern = req->__sector == *sector ? SEQUENTIAL : RANDOM;
|
||||
| ^
|
||||
/virtual/main.c:216:19: error: use of undeclared identifier 'req'
|
||||
216 | last_sector = req->__sector + data.len / 512;
|
||||
| ^
|
||||
2 errors generated.
|
||||
Traceback (most recent call last):
|
||||
File "/usr/share/bcc/tools/biosnoop", line 335, in <module>
|
||||
b = BPF(text=bpf_text)
|
||||
File "/usr/lib/python3.13/site-packages/bcc/__init__.py", line 505, in __init__
|
||||
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
|
||||
Exception: Failed to compile BPF module <text>
|
||||
|
||||
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||||
---
|
||||
tools/biosnoop.py | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/tools/biosnoop.py b/tools/biosnoop.py
|
||||
index d386a7cf..eee10e53 100755
|
||||
--- a/tools/biosnoop.py
|
||||
+++ b/tools/biosnoop.py
|
||||
@@ -218,7 +218,6 @@ static int __trace_req_completion(void *ctx, struct hash_key key)
|
||||
struct start_req_t *startp;
|
||||
struct val_t *valp;
|
||||
struct data_t data = {};
|
||||
- //struct gendisk *rq_disk;
|
||||
u64 ts;
|
||||
|
||||
// fetch timestamp and calculate delta
|
||||
@@ -228,7 +227,6 @@ static int __trace_req_completion(void *ctx, struct hash_key key)
|
||||
return 0;
|
||||
}
|
||||
ts = bpf_ktime_get_ns();
|
||||
- //rq_disk = req->__RQ_DISK__;
|
||||
data.delta = ts - startp->ts;
|
||||
data.ts = ts / 1000;
|
||||
data.qdelta = 0;
|
||||
@@ -260,10 +258,10 @@ static int __trace_req_completion(void *ctx, struct hash_key key)
|
||||
|
||||
sector = last_sectors.lookup(§or_key);
|
||||
if (sector != 0) {
|
||||
- data.pattern = req->__sector == *sector ? SEQUENTIAL : RANDOM;
|
||||
+ data.pattern = key.sector == *sector ? SEQUENTIAL : RANDOM;
|
||||
}
|
||||
|
||||
- last_sector = req->__sector + data.len / 512;
|
||||
+ last_sector = key.sector + data.len / 512;
|
||||
last_sectors.update(§or_key, &last_sector);
|
||||
#endif
|
||||
|
||||
--
|
||||
2.49.0
|
||||
|
||||
50
bcc-0.35.0-Fix-a-build-failure-with-clang21-5369.patch
Normal file
50
bcc-0.35.0-Fix-a-build-failure-with-clang21-5369.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 6a0030da509eb0c28d2d8a5ccc2f07c9fd9d4e45 Mon Sep 17 00:00:00 2001
|
||||
From: yonghong-song <ys114321@gmail.com>
|
||||
Date: Mon, 14 Jul 2025 20:21:59 -0700
|
||||
Subject: [PATCH 3/6] Fix a build failure with clang21 (#5369)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The build error message:
|
||||
src/cc/frontends/clang/loader.cc:400:73: error: no matching function for
|
||||
call to ‘clang::TextDiagnosticPrinter::TextDiagnosticPrinter(
|
||||
llvm::raw_fd_ostream&, clang::DiagnosticOptions*)’
|
||||
400 | auto diag_client = new TextDiagnosticPrinter(llvm::errs(), &*diag_opts);
|
||||
| ^
|
||||
The llvm commit
|
||||
https://github.com/llvm/llvm-project/pull/139584
|
||||
caused the build failure.
|
||||
|
||||
Adjust the code properly and the error is fixed.
|
||||
---
|
||||
src/cc/frontends/clang/loader.cc | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/cc/frontends/clang/loader.cc b/src/cc/frontends/clang/loader.cc
|
||||
index 07dc9d6a..6f8387aa 100644
|
||||
--- a/src/cc/frontends/clang/loader.cc
|
||||
+++ b/src/cc/frontends/clang/loader.cc
|
||||
@@ -396,11 +396,19 @@ int ClangLoader::do_compile(
|
||||
flags_cstr_rem.end());
|
||||
|
||||
// set up the error reporting class
|
||||
+#if LLVM_VERSION_MAJOR >= 21
|
||||
+ DiagnosticOptions diag_opts;
|
||||
+ auto diag_client = new TextDiagnosticPrinter(llvm::errs(), diag_opts);
|
||||
+
|
||||
+ IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
+ DiagnosticsEngine diags(DiagID, diag_opts, diag_client);
|
||||
+#else
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> diag_opts(new DiagnosticOptions());
|
||||
auto diag_client = new TextDiagnosticPrinter(llvm::errs(), &*diag_opts);
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
DiagnosticsEngine diags(DiagID, &*diag_opts, diag_client);
|
||||
+#endif
|
||||
|
||||
// set up the command line argument wrapper
|
||||
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
From 0e81f1ef9145b853745fdd56808388c9b295b1f9 Mon Sep 17 00:00:00 2001
|
||||
From c343c5e5419a45792db31656f0f51824e92f4703 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Fri, 4 Oct 2024 10:01:54 +0200
|
||||
Subject: [PATCH] Revert "Fix bashreadline (#4903)"
|
||||
Date: Mon, 27 Oct 2025 11:23:27 +0100
|
||||
Subject: [PATCH 1/6] Revert "Fix bashreadline (#4903)"
|
||||
|
||||
This reverts commit 706ec4fe3dbbd63f6d7adda8d8d7311afe998cfa.
|
||||
---
|
||||
docker/Dockerfile.ubuntu | 2 +-
|
||||
docker/build/Dockerfile.fedora | 2 +-
|
||||
docker/build/Dockerfile.ubuntu | 2 +-
|
||||
docker/build/Dockerfile.ubuntu | 1 -
|
||||
libbpf-tools/bashreadline.c | 40 +++-------------------------------
|
||||
tools/bashreadline.py | 18 +--------------
|
||||
5 files changed, 7 insertions(+), 57 deletions(-)
|
||||
4 files changed, 5 insertions(+), 56 deletions(-)
|
||||
|
||||
diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu
|
||||
index a6afd969..cdb52871 100644
|
||||
index a6afd969..ff8d9977 100644
|
||||
--- a/docker/Dockerfile.ubuntu
|
||||
+++ b/docker/Dockerfile.ubuntu
|
||||
@@ -24,6 +24,6 @@ COPY --from=builder /root/bcc/*.deb /root/bcc/
|
||||
@ -21,37 +20,23 @@ index a6afd969..cdb52871 100644
|
||||
apt-get update -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip python-is-python3 binutils libelf1 kmod llvm-12-dev && \
|
||||
- pip3 install dnslib cachetools pyelftools && \
|
||||
+ pip3 install dnslib cachetools && \
|
||||
+ pip3 install dnslib cachetools && \
|
||||
dpkg -i /root/bcc/*.deb && \
|
||||
apt-get clean
|
||||
diff --git a/docker/build/Dockerfile.fedora b/docker/build/Dockerfile.fedora
|
||||
index d135bcea..bf8c2b36 100644
|
||||
--- a/docker/build/Dockerfile.fedora
|
||||
+++ b/docker/build/Dockerfile.fedora
|
||||
@@ -59,7 +59,7 @@ RUN dnf -y install \
|
||||
iperf \
|
||||
netperf
|
||||
|
||||
-RUN pip3 install pyroute2==0.5.18 netaddr==0.8.0 dnslib==0.9.14 cachetools==3.1.1 pyelftools==0.30
|
||||
+RUN pip3 install pyroute2==0.5.18 netaddr==0.8.0 dnslib==0.9.14 cachetools==3.1.1
|
||||
|
||||
RUN wget -O ruby-install-${RUBY_INSTALL_VERSION}.tar.gz \
|
||||
https://github.com/postmodern/ruby-install/archive/v${RUBY_INSTALL_VERSION}.tar.gz && \
|
||||
diff --git a/docker/build/Dockerfile.ubuntu b/docker/build/Dockerfile.ubuntu
|
||||
index 50f4788a..7d29b66b 100644
|
||||
index 87b5fa6f..36c0e863 100644
|
||||
--- a/docker/build/Dockerfile.ubuntu
|
||||
+++ b/docker/build/Dockerfile.ubuntu
|
||||
@@ -81,7 +81,7 @@ done \
|
||||
&& \
|
||||
apt-get -y clean'
|
||||
|
||||
-RUN pip3 install pyroute2==0.5.18 netaddr==0.8.0 dnslib==0.9.14 cachetools==3.1.1 pyelftools==0.30
|
||||
+RUN pip3 install pyroute2==0.5.18 netaddr==0.8.0 dnslib==0.9.14 cachetools==3.1.1
|
||||
@@ -86,7 +86,6 @@ RUN apt-get install -y python3-setuptools \
|
||||
python3-netaddr \
|
||||
python3-dnslib \
|
||||
python3-cachetools \
|
||||
- python3-pyelftools
|
||||
|
||||
# FIXME this is faster than building from source, but it seems there is a bug
|
||||
# in probing libruby.so rather than ruby binary
|
||||
diff --git a/libbpf-tools/bashreadline.c b/libbpf-tools/bashreadline.c
|
||||
index 41b6a600..b069f048 100644
|
||||
index a83141e8..b9baf808 100644
|
||||
--- a/libbpf-tools/bashreadline.c
|
||||
+++ b/libbpf-tools/bashreadline.c
|
||||
@@ -90,41 +90,6 @@ static void handle_lost_events(void *ctx, int cpu, __u64 lost_cnt)
|
||||
@ -175,5 +160,5 @@ index 7e8324a2..cfbf2364 100755
|
||||
while 1:
|
||||
try:
|
||||
--
|
||||
2.46.0
|
||||
2.51.0
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
From 43e4e1e12a00366fb29126f8929a7678bbca8323 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Marchand <jmarchan@redhat.com>
|
||||
Date: Tue, 7 Oct 2025 15:32:36 +0200
|
||||
Subject: [PATCH 5/6] libbpf-tools/javagc: Include usdt.bpf.h header
|
||||
|
||||
Include usdt.bpf.h header to javagc.bpf.c.
|
||||
|
||||
Fixes the following error:
|
||||
libbpf: usdt: failed to find USDT support BPF maps, did you forget to include bpf/usdt.bpf.h?
|
||||
attach usdt mem__pool__gc__begin failed: No such process
|
||||
|
||||
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
||||
---
|
||||
libbpf-tools/javagc.bpf.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libbpf-tools/javagc.bpf.c b/libbpf-tools/javagc.bpf.c
|
||||
index 5bfe635c..35535d92 100644
|
||||
--- a/libbpf-tools/javagc.bpf.c
|
||||
+++ b/libbpf-tools/javagc.bpf.c
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_core_read.h>
|
||||
+#include <bpf/usdt.bpf.h>
|
||||
#include "javagc.h"
|
||||
|
||||
struct {
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
From 7804b1238f6cb1a874a2c4a06caeac928412d0f5 Mon Sep 17 00:00:00 2001
|
||||
From: Rong Tao <rongtao@cestc.cn>
|
||||
Date: Sun, 13 Jul 2025 12:26:14 +0800
|
||||
Subject: [PATCH 4/6] libbpf-tools: ksnoop: Fix two invalid access to map value
|
||||
(#5361)
|
||||
|
||||
On fedora42, llvm 20.1.7, kernel 6.15.4-200.fc42.x86_64 has two verifier
|
||||
errors. Test with command:
|
||||
|
||||
$ sudo ./ksnoop trace do_sys_openat2
|
||||
|
||||
1st:
|
||||
; last_stack_depth = stack_depth - 1; @ ksnoop.bpf.c:102
|
||||
108: (bc) w3 = w6 ; frame1: R3_w=scalar(id=5,smin=smin32=0,smax=umax=smax32=umax32=14,var_off=(0x0; 0xf)) R6=scalar(id=5,smin=smin32=0,smax=umax=smax32=umax32=14,var_off=(0x0; 0xf))
|
||||
109: (04) w3 += -1 ; frame1: R3_w=scalar(smin=0,smax=umax=0xffffffff,smin32=-1,smax32=13,var_off=(0x0; 0xffffffff))
|
||||
110: (bc) w4 = w3 ; frame1: R3_w=scalar(id=6,smin=0,smax=umax=0xffffffff,smin32=-1,smax32=13,var_off=(0x0; 0xffffffff)) R4_w=scalar(id=6,smin=0,smax=umax=0xffffffff,smin32=-1,smax32=13,var_off=(0x0; 0xffffffff))
|
||||
111: (54) w4 &= 255 ; frame1: R4_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff))
|
||||
112: (b7) r7 = 0 ; frame1: R7=0
|
||||
; if (last_stack_depth >= 0 && @ ksnoop.bpf.c:104
|
||||
113: (26) if w4 > 0xf goto pc+5 ; frame1: R4=scalar(smin=smin32=0,smax=umax=smax32=umax32=15,var_off=(0x0; 0xf))
|
||||
; last_ip = func_stack->ips[last_stack_depth]; @ ksnoop.bpf.c:106
|
||||
114: (57) r3 &= 255 ; frame1: R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff))
|
||||
115: (67) r3 <<= 3 ; frame1: R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=2040,var_off=(0x0; 0x7f8))
|
||||
116: (bf) r4 = r2 ; frame1: R2=map_value(map=ksnoop_func_sta,ks=8,vs=144) R4_w=map_value(map=ksnoop_func_sta,ks=8,vs=144)
|
||||
117: (0f) r4 += r3 ; frame1: R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=2040,var_off=(0x0; 0x7f8)) R4_w=map_value(map=ksnoop_func_sta,ks=8,vs=144,smin=smin32=0,smax=umax=smax32=umax32=2040,var_off=(0x0; 0x7f8))
|
||||
118: (79) r7 = *(u64 *)(r4 +8)
|
||||
invalid access to map value, value_size=144 off=2048 size=8
|
||||
|
||||
The last_stack_depth use 'w4 > 0xf' check boundary, but 'r3 &= 255'
|
||||
is beyond 0xf (0~15).
|
||||
|
||||
2nd:
|
||||
; trace_len = sizeof(*trace) + trace->buf_len - MAX_TRACE_BUF; @ ksnoop.bpf.c:222
|
||||
502: (04) w5 += 4008 ; frame1: R5_w=scalar(smin=umin=smin32=umin32=4009,smax=umax=smax32=umax32=0x10fa7,var_off=(0x0; 0x1ffff))
|
||||
503: (bc) w2 = w5 ; frame1: R2_w=scalar(id=27,smin=umin=smin32=umin32=4009,smax=umax=smax32=umax32=0x10fa7,var_off=(0x0; 0x1ffff)) R5_w=scalar(id=27,smin=umin=smin32=umin32=4009,smax=umax=smax32=umax32=0x10fa7,var_off=(0x0; 0x1ffff))
|
||||
504: (54) w2 &= 65535 ; frame1: R2_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=0xffff,var_off=(0x0; 0xffff))
|
||||
; if (trace_len <= sizeof(*trace)) @ ksnoop.bpf.c:224
|
||||
505: (26) if w2 > 0x3fa8 goto pc+7 ; frame1: R2_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=16296,var_off=(0x0; 0x3fff))
|
||||
506: (57) r5 &= 65535 ; frame1: R5_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=0xffff,var_off=(0x0; 0xffff))
|
||||
507: (18) r2 = 0xffff8ec554700c00 ; frame1: R2_w=map_ptr(map=ksnoop_perf_map,ks=4,vs=4)
|
||||
509: (18) r3 = 0xffffffff ; frame1: R3_w=0xffffffff
|
||||
511: (bf) r4 = r9 ; frame1: R4_w=map_value(map=ksnoop_func_map,ks=8,vs=16296) R9=map_value(map=ksnoop_func_map,ks=8,vs=16296)
|
||||
512: (85) call bpf_perf_event_output#25
|
||||
invalid access to map value, value_size=16296 off=0 size=65535
|
||||
|
||||
Just fix it with size type 'u64' instead of 'u32', see:
|
||||
long bpf_perf_event_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
|
||||
|
||||
Signed-off-by: Rong Tao <rongtao@cestc.cn>
|
||||
---
|
||||
libbpf-tools/ksnoop.bpf.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbpf-tools/ksnoop.bpf.c b/libbpf-tools/ksnoop.bpf.c
|
||||
index f07ff561..15aa7d75 100644
|
||||
--- a/libbpf-tools/ksnoop.bpf.c
|
||||
+++ b/libbpf-tools/ksnoop.bpf.c
|
||||
@@ -103,7 +103,8 @@ static struct trace *get_trace(struct pt_regs *ctx, bool entry)
|
||||
/* get address of last function we called */
|
||||
if (last_stack_depth >= 0 &&
|
||||
last_stack_depth < FUNC_MAX_STACK_DEPTH)
|
||||
- last_ip = func_stack->ips[last_stack_depth];
|
||||
+ bpf_probe_read_kernel(&last_ip, sizeof(last_ip),
|
||||
+ &func_stack->ips[last_stack_depth]);
|
||||
/* push ip onto stack. return will pop it. */
|
||||
func_stack->ips[stack_depth] = ip;
|
||||
/* mask used in case bounds checks are optimized out */
|
||||
@@ -202,7 +203,7 @@ static struct trace *get_trace(struct pt_regs *ctx, bool entry)
|
||||
|
||||
static void output_trace(struct pt_regs *ctx, struct trace *trace)
|
||||
{
|
||||
- __u16 trace_len;
|
||||
+ __u64 trace_len;
|
||||
|
||||
if (trace->buf_len == 0)
|
||||
goto skip;
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
From 4af39db87ffbc8ae8f4e868da7fa076858f0c734 Mon Sep 17 00:00:00 2001
|
||||
From: Francois Lesueur <11961066+flesueur@users.noreply.github.com>
|
||||
Date: Wed, 6 Aug 2025 06:11:02 +0200
|
||||
Subject: [PATCH 6/6] tools/tcpconnect: fix iov field for DNS with Linux>=6.4
|
||||
(#5382)
|
||||
|
||||
Tcpconnect with DNS (-d flag) does not work with Linux>=6.4. The kernel representation of struct iov_iter changed in 6.4.
|
||||
|
||||
This PR adapts the iov field depending on the structure. It also removes inet_sk() which did not work on a recent kernel (6.6).
|
||||
---
|
||||
tools/tcpconnect.py | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tools/tcpconnect.py b/tools/tcpconnect.py
|
||||
index a38bad8d..dc35cb28 100755
|
||||
--- a/tools/tcpconnect.py
|
||||
+++ b/tools/tcpconnect.py
|
||||
@@ -276,7 +276,7 @@ int trace_udp_recvmsg(struct pt_regs *ctx)
|
||||
{
|
||||
__u64 pid_tgid = bpf_get_current_pid_tgid();
|
||||
struct sock *sk = (struct sock *)PT_REGS_PARM1(ctx);
|
||||
- struct inet_sock *is = inet_sk(sk);
|
||||
+ struct inet_sock *is = (struct inet_sock *)sk;
|
||||
|
||||
// only grab port 53 packets, 13568 is ntohs(53)
|
||||
if (is->inet_dport == 13568) {
|
||||
@@ -303,7 +303,7 @@ int trace_udp_ret_recvmsg(struct pt_regs *ctx)
|
||||
goto delete_and_return;
|
||||
size_t buflen = (size_t)copied;
|
||||
|
||||
- if (buflen > msghdr->msg_iter.iov->iov_len)
|
||||
+ if (buflen > msghdr->msg_iter.IOV_FIELD->iov_len)
|
||||
goto delete_and_return;
|
||||
|
||||
if (buflen > MAX_PKT)
|
||||
@@ -313,7 +313,7 @@ int trace_udp_ret_recvmsg(struct pt_regs *ctx)
|
||||
if (!data) // this should never happen, just making the verifier happy
|
||||
return 0;
|
||||
|
||||
- void *iovbase = msghdr->msg_iter.iov->iov_base;
|
||||
+ void *iovbase = msghdr->msg_iter.IOV_FIELD->iov_base;
|
||||
bpf_probe_read(data->pkt, buflen, iovbase);
|
||||
dns_events.perf_submit(ctx, data, buflen);
|
||||
|
||||
@@ -386,10 +386,14 @@ bpf_text = bpf_text.replace('FILTER_FAMILY', '')
|
||||
bpf_text = bpf_text.replace('FILTER_UID', '')
|
||||
|
||||
if args.dns:
|
||||
- if BPF.kernel_struct_has_field(b'iov_iter', b'iter_type') == 1:
|
||||
+ if BPF.kernel_struct_has_field(b'iov_iter', b'type') == 1:
|
||||
+ dns_bpf_text = dns_bpf_text.replace('TYPE_FIELD', 'type')
|
||||
+ else:
|
||||
dns_bpf_text = dns_bpf_text.replace('TYPE_FIELD', 'iter_type')
|
||||
+ if BPF.kernel_struct_has_field(b'iov_iter', b'iov') == 1:
|
||||
+ dns_bpf_text = dns_bpf_text.replace('IOV_FIELD', 'iov')
|
||||
else:
|
||||
- dns_bpf_text = dns_bpf_text.replace('TYPE_FIELD', 'type')
|
||||
+ dns_bpf_text = dns_bpf_text.replace('IOV_FIELD', '__iov')
|
||||
bpf_text += dns_bpf_text
|
||||
|
||||
if debug or args.ebpf:
|
||||
--
|
||||
2.51.0
|
||||
|
||||
17
bcc.spec
17
bcc.spec
@ -24,16 +24,18 @@
|
||||
|
||||
|
||||
Name: bcc
|
||||
Version: 0.34.0
|
||||
Release: 2%{?dist}
|
||||
Version: 0.35.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}-Revert-Fix-bashreadline-4903.patch
|
||||
Patch1: %%{name}-%%{version}-tools-biosnoop-Fix-biosnoop-pattern-option-5304.patch
|
||||
Patch2: %%{name}-%%{version}-clang-Define-DCONFIG_CC_IS_CLANG-in-KBuildHelper-get.patch
|
||||
Patch3: %%{name}-%%{version}-tools-biolatency-biosnoop-biotop-use-TRACEPOINT_PROB.patch
|
||||
Patch1: %%{name}-%%{version}-tools-biolatency-biosnoop-biotop-use-TRACEPOINT_PROB.patch
|
||||
Patch2: %%{name}-%%{version}-Fix-a-build-failure-with-clang21-5369.patch
|
||||
Patch3: %%{name}-%%{version}-libbpf-tools-ksnoop-Fix-two-invalid-access-to-map-va.patch
|
||||
Patch4: %%{name}-%%{version}-libbpf-tools-javagc-Include-usdt.bpf.h-header.patch
|
||||
Patch5: %%{name}-%%{version}-tools-tcpconnect-fix-iov-field-for-DNS-with-Linux-6..patch
|
||||
|
||||
# Arches will be included as upstream support is added and dependencies are
|
||||
# satisfied in the respective arches
|
||||
@ -266,6 +268,11 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Oct 27 2025 Jerome Marchand <jmarchan@redhat.com> - 0.35.0-1
|
||||
- Rebase to version 0.35.0 (RHEL-79002)
|
||||
- Fix bpf-ksnoop (RHEL-93852)
|
||||
- Fix bpf-javagc (RHEL-75531)
|
||||
|
||||
* Mon Jul 28 2025 Jerome Marchand <jmarchan@redhat.com> - 0.34.0-2
|
||||
- Fix bio* tools tracepoints (RHEL-99677)
|
||||
|
||||
|
||||
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (bcc-0.34.0.tar.gz) = 0bcc00f2f94d2b835a0e421a029d30030324a839070c14da7fe56cd11ce246b7655dae42facb802d79c40325d5b98d5648b34189026c98cdcc6a1f094f795391
|
||||
SHA512 (bcc-0.35.0.tar.gz) = 23cc1413fef785165fe9fd29a242fb13e4e56da7d63699dbed3d6d12902a1de392b412cb0e5754eff5aeecf0a023568d593c9f4cb5bca7a88013aadfaef4fa3d
|
||||
|
||||
Loading…
Reference in New Issue
Block a user