]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nsresourced: Fix declaration of bpf_rdonly_cast()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 3 Oct 2024 08:46:27 +0000 (10:46 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 3 Oct 2024 11:24:51 +0000 (12:24 +0100)
Fixes compilation error

"""
[780/3171] /usr/bin/clang -std=gnu11 -Wno-compare-distinct-pointer-types -fno-stack-protector -O2 -target bpf -g -c -D__aarch64__ -I. -isystem /usr/include/ -idirafter /usr/include ../src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c -o src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.unstripped.o -I/usr/src/kernels/6.11.1-0.hs1.hs+fb.el9.aarch64
FAILED: src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.unstripped.o
/usr/bin/clang -std=gnu11 -Wno-compare-distinct-pointer-types -fno-stack-protector -O2 -target bpf -g -c -D__aarch64__ -I. -isystem /usr/include/ -idirafter /usr/include ../src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c -o src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.unstripped.o -I/usr/src/kernels/6.11.1-0.hs1.hs+fb.el9.aarch64
../src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c:27:7: error: conflicting types for 'bpf_rdonly_cast'
   27 | void *bpf_rdonly_cast(void *, __u32) __ksym;
      |       ^
/usr/src/kernels/6.11.1-0.hs1.hs+fb.el9.aarch64/vmlinux.h:143063:14: note: previous declaration is here
 143063 | extern void *bpf_rdonly_cast(const void *obj__ign, u32 btf_id__k) __weak __ksym;
        |              ^
1 error generated.
"""

src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c

index 126422bb69cc15b5f20c3966e16d5a2210f9decd..0ff41a138bee96922d61f8d191422823ef93bc53 100644 (file)
@@ -24,7 +24,7 @@
 /* bpf_rdonly_cast() was introduced in libbpf commit 688879f together with
  * the definition of a bpf_core_cast macro. So use that one to avoid
  * defining a prototype for bpf_rdonly_cast */
-void *bpf_rdonly_cast(void *, __u32) __ksym;
+void* bpf_rdonly_cast(const void *, __u32) __ksym;
 #endif
 
 /* BPF module that implements an allowlist of mounts (identified by mount ID) for user namespaces (identified