bpf: offload: reorder offload callback 'prepare' in verifier
Subsystems (4)
PATCH 1/1 bpf: offload: reorder offload callback 'prepare' in verifier
From: Yinjun Zhang <[email protected]>
Commit 4976b718c355 ("bpf: Introduce pseudo_btf_id") switched the order of resolve_pseudo_ldimm(), in which some pseudo instructions are rewritten. Thus those rewritten instructions cannot be passed to driver via 'prepare' offload callback.
Reorder the 'prepare' offload callback to fix it.
--- kernel/bpf/verifier.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/bpf/verifier.c +6 -6
@@ -13368,12 +13368,6 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr,if (is_priv) env->test_state_freq = attr->prog_flags &BPF_F_TEST_STATE_FREQ ; -if (bpf_prog_is_dev_bound (env->prog->aux)) { - ret =bpf_prog_offload_verifier_prep (env->prog); -if (ret) - goto skip_full_check; - } - env->explored_states =kvcalloc (state_htab_size (env),sizeof (struct bpf_verifier_state_list *),GFP_USER );
@@ -13401,6 +13395,12 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr,if (ret <0 ) goto skip_full_check; +if (bpf_prog_is_dev_bound (env->prog->aux)) { + ret =bpf_prog_offload_verifier_prep (env->prog); +if (ret) + goto skip_full_check; + } + ret =check_cfg (env);if (ret <0 ) goto skip_full_check;
Signature · 1 line
2.20.1
Quoted 8 lines · Simon Horman
From: Yinjun Zhang <[email protected]>
Commit
4976b718c355("bpf: Introducepseudo_btf_id") switched the order ofresolve_pseudo_ldimm(), in which some pseudo instructions are rewritten. Thus those rewritten instructions cannot be passed to driver via 'prepare' offload callback.
Quoted 5 lines
Reorder the 'prepare' offload callback to fix it.
Fixes 4976b718c355 ("bpf: Introduce pseudo_btf_id")Signed-off-by Yinjun Zhang <[email protected]>Signed-off-by Simon Horman <[email protected]>
Quoted 37 lines
--- kernel/bpf/verifier.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)kernel/bpf/verifier.c +6
-7@@ -13368,12 +13368,6 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr,if (is_priv) env->test_state_freq = attr->prog_flags &BPF_F_TEST_STATE_FREQ ; -if (bpf_prog_is_dev_bound (env->prog->aux)) { - ret =bpf_prog_offload_verifier_prep (env->prog); -if (ret) - goto skip_full_check; - } - env->explored_states =kvcalloc (state_htab_size (env),sizeof (struct bpf_verifier_state_list *),GFP_USER );@@ -13401,6 +13395,12 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr,if (ret <0 ) goto skip_full_check; +if (bpf_prog_is_dev_bound (env->prog->aux)) { + ret =bpf_prog_offload_verifier_prep (env->prog); +if (ret) + goto skip_full_check; + } + ret =check_cfg (env);if (ret <0 ) goto skip_full_check; --2.20.1
This patch was applied to bpf/bpf.git (refs/heads/master):
Hello:
This patch was applied to bpf/bpf.git (refs/heads/master):
Quoted 8 lines · On Thu, 20 May 2021 10:58:34 +0200 you wrote:
From: Yinjun Zhang <[email protected]>
Commit
4976b718c355("bpf: Introducepseudo_btf_id") switched the order ofresolve_pseudo_ldimm(), in which some pseudo instructions are rewritten. Thus those rewritten instructions cannot be passed to driver via 'prepare' offload callback.[...]
Here is the summary with links:
- [bpf] bpf: offload: reorder offload callback 'prepare' in verifier
https://git.kernel.org/bpf/bpf/c/ceb11679d9fc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html