On Wed, Dec 31, 2025 at 12:10 AM Aaron Tomlin <[email protected]> wrote:
>
> On Tue, Dec 30, 2025 at 10:12:09PM +0800, Yafang Shao wrote:
> > > As mentioned, most in-tree modules do not specify an explicit version,
> > > so in terms of bloating the information about loaded modules, the patch
> > > should have minimal impact in practice. Alternatively, the version
> > > information could be printed only for external modules.
> >
> > Good suggestion.
> > I believe it’s sufficient to print only for external modules.
> >
> > Does the following change look good to you?
> >
> > --- a/kernel/module/main.c
> > +++ b/kernel/module/main.c
> > @@ -3901,7 +3901,10 @@ void print_modules(void)
> >         list_for_each_entry_rcu(mod, &modules, list) {
> >                 if (mod->state == MODULE_STATE_UNFORMED)
> >                         continue;
> > -               pr_cont(" %s%s", mod->name, module_flags(mod, buf, true));
> > +               pr_cont(" %s", mod->name);
> > +               if (mod->version && test_bit(TAINT_OOT_MUDLE, &mod->taints))
> > +                       pr_cont("-%s", mod->version);
> > +               pr_cont("%s", module_flags(mod, buf, true));
> >         }
> >
> >         print_unloaded_tainted_modules();
> >
>
> Hi Yafang,
>
>
> This refined approach is significantly more palatable and addresses the
> primary concerns regarding log bloat. By gating the version output behind
> the TAINT_OOT_MODULE bit, we strike an excellent balance between
> operational necessity and kernel log cleanliness.
>
> From a maintenance perspective, this is a much "tidier" solution. In-tree
> modules are tied to the specific kernel version already, so printing their
> versions is redundant. However, for external drivers (like proprietary
> networking or GPU stacks), the version is the single most critical piece of
> metadata for triage.
>
> The logic is sound, though there is a minor typo in the bit name that will
> cause a build failure. Here is the corrected implementation:
>
> @@ -3901,7 +3901,10 @@ void print_modules(void)
>         list_for_each_entry_rcu(mod, &modules, list) {
>                 if (mod->state == MODULE_STATE_UNFORMED)
>                         continue;
> -               pr_cont(" %s%s", mod->name, module_flags(mod, buf, true));
> +               pr_cont(" %s", mod->name);
> +               /* Only append version for out-of-tree modules */
> +               if (mod->version && test_bit(TAINT_OOT_MODULE, &mod->taints))
> +                       pr_cont("-%s", mod->version);
> +               pr_cont("%s", module_flags(mod, buf, true));
>         }
>
>         print_unloaded_tainted_modules();
>
>
> Reviewed-by: Aaron Tomlin <[email protected]>

Thanks for your review.
v2 is sent: 
https://lore.kernel.org/linux-modules/[email protected]/


-- 
Regards
Yafang

Reply via email to