Re: [PATCH v4] module: Extend module_blacklist parameter to built-in modules

Sami Tolvanen <[email protected]> Fri, 10 Jul 2026 08:42:49 -0700
Newsgroups org.kernel.vger.linux-modules,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel
Message-ID <CABCJKufGH621Vh6JBxmk5XVrFETSvX2tJP1bNiBRg0T-=n+GRw@mail.gmail.com>
Hi Aaron,

On Tue, Jul 7, 2026 at 7:00 PM Aaron Tomlin <[email protected]> wrote:
>
> +static const char *initcall_get_modname(initcall_t fn)
> +{
> +       struct initcall_modname *p;
> +       unsigned long addr = (unsigned long)dereference_function_descriptor(fn);
> +
> +       if (system_state >= SYSTEM_FREEING_INITMEM)
> +               return NULL;
> +
> +       if (!is_kernel_text(addr) &&
> +           !is_kernel_inittext(addr))
> +               return NULL;
> +
> +       for (p = __start_initcall_modnames; p < __stop_initcall_modnames; p++) {
> +               if (dereference_function_descriptor(p->initcall_fn) ==
> +                   dereference_function_descriptor(fn))
> +                       return p->modname;
> +       }
> +       return NULL;
> +}
> +
>  int __init_or_module do_one_initcall(initcall_t fn)
>  {
>         int count = preempt_count();
>         char msgbuf[64];
> +       const char *modname;
>         int ret;
>
> +       modname = initcall_get_modname(fn);

If I'm reading this correctly, this ends up scanning the
initcall_modnames list for every initcall. Have you measured whether
this has any boot time impact? Can we at least skip this scan if no
module denylist is provided?

Sami