libbpf: Add gating for arena globals relocation feature
authorEmil Tsalapatis <emil@etsalapatis.com>
Tue, 10 Feb 2026 18:45:32 +0000 (13:45 -0500)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 13 Feb 2026 22:14:27 +0000 (14:14 -0800)
commit728ff167910ef16e97717719c749ddf4064c653b
tree0aa0fbb7bc5780f0e19420d02670cae885049707
parent44331bd6a6107a33f8082521b227ffa4ec063a40
libbpf: Add gating for arena globals relocation feature

Add feature gating for the arena globals relocation introduced in
commit c1f61171d44b. The commit depends on a previous commit in the
same patchset that is absent from older kernels
(12a1fe6e12db "bpf/verifier: Do not limit maximum direct offset into arena map").

Without this commit, arena globals relocation with arenas >= 512MiB
fails to load and breaks libbpf's backwards compatibility.

Introduce a libbpf feature to check whether the running kernel allows for
full range ldimm64 offset, and only relocate arena globals if it does.

Fixes: c1f61171d44b ("libbpf: Move arena globals to the end of the arena")
Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260210184532.255475-1-emil@etsalapatis.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/features.c
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf_internal.h