Re: [RFC PATCH bpf-next 4/5] bpf: load and verify kernel module BTFs

From: Jakub Kicinski
Date: Thu Nov 05 2020 - 11:59:23 EST


On Thu, 5 Nov 2020 17:46:16 +0100 Greg Kroah-Hartman wrote:
> On Thu, Nov 05, 2020 at 08:39:25AM -0800, Jakub Kicinski wrote:
> > On Wed, 4 Nov 2020 20:51:39 -0800 Andrii Nakryiko wrote:
> > > Add kernel module listener that will load/validate and unload module BTF.
> > > Module BTFs gets ID generated for them, which makes it possible to iterate
> > > them with existing BTF iteration API. They are given their respective module's
> > > names, which will get reported through GET_OBJ_INFO API. They are also marked
> > > as in-kernel BTFs for tooling to distinguish them from user-provided BTFs.
> > >
> > > Also, similarly to vmlinux BTF, kernel module BTFs are exposed through
> > > sysfs as /sys/kernel/btf/<module-name>. This is convenient for user-space
> > > tools to inspect module BTF contents and dump their types with existing tools:
> >
> > Is there any precedent for creating per-module files under a new
> > sysfs directory structure? My intuition would be that these files
> > belong under /sys/module/
>
> Ick, why? What's wrong with them under btf? The module core code
> "owns" the /sys/modules/ tree. If you want others to mess with that,
> it will get tricky.

It's debug info, that's where I would look for it.

Clearly I'd be wrong to do so :)