[lkml]   [2022]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH v7 0/5] Generate modules.builtin.alias from match ids
Generate modules.builtin.alias from match ids

This patch series (v7) pivots to adding `modules.builtin.alias` from the
previous approach of adding a sysfs attribute. The goal is for tools
like USBGuard to leverage not only modules.aliases but also
`modules.builtin.aliases` to associate devices with the modules that may
be bound before deciding to authorize a device or not. This is
particularly useful in cases when new devices of a particular type
shouldn't be allowed part of the time like for lock screens.

Note that `modules.builtin.alias` is generated directly by modpost. This
differs from how `modules.alias` is generated because modpost converts
the match-id based module aliases into c-files that add additional
aliases to the module info. No such c-file is present for vmlinuz though
it would be possible to add one. A downside of this would be vmlinuz
would grow by 100-200kb for a typical ChromeOS kernel config.


# Generate modules.builtin.alias from match ids

Previous versions of this patch series addressed the same problem by
adding a sysfs attribute instead of `modules.builtin.alias`.
Consequently, they have a different name and include completely
different commits than this version.
Note, cover letters were first added in v5.

RFC (broken patch):
v1 (missing v1 label):
v2 (missing v2 label):
v7: This version

## Patch series status

This series is still going through revisions in response to comments.
This version generates match-id based aliases for all subsystems unlike
previous patch series versions which only implemented aliases for USB.

I believe there is potential to improve the Makefile part of the patch
series as well as an open question of whether modpost should generate
`modules.built.alias` directly or create a vmlinuz.mod.c containing the
missing module info for the match-id based aliases for built-in modules.

## Acknowledgements

Thanks to Greg Kroah-Hartman and the Linux maintainers for being patient
with me as I have worked through learning the kernel workflow to get
this series into a more presentable state.

Thanks to Luis Chamberlain for raising the alternative of using kmod to
address the primary motivation of the patch series.

Also, thanks to Intel's kernel test robot <> for catching
issues that showed up on different kernel configurations.

Allen Webb (5):
module.h: MODULE_DEVICE_TABLE for built-in modules
modpost: Track module name for built-in modules
modpost: Add -b option for emitting built-in aliases
file2alias.c: Implement builtin.alias generation
build: Add modules.builtin.alias

.gitignore | 1 +
Makefile | 1 +
include/linux/module.h | 10 ++++-
scripts/Makefile.modpost | 17 +++++++-
scripts/mod/file2alias.c | 92 +++++++++++++++++++++++++++++++---------
scripts/mod/modpost.c | 23 +++++++++-
scripts/mod/modpost.h | 2 +
7 files changed, 121 insertions(+), 25 deletions(-)


 \ /
  Last update: 2022-12-16 23:18    [W:0.210 / U:1.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site