Messages in this thread | | | Date | Wed, 7 Jun 2023 11:42:16 +0100 | Subject | Re: [PATCH v2 bpf 03/11] bpftool: use a local bpf_perf_event_value to fix accessing its fields | From | Quentin Monnet <> |
| |
2023-06-06 14:02 UTC-0700 ~ Nick Desaulniers <ndesaulniers@google.com> > On Thu, Apr 21, 2022 at 12:39:04AM +0000, Alexander Lobakin wrote: >> Fix the following error when building bpftool: >> >> CLANG profiler.bpf.o >> CLANG pid_iter.bpf.o >> skeleton/profiler.bpf.c:18:21: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_perf_event_value' >> __uint(value_size, sizeof(struct bpf_perf_event_value)); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:13:39: note: expanded from macro '__uint' >> tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helper_defs.h:7:8: note: forward declaration of 'struct bpf_perf_event_value' >> struct bpf_perf_event_value; >> ^ >> >> struct bpf_perf_event_value is being used in the kernel only when >> CONFIG_BPF_EVENTS is enabled, so it misses a BTF entry then. >> Define struct bpf_perf_event_value___local with the >> `preserve_access_index` attribute inside the pid_iter BPF prog to >> allow compiling on any configs. It is a full mirror of a UAPI >> structure, so is compatible both with and w/o CO-RE. >> bpf_perf_event_read_value() requires a pointer of the original type, >> so a cast is needed. >> > > Hi Alexander, > What's the status of this series? I wasn't able to find a v3 on lore. > > We received a report that OpenMandriva is carrying around this patch. > https://github.com/ClangBuiltLinux/linux/issues/1805. > > + Tomasz > > Tomasz, do you have more info which particular configs can reproduce > this issue? Is this patch still necessary? > >> Fixes: 47c09d6a9f67 ("bpftool: Introduce "prog profile" command")
Hi Nick,
This patch is still necessary if you attempt to compile bpftool with skeletons support, on a host with a kernel version lower than 5.15.
I took over on the bpftool patches from this series, and sent a new version last month. Given that it only contains the bpftool patches, the series has a different title and is not tagged as v3, but you can find it here:
https://lore.kernel.org/all/20230512103354.48374-1-quentin@isovalent.com/t/#u
Jiri (+Cc) found an issue with this set when CONFIG_BPF_EVENTS is disabled. I need to replicate and investigate, but I've been short on time to do that over the last few weeks.
Best, Quentin
| |