Skip to content

libbpf: Add gating for arena globals relocation feature#11002

Closed
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1052461=>bpf-next
Closed

libbpf: Add gating for arena globals relocation feature#11002
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1052461=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link

Pull request for series with
subject: libbpf: Add gating for arena globals relocation feature
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1052461

Add feature gating for the arena globals relocation introduced in
commit c1f6117. The commit depends on a previous commit in the
same patchset that is absent from older kernels (12a1fe6,
"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 includes
patch 12a1fe6, and only relocate arena globals if it does.

CHANGELOG
---------

v1 -> v2 (https://lore.kernel.org/bpf/20260209210240.2051209-1-emil@etsalapatis.com/)

- Reworked test to use simpler array-based program (Andrii)

Fixes: c1f6117 ("libbpf: Move arena globals to the end of the arena")
Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: db975de
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1052461
version: 2

@kernel-patches-review-bot
Copy link

commit 191fe04e749a644ea3d23633b7b5a0759c053f66
Author: Emil Tsalapatis <emil@etsalapatis.com>

libbpf: Add gating for arena globals relocation feature

This commit adds feature gating for arena globals relocation to maintain
backwards compatibility with older kernels that lack the verifier patch
12a1fe6e12db ("bpf/verifier: Do not limit maximum direct offset into
arena map").

> diff --git a/tools/lib/bpf/features.c b/tools/lib/bpf/features.c
> index b842b83e2480..b1a088dd83ac 100644
> --- a/tools/lib/bpf/features.c
> +++ b/tools/lib/bpf/features.c

[ ... ]

> @@ -581,6 +670,9 @@ static struct kern_feature_desc {
>  	[FEAT_BTF_QMARK_DATASEC] = {
>  		"BTF DATASEC names starting from '?'", probe_kern_btf_qmark_datasec,
>  	},
> +	[FEAT_ARENA_GLOBAL_RELOC] = {
> +		"Relocatable arena globals support", probe_kern_arena_global_reloc,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In the v1 review, Andrii requested naming the feature based on what is
being detected rather than what the feature is used for:

    "we don't detect 'relocatable arena globals support', we detect if
    ldimm64 allows full range offsets, so call the detector as such
    (i.e., what you detect, not what for you are doing that)."

https://lore.kernel.org/bpf/CAEf4BzYz3KBUyqR+OJCMns2Edsd+Dhyij=f8cqSEyY9OG0KCdw@mail.gmail.com/

The feature name and description still describe the use case rather than
what the probe actually detects (whether ldimm64 allows full range
offsets). Should the naming be updated to reflect the detection
mechanism?

> +	},
>  };

> diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h
> index fc59b21b51b5..e0223a6e4c95 100644
> --- a/tools/lib/bpf/libbpf_internal.h
> +++ b/tools/lib/bpf/libbpf_internal.h
> @@ -392,6 +392,8 @@ enum kern_feature_id {
>  	FEAT_ARG_CTX_TAG,
>  	/* Kernel supports '?' at the front of datasec names */
>  	FEAT_BTF_QMARK_DATASEC,
> +	/* Kernel supports relocating arena globals to end of the arena */
> +	FEAT_ARENA_GLOBAL_RELOC,

Same naming concern here - the comment and enum name describe the use
case rather than the actual detection mechanism.

>  	__FEAT_CNT,
>  };



AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

In-Reply-To-Subject: libbpf: Add gating for arena globals relocation feature
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21845712046

AI-authorship-score: low
AI-authorship-explanation: The commit follows established libbpf feature probe patterns with appropriate technical detail and changelog formatting typical of experienced kernel developers.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: Unaddressed maintainer request regarding naming convention - feature name describes use case rather than detection mechanism as requested by Andrii Nakryiko.

@kernel-patches-daemon-bpf
Copy link
Author

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/1052461=>bpf-next branch February 12, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant