Skip to content

Commit 52eecfb

Browse files
etsalKernel Patches Daemon
authored andcommitted
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. Signed-off-by: Emil Tsalapatis <[email protected]>
1 parent 750a0d8 commit 52eecfb

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

kernel/bpf/verifier.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21132,11 +21132,6 @@ static int resolve_pseudo_ldimm64(struct bpf_verifier_env *env)
2113221132
} else {
2113321133
u32 off = insn[1].imm;
2113421134

21135-
if (off >= BPF_MAX_VAR_OFF) {
21136-
verbose(env, "direct value offset of %u is not allowed\n", off);
21137-
return -EINVAL;
21138-
}
21139-
2114021135
if (!map->ops->map_direct_value_addr) {
2114121136
verbose(env, "no direct value access support for this map type\n");
2114221137
return -EINVAL;

0 commit comments

Comments
 (0)