[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200729185500.GN1319041@krava>
Date: Wed, 29 Jul 2020 20:55:00 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Martin KaFai Lau <kafai@...com>,
David Miller <davem@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Wenbo Zhang <ethercflow@...il.com>,
KP Singh <kpsingh@...omium.org>,
Brendan Gregg <bgregg@...flix.com>,
Florent Revest <revest@...omium.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v8 bpf-next 07/13] bpf: Add btf_struct_ids_match function
On Wed, Jul 29, 2020 at 10:51:26AM -0700, Andrii Nakryiko wrote:
> On Wed, Jul 29, 2020 at 9:04 AM Jiri Olsa <jolsa@...hat.com> wrote:
> >
> > On Tue, Jul 28, 2020 at 04:35:16PM -0700, Andrii Nakryiko wrote:
> >
> > SNIP
> >
> > > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> > > > index bae557ff2da8..c981e258fed3 100644
> > > > --- a/include/linux/bpf.h
> > > > +++ b/include/linux/bpf.h
> > > > @@ -1306,6 +1306,8 @@ int btf_struct_access(struct bpf_verifier_log *log,
> > > > const struct btf_type *t, int off, int size,
> > > > enum bpf_access_type atype,
> > > > u32 *next_btf_id);
> > > > +bool btf_struct_ids_match(struct bpf_verifier_log *log,
> > > > + int off, u32 id, u32 mid);
> > > > int btf_resolve_helper_id(struct bpf_verifier_log *log,
> > > > const struct bpf_func_proto *fn, int);
> > > >
> > > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> > > > index 1ab5fd5bf992..562d4453fad3 100644
> > > > --- a/kernel/bpf/btf.c
> > > > +++ b/kernel/bpf/btf.c
> > > > @@ -4140,6 +4140,35 @@ int btf_struct_access(struct bpf_verifier_log *log,
> > > > return -EINVAL;
> > > > }
> > > >
> > > > +bool btf_struct_ids_match(struct bpf_verifier_log *log,
> > > > + int off, u32 id, u32 mid)
>
> just realized that if id == mid and off == 0, btf_struct_ids_match()
> will return false. Right now verifier is careful to not call
> btf_struct_ids_match in such case, but I wonder if it's better to make
> that (common) case also work?
right, also we should call btf_struct_ids_match when
IDs are equal and off != 0, which we don't do now
jirka
Powered by blists - more mailing lists