]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nsresourced: don't redefine of bpf_rdonly_cast
authorLudwig Nussel <ludwig.nussel@suse.de>
Mon, 8 Apr 2024 09:07:10 +0000 (11:07 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 11 Apr 2024 20:55:27 +0000 (05:55 +0900)
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;

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

index c9a936ba13c71bd44f325894802ced8962d1b670..126422bb69cc15b5f20c3966e16d5a2210f9decd 100644 (file)
 #include <bpf/bpf_core_read.h>
 #include <errno.h>
 
+#ifndef bpf_core_cast
+/* 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;
+#endif
 
 /* BPF module that implements an allowlist of mounts (identified by mount ID) for user namespaces (identified
  * by their inode number in nsfs) that restricts creation of inodes (which would inherit the callers UID/GID)