From ca31082653062f2ca20f9450aa7478e970e55eff Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Thu, 8 Jun 2023 17:16:28 +0200 Subject: [PATCH] Add missing patch The following patch was missing from the previous commit: bcc-0.25.0-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch Related: rhbz#2155163 --- ...py-Fix-uninitialized-struct-pad-erro.patch | 49 +++++++++++++++++++ bcc.spec | 5 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 bcc-0.25.0-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch diff --git a/bcc-0.25.0-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch b/bcc-0.25.0-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch new file mode 100644 index 0000000..79b7594 --- /dev/null +++ b/bcc-0.25.0-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch @@ -0,0 +1,49 @@ +From 1d8419056e128ae49107d27e5f55d1bfa8134e3a Mon Sep 17 00:00:00 2001 +From: Rong Tao +Date: Fri, 10 Feb 2023 22:16:56 +0800 +Subject: [PATCH] tools/nfsslower.py: Fix uninitialized struct pad error + +The verifier is unhappy, if data struct _pad_ is not initialized, see [0][1]. + + $ sudo ./nfsslower.py + ... + ; bpf_perf_event_output(ctx, (void *)bpf_pseudo_fd(1, -2), CUR_CPU_IDENTIFIER, &data, sizeof(data)); + 83: (79) r1 = *(u64 *)(r10 -144) ; R1_w=ctx(off=0,imm=0) R10=fp0 + 84: (18) r3 = 0xffffffff ; R3_w=4294967295 + 86: (b7) r5 = 96 ; R5_w=96 + 87: (85) call bpf_perf_event_output#25 + invalid indirect read from stack R4 off -136+92 size 96 + processed 84 insns (limit 1000000) max_states_per_insn 0 total_states 4 peak_states 4 mark_read 4 + ... + raise Exception("Failed to load BPF program %s: %s" % + Exception: Failed to load BPF program b'raw_tracepoint__nfs_commit_done': Permission denied + +[0] https://github.com/iovisor/bcc/issues/2623 +[1] https://github.com/iovisor/bcc/pull/4453 + +Signed-off-by: Rong Tao +--- + tools/nfsslower.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tools/nfsslower.py b/tools/nfsslower.py +index b5df8f19..c2c243b3 100755 +--- a/tools/nfsslower.py ++++ b/tools/nfsslower.py +@@ -179,8 +179,11 @@ static int trace_exit(struct pt_regs *ctx, int type) + + // populate output struct + u32 size = PT_REGS_RC(ctx); +- struct data_t data = {.type = type, .size = size, .delta_us = delta_us, +- .pid = pid}; ++ struct data_t data = {}; ++ data.type = type; ++ data.size = size; ++ data.delta_us = delta_us; ++ data.pid = pid; + data.ts_us = ts / 1000; + data.offset = valp->offset; + bpf_get_current_comm(&data.task, sizeof(data.task)); +-- +2.40.1 + diff --git a/bcc.spec b/bcc.spec index fbd600f..59200c8 100644 --- a/bcc.spec +++ b/bcc.spec @@ -9,7 +9,7 @@ Name: bcc Version: 0.25.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc @@ -222,6 +222,9 @@ done %changelog +* Thu Jun 08 2023 Jerome Marchand - 0.25.0-4 +- Add missing patch. + * Mon May 15 2023 Jerome Marchand - 0.25.0-3 - Rebuild with llvm 16 (RHBZ#2192949) - Fix compactsnoop (RHBZ#2042238)