diff mbox series

[bpf] bpf: offload: reorder offload callback 'prepare' in verifier

Message ID 20210520085834.15023-1-simon.horman@netronome.com (mailing list archive)
State Accepted
Commit ceb11679d9fcf3fdb358a310a38760fcbe9b63ed
Delegated to: BPF
Headers show
Series [bpf] bpf: offload: reorder offload callback 'prepare' in verifier | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: haoluo@google.com; 6 maintainers not CCed: haoluo@google.com yhs@fb.com kpsingh@kernel.org kafai@fb.com john.fastabend@gmail.com songliubraving@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 20 this patch: 20
netdev/header_inline success Link

Commit Message

Simon Horman May 20, 2021, 8:58 a.m. UTC
From: Yinjun Zhang <yinjun.zhang@corigine.com>

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.

Fixes: 4976b718c355 ("bpf: Introduce pseudo_btf_id")
Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
 kernel/bpf/verifier.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Song Liu May 20, 2021, 8:19 p.m. UTC | #1
On Thu, May 20, 2021 at 2:01 AM Simon Horman <simon.horman@netronome.com> wrote:
>
> From: Yinjun Zhang <yinjun.zhang@corigine.com>
>
> 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.
>
> Fixes: 4976b718c355 ("bpf: Introduce pseudo_btf_id")
> Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.com>

Acked-by: Song Liu <songliubraving@fb.com>

> ---
>  kernel/bpf/verifier.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index c58598ef4b5b..09849e43f035 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -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
>
patchwork-bot+netdevbpf@kernel.org May 20, 2021, 10 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Thu, 20 May 2021 10:58:34 +0200 you wrote:
> From: Yinjun Zhang <yinjun.zhang@corigine.com>
> 
> 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.
> 
> [...]

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
diff mbox series

Patch

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index c58598ef4b5b..09849e43f035 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -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;