-
Notifications
You must be signed in to change notification settings - Fork 5
libbpf: move arena variables out of the zero #6454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libbpf: move arena variables out of the zero #6454
Conversation
|
Upstream branch: ff34657 |
52f5a27 to
037d2fc
Compare
|
Upstream branch: ff34657 |
77f21ca to
db40fd1
Compare
037d2fc to
8f722b4
Compare
|
Upstream branch: 8f7aa3d |
db40fd1 to
ed9530c
Compare
8f722b4 to
03e2ed2
Compare
|
Upstream branch: 835a507 |
ed9530c to
02ec9ea
Compare
03e2ed2 to
3ea267d
Compare
|
Upstream branch: 835a507 |
02ec9ea to
c2d56d2
Compare
3ea267d to
6d4eb64
Compare
|
Upstream branch: 835a507 |
c2d56d2 to
4531a53
Compare
6d4eb64 to
af4bac7
Compare
|
Upstream branch: 81f88f6 |
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]>
4531a53 to
4444a3d
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1030172 expired. Closing PR. |
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