Rebuild bcc with llvm 16 and misc fixes
Fix compactsnoop Fix Bindsnoop Fix nfsslower Resolves: rhbz#2042238 Resolves: rhbz#2155200 Resolves: rhbz#2155163 Resolves: rhbz#2192949 Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
parent
6c34a3fbe5
commit
f49c376609
@ -0,0 +1,42 @@
|
|||||||
|
From 0d563f713780eb274ebf995660917482452c127e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yonghong Song <yhs@fb.com>
|
||||||
|
Date: Fri, 26 Aug 2022 16:34:24 -0700
|
||||||
|
Subject: [PATCH 1/2] Fix a llvm signed division error for compactsnoop tool
|
||||||
|
|
||||||
|
Fix issue #4182.
|
||||||
|
llvm doesn't support signed division and an assertion error
|
||||||
|
will happen when the IR contains sdiv. The reason is
|
||||||
|
due to code
|
||||||
|
zone - zone_pgdat->node_zones
|
||||||
|
where zone and zone_pgdat->node_zones are pointers to
|
||||||
|
struct zone (with size 1664). So effectively the above
|
||||||
|
is equivalent to
|
||||||
|
((void *)zone - (void *)zone_pgdat->node_zones)/sizeof(struct zone)
|
||||||
|
which is converted to sdiv insn.
|
||||||
|
llvm11 seems okay and I didn't investigate why. But llvm14 and
|
||||||
|
latest llvm16 failed with compiler fatal error.
|
||||||
|
|
||||||
|
To fix the issue let us replace the above '(void *)' as
|
||||||
|
'(u64)' and then the udiv will be used for the division.
|
||||||
|
|
||||||
|
Signed-off-by: Yonghong Song <yhs@fb.com>
|
||||||
|
---
|
||||||
|
tools/compactsnoop.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tools/compactsnoop.py b/tools/compactsnoop.py
|
||||||
|
index 9daaf485..bf3c9b4b 100755
|
||||||
|
--- a/tools/compactsnoop.py
|
||||||
|
+++ b/tools/compactsnoop.py
|
||||||
|
@@ -124,7 +124,7 @@ static inline int zone_idx_(struct zone *zone)
|
||||||
|
{
|
||||||
|
struct pglist_data *zone_pgdat = NULL;
|
||||||
|
bpf_probe_read_kernel(&zone_pgdat, sizeof(zone_pgdat), &zone->zone_pgdat);
|
||||||
|
- return zone - zone_pgdat->node_zones;
|
||||||
|
+ return ((u64)zone - (u64)zone_pgdat->node_zones)/sizeof(struct zone);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef EXTNEDED_FIELDS
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
43
bcc-0.25.0-Revert-tools-Fix-bindsnoop-for-kernel-v5.6.patch
Normal file
43
bcc-0.25.0-Revert-tools-Fix-bindsnoop-for-kernel-v5.6.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 73b15c15bdf3327c86de524ded528c6c6061ff3d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jerome Marchand <jmarchan@redhat.com>
|
||||||
|
Date: Wed, 3 May 2023 16:16:52 +0200
|
||||||
|
Subject: [PATCH] Revert "tools: Fix bindsnoop for kernel v5.6"
|
||||||
|
|
||||||
|
This reverts commit f96fed0a3b9682ce52a35a02f72880395582d855.
|
||||||
|
---
|
||||||
|
tools/bindsnoop.py | 10 +++-------
|
||||||
|
1 file changed, 3 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/bindsnoop.py b/tools/bindsnoop.py
|
||||||
|
index 07503352..ac3a8aa0 100755
|
||||||
|
--- a/tools/bindsnoop.py
|
||||||
|
+++ b/tools/bindsnoop.py
|
||||||
|
@@ -27,7 +27,7 @@
|
||||||
|
# 14-Feb-2020 Pavel Dubovitsky Created this.
|
||||||
|
|
||||||
|
from __future__ import print_function, absolute_import, unicode_literals
|
||||||
|
-from bcc import BPF
|
||||||
|
+from bcc import BPF, DEBUG_SOURCE
|
||||||
|
from bcc.containers import filter_by_containers
|
||||||
|
from bcc.utils import printb
|
||||||
|
import argparse
|
||||||
|
@@ -243,14 +243,10 @@ static int bindsnoop_return(struct pt_regs *ctx, short ipver)
|
||||||
|
opts.fields.reuseport = bitfield >> 4 & 0x01;
|
||||||
|
|
||||||
|
// workaround for reading the sk_protocol bitfield (from tcpaccept.py):
|
||||||
|
- u16 protocol;
|
||||||
|
+ u8 protocol;
|
||||||
|
int gso_max_segs_offset = offsetof(struct sock, sk_gso_max_segs);
|
||||||
|
int sk_lingertime_offset = offsetof(struct sock, sk_lingertime);
|
||||||
|
-
|
||||||
|
- // Since kernel v5.6 sk_protocol has its own u16 field
|
||||||
|
- if (sk_lingertime_offset - gso_max_segs_offset == 2)
|
||||||
|
- protocol = skp->sk_protocol;
|
||||||
|
- else if (sk_lingertime_offset - gso_max_segs_offset == 4)
|
||||||
|
+ if (sk_lingertime_offset - gso_max_segs_offset == 4)
|
||||||
|
// 4.10+ with little endian
|
||||||
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
|
protocol = *(u8 *)((u64)&skp->sk_gso_max_segs - 3);
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
@ -0,0 +1,71 @@
|
|||||||
|
From 2fd4457e52d56825e12a4037630aea3f82241a02 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rong Tao <rongtao@cestc.cn>
|
||||||
|
Date: Fri, 10 Feb 2023 23:28:55 +0800
|
||||||
|
Subject: [PATCH 2/2] tools/compactsnoop.py: Fix raw_tracepoint Invalid
|
||||||
|
argument error
|
||||||
|
|
||||||
|
kernel commit abd4349ff9b8("mm: compaction: cleanup the compaction trace
|
||||||
|
events") change the arguments of 'mm_compaction_begin' from (start_pfn,
|
||||||
|
migrate_pfn, free_pfn, end_pfn, sync) to (cc, start_pfn, end_pfn, sync),
|
||||||
|
and change the arguments of 'mm_compaction_end' from (start_pfn,
|
||||||
|
migrate_pfn, free_pfn, end_pfn, sync, ret) to (cc, start_pfn, end_pfn,
|
||||||
|
sync, ret).
|
||||||
|
|
||||||
|
Replacing RAW_TRACEPOINT_PROBE with TRACEPOINT_PROBE solves this problem
|
||||||
|
and guarantees compatibility.
|
||||||
|
|
||||||
|
$ sudo ./compactsnoop.py
|
||||||
|
bpf_attach_raw_tracepoint (mm_compaction_begin): Invalid argument
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/home/sdb/Git/bcc/tools/./compactsnoop.py", line 292, in <module>
|
||||||
|
b = BPF(text=bpf_text)
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
File "/usr/lib/python3.11/site-packages/bcc/__init__.py", line 483, in __init__
|
||||||
|
self._trace_autoload()
|
||||||
|
File "/usr/lib/python3.11/site-packages/bcc/__init__.py", line 1462, in _trace_autoload
|
||||||
|
self.attach_raw_tracepoint(tp=tp, fn_name=fn.name)
|
||||||
|
File "/usr/lib/python3.11/site-packages/bcc/__init__.py", line 1055, in attach_raw_tracepoint
|
||||||
|
raise Exception("Failed to attach BPF to raw tracepoint")
|
||||||
|
Exception: Failed to attach BPF to raw tracepoint
|
||||||
|
|
||||||
|
Signed-off-by: Rong Tao <rongtao@cestc.cn>
|
||||||
|
---
|
||||||
|
tools/compactsnoop.py | 13 ++++---------
|
||||||
|
1 file changed, 4 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/compactsnoop.py b/tools/compactsnoop.py
|
||||||
|
index bf3c9b4b..e9baa9b4 100755
|
||||||
|
--- a/tools/compactsnoop.py
|
||||||
|
+++ b/tools/compactsnoop.py
|
||||||
|
@@ -237,11 +237,9 @@ RAW_TRACEPOINT_PROBE(mm_compaction_suitable)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-RAW_TRACEPOINT_PROBE(mm_compaction_begin)
|
||||||
|
+TRACEPOINT_PROBE(compaction, mm_compaction_begin)
|
||||||
|
{
|
||||||
|
- // TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
|
||||||
|
- // unsigned long free_pfn, unsigned long zone_end, bool sync)
|
||||||
|
- bool sync = (bool)ctx->args[4];
|
||||||
|
+ bool sync = args->sync;
|
||||||
|
|
||||||
|
u64 id = bpf_get_current_pid_tgid();
|
||||||
|
struct val_t *valp = start.lookup(&id);
|
||||||
|
@@ -255,12 +253,9 @@ RAW_TRACEPOINT_PROBE(mm_compaction_begin)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-RAW_TRACEPOINT_PROBE(mm_compaction_end)
|
||||||
|
+TRACEPOINT_PROBE(compaction, mm_compaction_end)
|
||||||
|
{
|
||||||
|
- // TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
|
||||||
|
- // unsigned long free_pfn, unsigned long zone_end, bool sync,
|
||||||
|
- // int status)
|
||||||
|
- submit_event(ctx, ctx->args[5]);
|
||||||
|
+ submit_event(args, args->status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
12
bcc.spec
12
bcc.spec
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
Name: bcc
|
Name: bcc
|
||||||
Version: 0.25.0
|
Version: 0.25.0
|
||||||
Release: 2.0.2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: BPF Compiler Collection (BCC)
|
Summary: BPF Compiler Collection (BCC)
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
URL: https://github.com/iovisor/bcc
|
URL: https://github.com/iovisor/bcc
|
||||||
@ -21,6 +21,10 @@ Patch3: %{name}-%{version}-Fix-bpf_pseudo_fd-type-conversion-error.patch
|
|||||||
Patch4: %{name}-%{version}-Fix-clang-15-int-to-pointer-conversion-errors.patch
|
Patch4: %{name}-%{version}-Fix-clang-15-int-to-pointer-conversion-errors.patch
|
||||||
Patch5: %{name}-%{version}-Revert-tools-tcpaccept-Fix-support-for-v5.6-kernels.patch
|
Patch5: %{name}-%{version}-Revert-tools-tcpaccept-Fix-support-for-v5.6-kernels.patch
|
||||||
Patch6: %{name}-%{version}-Fix-get_kprobe_functions.patch
|
Patch6: %{name}-%{version}-Fix-get_kprobe_functions.patch
|
||||||
|
Patch7: %{name}-%{version}-Fix-a-llvm-signed-division-error-for-compactsnoop-to.patch
|
||||||
|
Patch8: %{name}-%{version}-tools-compactsnoop.py-Fix-raw_tracepoint-Invalid-arg.patch
|
||||||
|
Patch9: %{name}-%{version}-Revert-tools-Fix-bindsnoop-for-kernel-v5.6.patch
|
||||||
|
Patch10: %{name}-%{version}-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch
|
||||||
|
|
||||||
# Arches will be included as upstream support is added and dependencies are
|
# Arches will be included as upstream support is added and dependencies are
|
||||||
# satisfied in the respective arches
|
# satisfied in the respective arches
|
||||||
@ -218,6 +222,12 @@ done
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 15 2023 Jerome Marchand <jmarchan@redhat.com> - 0.25.0-3
|
||||||
|
- Rebuild with llvm 16 (RHBZ#2192949)
|
||||||
|
- Fix compactsnoop (RHBZ#2042238)
|
||||||
|
- Fix bindsnoop (RHBZ#2155200)
|
||||||
|
- Fix nfsslower (RHBZ#2155163)
|
||||||
|
|
||||||
* Fri Mar 03 2023 bstinson@redhat.com - 0.25.0-2.0.2
|
* Fri Mar 03 2023 bstinson@redhat.com - 0.25.0-2.0.2
|
||||||
- One final rebuild in CentOS Stream only
|
- One final rebuild in CentOS Stream only
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user