bpf: abort verification if env->cur_state->loop_entry != NULL
Eduard Zingerman
maintainerPATCH 1/1 bpf: abort verification if env->cur_state->loop_entry != NULL
In addition to warning abort verification with -EFAULT. If env->cur_state->loop_entry != NULL something is irrecoverably buggy.
Fixes bbbc02b7445e ("bpf: copy_verifier_state() should copy 'loop_entry' field")
Suggested-by Andrii Nakryiko <[email protected]>
Signed-off-by Eduard Zingerman <[email protected]>
--- kernel/bpf/verifier.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +4 -2
@@ -19340,8 +19340,10 @@ static int do_check(struct bpf_verifier_env *env)return err;break ; }else { -if (WARN_ON_ONCE (env->cur_state->loop_entry)) - env->cur_state->loop_entry =NULL ; +if (WARN_ON_ONCE (env->cur_state->loop_entry)) { +verbose (env,"verifier bug: env->cur_state->loop_entry != NULL\n" ); +return -EFAULT ; + } do_print_state = true;continue ; }
Signature · 1 line
2.48.1
Quoted 5 lines · Eduard Zingerman
In addition to warning abort verification with
-EFAULT. Ifenv->cur_state->loop_entry!= NULL something is irrecoverably buggy.
Quoted 7 lines
Fixes bbbc02b7445e ("bpf: copy_verifier_state() should copy 'loop_entry' field")Suggested-by Andrii Nakryiko <[email protected]>Signed-off-by Eduard Zingerman <[email protected]>--- kernel/bpf/verifier.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
that works as well, thanks
Acked-by Andrii Nakryiko <[email protected]>
Quoted 20 lines
kernel/bpf/verifier.c +4
-3@@ -19340,8 +19340,10 @@ static int do_check(struct bpf_verifier_env *env)return err;break ; }else { -if (WARN_ON_ONCE (env->cur_state->loop_entry)) - env->cur_state->loop_entry =NULL ; +if (WARN_ON_ONCE (env->cur_state->loop_entry)) { +verbose (env,"verifier bug: env->cur_state->loop_entry != NULL\n" ); +return -EFAULT ; + } do_print_state = true;continue ; } --2.48.1
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · On Mon, 24 Feb 2025 16:38:38 -0800 you wrote:
In addition to warning abort verification with
-EFAULT. Ifenv->cur_state->loop_entry!= NULL something is irrecoverably buggy.Fixes bbbc02b7445e ("bpf: copy_verifier_state() should copy 'loop_entry' field")Suggested-by Andrii Nakryiko <[email protected]>Signed-off-by Eduard Zingerman <[email protected]>[...]
Here is the summary with links:
- [bpf-next,v1] bpf: abort verification if env->cur_state->loop_entry != NULL
https://git.kernel.org/bpf/bpf-next/c/f3c2d243a36e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html