[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0f90bdb8ddc66b05f9f4fa0fb56464d57178526.camel@gmail.com>
Date: Mon, 03 Feb 2025 21:59:24 -0800
From: Eduard Zingerman <eddyz87@...il.com>
To: Amery Hung <ameryhung@...il.com>, netdev@...r.kernel.org
Cc: bpf@...r.kernel.org, daniel@...earbox.net, andrii@...nel.org,
alexei.starovoitov@...il.com, martin.lau@...nel.org, kuba@...nel.org,
edumazet@...gle.com, xiyou.wangcong@...il.com, cong.wang@...edance.com,
jhs@...atatu.com, sinquersw@...il.com, toke@...hat.com, jiri@...nulli.us,
stfomichev@...il.com, ekarani.silvestre@....ufcg.edu.br,
yangpeihao@...u.edu.cn, yepeilin.cs@...il.com, ming.lei@...hat.com,
kernel-team@...a.com
Subject: Re: [PATCH bpf-next v3 10/18] bpf: Search and add kfuncs in
struct_ops prologue and epilogue
On Fri, 2025-01-31 at 11:28 -0800, Amery Hung wrote:
> From: Amery Hung <amery.hung@...edance.com>
>
> Currently, add_kfunc_call() is only invoked once before the main
> verification loop. Therefore, the verifier could not find the
> bpf_kfunc_btf_tab of a new kfunc call which is not seen in user defined
> struct_ops operators but introduced in gen_prologue or gen_epilogue
> during do_misc_fixup(). Fix this by searching kfuncs in the patching
> instruction buffer and add them to prog->aux->kfunc_tab.
>
> Signed-off-by: Amery Hung <amery.hung@...edance.com>
> ---
Acked-by: Eduard Zingerman <eddyz87@...il.com>
[...]
> @@ -20397,6 +20412,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
> return -ENOMEM;
> env->prog = new_prog;
> delta += cnt - 1;
> +
> + ret = add_kfunc_in_insns(env, epilogue_buf, epilogue_cnt - 1);
Rant: the -1 here is a bit confusing, it is second time I forget that
last instruction of the epilogue has to be some kind of control flow,
and last instruction of the prologue has to be first instruction
of the program.
> + if (ret < 0)
> + return ret;
> }
> }
>
[...]
Powered by blists - more mailing lists