Skip to content

Commit 6b84d78

Browse files
luisgerhorstAlexei Starovoitov
authored andcommitted
bpf: Return -EFAULT on internal errors
This prevents us from trying to recover from these on speculative paths in the future. Signed-off-by: Luis Gerhorst <[email protected]> Reviewed-by: Eduard Zingerman <[email protected]> Acked-by: Kumar Kartikeya Dwivedi <[email protected]> Acked-by: Henriette Herzog <[email protected]> Cc: Maximilian Ott <[email protected]> Cc: Milan Stephan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent fd508bd commit 6b84d78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/bpf/verifier.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11654,7 +11654,7 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn
1165411654
verbose(env, "verifier internal error:");
1165511655
verbose(env, "func %s has non-overwritten BPF_PTR_POISON return type\n",
1165611656
func_id_name(func_id));
11657-
return -EINVAL;
11657+
return -EFAULT;
1165811658
}
1165911659
ret_btf = btf_vmlinux;
1166011660
ret_btf_id = *fn->ret_btf_id;
@@ -15287,12 +15287,12 @@ static int adjust_reg_min_max_vals(struct bpf_verifier_env *env,
1528715287
if (WARN_ON_ONCE(ptr_reg)) {
1528815288
print_verifier_state(env, vstate, vstate->curframe, true);
1528915289
verbose(env, "verifier internal error: unexpected ptr_reg\n");
15290-
return -EINVAL;
15290+
return -EFAULT;
1529115291
}
1529215292
if (WARN_ON(!src_reg)) {
1529315293
print_verifier_state(env, vstate, vstate->curframe, true);
1529415294
verbose(env, "verifier internal error: no src_reg\n");
15295-
return -EINVAL;
15295+
return -EFAULT;
1529615296
}
1529715297
err = adjust_scalar_min_max_vals(env, insn, dst_reg, *src_reg);
1529815298
if (err)

0 commit comments

Comments
 (0)