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.
This commit is contained in:
Robert Mongold 2026-04-26 23:06:50 -04:00 committed by Jakub Jirutka
parent 89e19d3785
commit 982f295ec2
2 changed files with 24 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=below
pkgver=0.11.0
pkgrel=0
pkgrel=1
pkgdesc="A time traveling resource monitor for modern Linux systems"
url="https://github.com/facebookincubator/below"
# s390x: fails to build nix crate
@ -28,6 +28,7 @@ subpackages="
"
source="https://github.com/facebookincubator/below/archive/v$pkgver/below-$pkgver.tar.gz
fix-sudotest.patch
fix-exitstat-mm-struct-cast.patch
$pkgname.initd
$pkgname.confd
$pkgname.logrotate
@ -66,6 +67,7 @@ check() {
--skip advance_forward_and_reverse \
--skip disable_disk_stat \
--skip disable_io_stat \
--skip test_pid_cmdline_loop \
--skip record_replay_integration \
$_skip_btrfs
}
@ -89,6 +91,7 @@ package() {
sha512sums="
3ec9b2f598502e53f1eeddb6494247c69bb62aa2db97566137dcafbae7138c9ba779ff6f002f772b91f6744354e45387a29a36171f1b438bb21ce30ea2100c06 below-0.11.0.tar.gz
1f9a380537bfab93d5b5184ffb82b0b737428c3672344b8d71ed12d18c1c798cfdaa8e5713be21551ad7e8dc1f4c6b653f1309852355daf86d45bfadd3ca37c3 fix-sudotest.patch
d00fd37063841b4e77939e5280c31be750fcb2334c18c85b9467d08f1d3604cb119d1a37998f440e6da432cc18ac7698bc27987c45986212fc5ef1b871fa48b6 fix-exitstat-mm-struct-cast.patch
e15900998f592e5d519a3698aa861d77269e2196414ed69dacfbdc23a3df355b0f95cc64abc18ddcbf7b4fadafd27ee6cf6a75631d6771cf69c23cb45988c8d9 below.initd
05ca8ad81eaf6f5ccccef2e79dd9b9ec7fc296cf184128da8d99b94a6462db822cd76f42ffbecee7db009e7905c5e4bc31939fb905a80ab4faa9b10e93f9479e below.confd
f9aa8f1d598603898396bde7404e511ccac0887e6dafd2db0b749efe255855bccb724a4969a93a29e437d344523a24859daedd8d21ad02f8fd2c70f03c6b74e5 below.logrotate

View File

@ -0,0 +1,20 @@
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]);