When i get the modinfo for usbhid, there are no aliases listed: ``` localhost ~ # modinfo usbhid name: usbhid filename: (builtin) author: Andreas Gal author: Vojtech Pavlik author: Jiri Kosina description: USB HID core driver file: drivers/hid/usbhid/usbhid license: GPL parm: quirks:Add/modify USB HID quirks by specifying quirks=vendorID:productID:quirks where vendorID, productID, and quirks are all in 0x-prefixed hex (array of charp) parm: ignoreled:Autosuspend with active leds (uint) parm: kbpoll:Polling interval of keyboards (uint) parm: jspoll:Polling interval of joysticks (uint) parm: mousepoll:Polling interval of mice (uint) ``` bluetooth however has an alias listed: ``` localhost ~ # modinfo bluetooth filename: /lib/modules/5.10.154-20424-gea7532c123d8/kernel/net/bluetooth/bluetooth.ko.gz author: Marcel Holtmann <marcel@xxxxxxxxxxxx> description: Bluetooth Core ver 2.22 version: 2.22 license: GPL alias: net-pf-31 vermagic: 5.10.154-20424-gea7532c123d8 SMP preempt mod_unload name: bluetooth intree: Y retpoline: Y depends: ecdh_generic srcversion: F8E46CD048C50B0AA1CD471 parm: disable_esco:Disable eSCO connection creation (bool) parm: enable_ecred:Enable enhanced credit flow control mode (bool) parm: disable_ertm:Disable enhanced retransmission mode (bool) ``` I believe the reason for this is many modules use `#define MODULE_DEVICE_TABLE(type, name)` which is a noop for buildin modules. I have a local patch that resolves that issue here: See: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3840672/1/include/linux/module.h#b246 However, I probably ought to rework that patch to create the MODULE_ALIAS defines instead of the buildin.alias file. On Tue, Nov 15, 2022 at 11:35 AM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote: > > On Tue, Nov 15, 2022 at 10:05:35AM -0600, Allen Webb wrote: > > On Mon, Nov 14, 2022 at 11:22 AM Lucas De Marchi > > <lucas.demarchi@xxxxxxxxx> wrote: > > > > > > On Mon, Nov 14, 2022 at 10:42:50AM -0600, Allen Webb wrote: > > > >On Fri, Nov 11, 2022 at 12:29 PM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote: > > > >> > > > >> On Fri, Nov 11, 2022 at 09:28:52AM -0600, Allen Webb wrote: > > > >> > USB devices support the authorized attribute which can be used by > > > >> > user-space to implement trust-based systems for enabling USB devices. It > > > >> > would be helpful when building these systems to be able to know in > > > >> > advance which kernel drivers (or modules) are reachable from a > > > >> > particular USB device. > > > >> > > > > >> > This information is readily available for external modules in > > > >> > modules.alias. However, builtin kernel modules are not covered. This > > > >> > patch adds a sys-fs attribute to both builtin and loaded modules > > > >> > exposing the matching rules in the modalias format for integration > > > >> > with tools like USBGuard. > > > >> > > > > >> > Signed-off-by: Allen Webb <allenwebb@xxxxxxxxxx> > > > >> > > > >> Thanks for the patch Allen! > > > >> > > > >> I'd rather have something generic though, and it would seem kmod [0] already > > > >> does this, have you seen the kmod support for builtin.alias.bin > > > >> > > > >> Can't that be used? > > > > > > > >Probably, but I don't see the builtin.alias.bin in my build. Is it experimental? > > > > > > no. That is generated by depmod since v27 using modules.builtin.modinfo > > > generated by the kernel build system. Highly recommend v30 though > > > as there were fixes in v28 and v29 and some changes to speed up its > > > generation/use in v30: See entries mentioning > > > builtin.alias and bultin.modinfo in > > > https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/tree/NEWS > > > > > > libkmod/modprobe/modinfo also have the corresponding changes to lookup that > > > index when resolving aliases. > > > > I see the file but it is largely missing the aliases I am interested > > in, so it looks like I might need to modify my patch that creates > > buildin.alias to add the missing alias defines in the header along > > with the other module metadata for builtin modules. Does this sound > > right to you? > > Can you clarify what is missing and why? And an RFC is welcomed if it > helps demonstrates what you mean. > > Luis