[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191230192245.GA18663@chromium.org>
Date: Mon, 30 Dec 2019 20:22:45 +0100
From: KP Singh <kpsingh@...omium.org>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: open list <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, linux-security-module@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
James Morris <jmorris@...ei.org>,
Kees Cook <keescook@...omium.org>,
Thomas Garnier <thgarnie@...omium.org>,
Michael Halcrow <mhalcrow@...gle.com>,
Paul Turner <pjt@...gle.com>,
Brendan Gregg <brendan.d.gregg@...il.com>,
Jann Horn <jannh@...gle.com>,
Matthew Garrett <mjg59@...gle.com>,
Christian Brauner <christian@...uner.io>,
Mickaël Salaün <mic@...ikod.net>,
Florent Revest <revest@...omium.org>,
Brendan Jackman <jackmanb@...omium.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
"Serge E. Hallyn" <serge@...lyn.com>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Stanislav Fomichev <sdf@...gle.com>,
Quentin Monnet <quentin.monnet@...ronome.com>,
Andrey Ignatov <rdna@...com>, Joe Stringer <joe@...d.net.nz>
Subject: Re: [PATCH bpf-next v1 04/13] bpf: lsm: Allow btf_id based
attachment for LSM hooks
On 23-Dez 15:54, Andrii Nakryiko wrote:
> On Fri, Dec 20, 2019 at 7:42 AM KP Singh <kpsingh@...omium.org> wrote:
> >
> > From: KP Singh <kpsingh@...gle.com>
> >
> > Refactor and re-use most of the logic for BPF_PROG_TYPE_TRACING with a few
> > changes.
> >
> > - The LSM hook BTF types are prefixed with "lsm_btf_"
Got rid of this for v2 as we are using trampoline. Will keep this in
mind if we ever need to generate type information. Thanks!
>
> btf_trace_ and btf_struct_ops all have btf_ first, let's keep this consistent.
>
> > - These types do not need the first (void *) pointer argument. The verifier
> > only looks for this argument if prod->aux->attach_btf_trace is set.
> >
> > Signed-off-by: KP Singh <kpsingh@...gle.com>
> > ---
> > kernel/bpf/syscall.c | 1 +
> > kernel/bpf/verifier.c | 83 ++++++++++++++++++++++++++++++++++++++++---
> > 2 files changed, 80 insertions(+), 4 deletions(-)
> >
>
> [...]
>
> > +
> > + t = btf_type_by_id(btf_vmlinux, btf_id);
> > + if (!t) {
> > + verbose(env, "attach_btf_id %u is invalid\n", btf_id);
> > + return -EINVAL;
> > + }
> > +
> > + tname = btf_name_by_offset(btf_vmlinux, t->name_off);
> > + if (!tname) {
>
> it can be empty, so better: !tname || !tname[0]
Will fix the usages in v2.
- KP
>
> > + verbose(env, "attach_btf_id %u doesn't have a name\n", btf_id);
> > + return -EINVAL;
> > + }
> > +
>
> [...]
Powered by blists - more mailing lists