On Wed, 2024-02-21 at 17:25 +0100, Benjamin Tissoires wrote:

[...]

> @@ -12120,6 +12137,16 @@ static int check_kfunc_call(struct bpf_verifier_env 
> *env, struct bpf_insn *insn,
>               }
>       }
>  
> +     if (is_async_callback_calling_kfunc(meta.func_id)) {

I think that it's better to check specific kfunc id here:

  meta.func_id == special_kfunc_list[KF_bpf_timer_set_sleepable_cb_impl]

In case if some new async callback calling kfunc would be added,
for which set_timer_callback_state() won't be correct.

> +             err = push_callback_call(env, insn, insn_idx, meta.subprogno,
> +                                      set_timer_callback_state);
> +             if (err) {
> +                     verbose(env, "kfunc %s#%d failed callback 
> verification\n",
> +                             func_name, meta.func_id);
> +                     return err;
> +             }
> +     }
> +
>       rcu_lock = is_kfunc_bpf_rcu_read_lock(&meta);
>       rcu_unlock = is_kfunc_bpf_rcu_read_unlock(&meta);
>  
> 


Reply via email to