[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbtsaNRJ0pGFFj+yD4NFAzPp3EXp1trabqT+ic1xWajxQ@mail.gmail.com>
Date: Thu, 5 Nov 2020 19:43:31 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [RFC PATCH bpf-next 2/5] bpf: assign ID to vmlinux BTF and return
extra info for BTF in GET_OBJ_INFO
On Thu, Nov 5, 2020 at 7:19 PM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Wed, Nov 04, 2020 at 08:51:37PM -0800, Andrii Nakryiko wrote:
> > @@ -215,6 +215,8 @@ struct btf {
> > struct btf *base_btf;
> > u32 start_id; /* first type ID in this BTF (0 for base BTF) */
> > u32 start_str_off; /* first string offset (0 for base BTF) */
> > + char name[MODULE_NAME_LEN];
> > + bool kernel_btf;
> > };
> >
> > enum verifier_phase {
> > @@ -4441,6 +4443,7 @@ struct btf *btf_parse_vmlinux(void)
> >
> > btf->data = __start_BTF;
> > btf->data_size = __stop_BTF - __start_BTF;
> > + btf->kernel_btf = true;
>
> imo it's a bit weird for vmlinux's BTF to be flagged as 'kernel_btf'
> and empty name, but kernel module's BTFs will not be marked as kernel,
> but will have a name.
module's BTF also has kernel_btf = true, see patch 4; would be weird otherwise
> I think it's more natural to make vmlinux and module's BTF with kernel_btf=true flag
> and give "vmlinux" name to base kernel BTF.
Yeah, I was wondering if I should name vmlinux BTF as "vmlinux"
explicitly, for whatever reason I decided to go with an empty name.
But I think it's not a bad idea to give it an explicit "vmlinux" name.
I'll do that in the next version. Will make bpftool logic more
straightforward as well.
> If somebody creates a kernel module with "vmlinux" name we will have a conflict,
> but that name is for human pretty printing only anyway, so I think it's fine.
yep.
Powered by blists - more mailing lists