]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf/verifier: Do not limit maximum direct offset into arena map
authorEmil Tsalapatis <emil@etsalapatis.com>
Tue, 16 Dec 2025 17:33:22 +0000 (12:33 -0500)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 16 Dec 2025 18:42:55 +0000 (10:42 -0800)
commit12a1fe6e12dbad39f2f0dad1a385625f0298eff4
tree2168a43630d02d66561c74bb21adde2dba298726
parent0355911ac021a424b18d2d746536d70b879cdeab
bpf/verifier: Do not limit maximum direct offset into arena map

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.

Refactor the verifier code to remove the offset calculation during
direct value access calculations. This is possible because the only
two map types that implement .map_direct_value_addr() are arrays and
arenas, and they both do their own internal checks to ensure the
offset is within bounds.

Adjust selftests that expect the old error. These tests still fail
because the verifier identifies the access as out of bounds for the
map, so change them to expect an "invalid access to map value pointer"
error instead.

Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20251216173325.98465-3-emil@etsalapatis.com
kernel/bpf/verifier.c
tools/testing/selftests/bpf/verifier/direct_value_access.c