From c3bad688114d61913be458c440e3452a0a8d4e2a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Oct 07 2024 12:10:23 +0000 Subject: Backport fix for declaration of bpf_rdonly_cast() --- diff --git a/34621.patch b/34621.patch new file mode 100644 index 0000000..e6fe21f --- /dev/null +++ b/34621.patch @@ -0,0 +1,36 @@ +From 7759cc92c07c86272bdc91c18e66646920bde0f6 Mon Sep 17 00:00:00 2001 +From: Daan De Meyer +Date: Thu, 3 Oct 2024 10:46:27 +0200 +Subject: [PATCH] nsresourced: Fix declaration of bpf_rdonly_cast() + +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 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c b/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c +index 126422bb69cc1..0ff41a138bee9 100644 +--- a/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c ++++ b/src/nsresourced/bpf/userns_restrict/userns-restrict.bpf.c +@@ -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 diff --git a/systemd.spec b/systemd.spec index 0279b07..9b38272 100644 --- a/systemd.spec +++ b/systemd.spec @@ -44,7 +44,7 @@ Url: https://systemd.io # Allow users to specify the version and release when building the rpm by # setting the %%version_override and %%release_override macros. Version: %{?version_override}%{!?version_override:256.6} -Release: %{?release_override}%{!?release_override:1.3}%{?dist} +Release: %{?release_override}%{!?release_override:1.4}%{?dist} %global stable %(c="%version"; [ "$c" = "${c#*.*}" ]; echo $?) @@ -113,6 +113,9 @@ Patch0010: https://github.com/systemd/systemd/pull/26494.patch # Requested in https://bugzilla.redhat.com/show_bug.cgi?id=2298422 Patch0011: https://github.com/systemd/systemd/pull/33738.patch +# Fix nsresourced compilation issue on aarch64. +Patch0012: https://github.com/systemd/systemd/pull/34621.patch + # Those are downstream-only patches, but we don't want them in packit builds: # https://bugzilla.redhat.com/show_bug.cgi?id=2251843 Patch0491: https://github.com/systemd/systemd/pull/30846.patch