Re: [RFC PATCH bpf-next 2/5] bpf: assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 5, 2020 at 7:19 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> 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.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux