[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQL0rLLUMUcfdu=-dc2BCe8AQg5oz+gt+6j95y9V1DFEYA@mail.gmail.com>
Date: Tue, 26 Apr 2022 11:30:40 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Menglong Dong <menglong8.dong@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Ahern <dsahern@...nel.org>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, benbjiang@...cent.com,
Hao Peng <flyingpeng@...cent.com>,
Menglong Dong <imagedong@...cent.com>,
Eric Dumazet <edumazet@...gle.com>,
Martin KaFai Lau <kafai@...com>,
Talal Ahmad <talalahmad@...gle.com>,
Kees Cook <keescook@...omium.org>,
Mengen Sun <mengensun@...cent.com>, dongli.zhang@...cle.com,
LKML <linux-kernel@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH] bpf: init map_btf_id during compiling
On Tue, Apr 26, 2022 at 11:26 AM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Sun, Apr 24, 2022 at 05:26:13PM +0800, menglong8.dong@...il.com wrote:
> > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> > index 0918a39279f6..588a001cc767 100644
> > --- a/kernel/bpf/btf.c
> > +++ b/kernel/bpf/btf.c
> > @@ -4727,30 +4727,6 @@ static const struct bpf_map_ops * const btf_vmlinux_map_ops[] = {
> > #undef BPF_MAP_TYPE
> > };
> >
> > -static int btf_vmlinux_map_ids_init(const struct btf *btf,
> > - struct bpf_verifier_log *log)
> > -{
> > - const struct bpf_map_ops *ops;
> > - int i, btf_id;
> > -
> > - for (i = 0; i < ARRAY_SIZE(btf_vmlinux_map_ops); ++i) {
> > - ops = btf_vmlinux_map_ops[i];
> > - if (!ops || (!ops->map_btf_name && !ops->map_btf_id))
> > - continue;
> > - if (!ops->map_btf_name || !ops->map_btf_id) {
> > - bpf_log(log, "map type %d is misconfigured\n", i);
> > - return -EINVAL;
> > - }
> > - btf_id = btf_find_by_name_kind(btf, ops->map_btf_name,
> > - BTF_KIND_STRUCT);
> > - if (btf_id < 0)
> > - return btf_id;
> > - *ops->map_btf_id = btf_id;
> > - }
> > -
> > - return 0;
> > -}
> > -
> > static int btf_translate_to_vmlinux(struct bpf_verifier_log *log,
> > struct btf *btf,
> > const struct btf_type *t,
> > @@ -4812,11 +4788,6 @@ struct btf *btf_parse_vmlinux(void)
> > /* btf_parse_vmlinux() runs under bpf_verifier_lock */
> > bpf_ctx_convert.t = btf_type_by_id(btf, bpf_ctx_convert_btf_id[0]);
> >
> > - /* find bpf map structs for map_ptr access checking */
> > - err = btf_vmlinux_map_ids_init(btf, log);
> > - if (err < 0)
> > - goto errout;
> > -
>
> Looks nice. Please address build warn and resubmit.
Just noticed v2. Ignore the above.
Powered by blists - more mailing lists