aports/community/below/fix-exitstat-mm-struct-cast.patch
Robert Mongold 982f295ec2 community/below: fix build with clang
Build failed in exitstat.bpf.c with incompatible pointer types (mm_struct * assigned to mm_struct___pre62/post62 *) when compiling BPF code with newer clang.
Patch those two assignments to cast via const void * first, which makes the conversion explicit and allows the package to build.
2026-05-04 10:49:59 +02:00

21 lines
1.2 KiB
Diff

Fix bpf build with newer clang by casting mm pointer through void.
--- a/below/src/bpf/exitstat.bpf.c
+++ b/below/src/bpf/exitstat.bpf.c
@@ -137,12 +137,12 @@ int tracepoint__sched__sched_process_exit(
u64 file_pages = 0;
u64 anon_pages = 0;
u64 shmem_pages = 0;
if (bpf_core_type_matches(struct mm_struct___pre62)) {
- const struct mm_struct___pre62 *mms = mm;
+ const struct mm_struct___pre62 *mms = (const struct mm_struct___pre62 *)(const void *)mm;
file_pages = BPF_CORE_READ(mms, rss_stat.count[MM_FILEPAGES].counter);
anon_pages = BPF_CORE_READ(mms, rss_stat.count[MM_ANONPAGES].counter);
shmem_pages = BPF_CORE_READ(mms, rss_stat.count[MM_SHMEMPAGES].counter);
} else if (bpf_core_type_matches(struct mm_struct___post62)) {
- const struct mm_struct___post62 *mms = mm;
+ const struct mm_struct___post62 *mms = (const struct mm_struct___post62 *)(const void *)mm;
struct percpu_counter file_fbc = BPF_CORE_READ(mms, rss_stat[MM_FILEPAGES]);
struct percpu_counter anon_fbc = BPF_CORE_READ(mms, rss_stat[MM_ANONPAGES]);
struct percpu_counter shmem_fbc = BPF_CORE_READ(mms, rss_stat[MM_SHMEMPAGES]);