Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: libbpf: move arena variables out of the zero
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172

@kernel-patches-daemon-bpf-rc
Copy link
Author

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

@kernel-patches-daemon-bpf-rc
Copy link
Author

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

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 8f7aa3d
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 835a507
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 835a507
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 835a507
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172
version: 2

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 81f88f6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172
version: 2

etsal added 4 commits December 5, 2025 16:02
The big_alloc1 test in verifier_arena_large assumes that the arena base
and the first page allocated by bpf_arena_alloc_pages are identical.
This is not the case, because the first page in the arena is populated
by global arena data. The test still passes because the code makes the
tacit assumption that the first page is on offset PAGE_SIZE instead of
0.

Make this distinction explicit in the code, and adjust the page offsets
requested during the test to count from the beginning of the arena
instead of using the address of the first allocated page.

Reviewed-by: Eduard Zingerman <[email protected]>
Signed-off-by: Emil Tsalapatis <[email protected]>
The verifier currently limits direct offsets into a map to 512MiB
to avoid overflow during pointer arithmetic. However, this prevents
arena maps from using direct addressing instructions to access data
at the end of > 512MiB arena maps. This is necessary when moving
arena globals to the end of the arena instead of the front.

Relax the limitation for direct offsets into arena maps to 4GiB,
the maximum arena size.

Signed-off-by: Emil Tsalapatis <[email protected]>
Arena globals are currently placed at the beginning of the arena
by libbpf. This is convenient, but prevents users from reserving
guard pages in the beginning of the arena to identify NULL pointer
dereferences. Adjust the load logic to place the globals at the
end of the arena instead.

Also modify bpftool to set the arena pointer in the program's BPF
skeleton to point to the globals. Users now call bpf_map__initial_value()
to find the beginning of the arena mapping and use the arena pointer
in the skeleton to determine which part of the mapping holds the
arena globals and which part is free.

Suggested-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Emil Tsalapatis <[email protected]>
Add tests for the new libbpf globals arena offset logic. The
tests cover all three cases: The globals being small enough
to be placed at the maximum possible offset, being as large as
the arena itself and being placed at the very beginning, and
requiring an intermediate offset into the arena.

Signed-off-by: Emil Tsalapatis <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172 expired. Closing PR.

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.

2 participants