[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKH8qBv=E9dY+pOtrsN+UK1C=rQm=8Awgyr8G8mHMM9tGC_pEg@mail.gmail.com>
Date: Wed, 23 Nov 2022 10:43:16 -0800
From: Stanislav Fomichev <sdf@...gle.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
yhs@...com, john.fastabend@...il.com, kpsingh@...nel.org,
haoluo@...gle.com, jolsa@...nel.org,
David Ahern <dsahern@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Willem de Bruijn <willemb@...gle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Anatoly Burakov <anatoly.burakov@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Magnus Karlsson <magnus.karlsson@...il.com>,
Maryam Tahhan <mtahhan@...hat.com>, xdp-hints@...-project.net,
netdev@...r.kernel.org
Subject: Re: [xdp-hints] [PATCH bpf-next v2 2/8] bpf: XDP metadata RX kfuncs
On Wed, Nov 23, 2022 at 6:24 AM Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> > static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
> > struct bpf_insn *insn_buf, int insn_idx, int *cnt)
> > {
> > @@ -15181,6 +15200,15 @@ static int fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
> > return -EINVAL;
> > }
> >
> > + if (resolve_prog_type(env->prog) == BPF_PROG_TYPE_XDP) {
> > + int imm = fixup_xdp_kfunc_call(env, insn->imm);
> > +
> > + if (imm) {
> > + insn->imm = imm;
> > + return 0;
>
> This needs to also set *cnt = 0 before returning; otherwise the verifier
> can do some really weird instruction rewriting that leads to the JIT
> barfing on invalid instructions (as I just found out while trying to
> test this).
Oops, that was me not paying too much attention during the merge..
Yonghong actually did some kfunc unrolling, yay :-)
Powered by blists - more mailing lists