Re: [PATCH v2 0/2] perf trace: Fix support for the new BPF feature in clang 12

From: Song Liu
Date: Tue Oct 15 2024 - 19:21:45 EST




> On Oct 15, 2024, at 4:01 PM, Arnaldo Carvalho de Melo <arnaldo.melo@xxxxxxxxx> wrote:
>
> Maybe a compiler barrier somewhere around those index operations?

Indeed, something like the following helped.

Song

diff --git i/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c w/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
index b2f17cca014b..7b7947ca8996 100644
--- i/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
+++ w/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
@@ -477,6 +477,8 @@ static int augment_sys_enter(void *ctx, struct syscall_enter_args *args)
augmented = true;
} else if (size < 0 && size >= -6) { /* buffer */
index = -(size + 1);
+ barrier_var(index);
+ index &= 7;
aug_size = args->args[index];

if (aug_size > TRACE_AUG_MAX_BUF)