Re: [PATCH v2 1/2] module: remove MODULE_VERSION()

[email protected] Fri, 31 Jul 2026 13:18:54 +0000
Newsgroups org.kernel.vger.linux-modules
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:
- [Critical] Immediate, unphased removal of the `/sys/module/*/version` sys=
fs ABI and `modinfo` version outputs.
--

--- Patch [1]: [PATCH v2 1/2] module: remove MODULE_VERSION() ---
commit b77f8591ff850600dbc1da5c9c2f45e06be183fe
Author: Greg Kroah-Hartman <[email protected]>

module: remove MODULE_VERSION()

This commit removes the MODULE_VERSION macro and its associated sysfs
attributes. It redefines the macro to be empty to keep existing code
building while it is phased out, as module versions do not make sense in
a unified build.

Cc: Luis Chamberlain <[email protected]>
Cc: Petr Pavlu <[email protected]>
Cc: Daniel Gomez <[email protected]>
Cc: Sami Tolvanen <[email protected]>
Cc: Aaron Tomlin <[email protected]>
Cc: Shyam Saini <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Thorsten Blum <[email protected]>

[ ... ]
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 7566815fabbe8..209b6a388be7c 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
[ ... ]
> -#if defined(MODULE) || !defined(CONFIG_SYSFS)
> -#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
> -#else
> -#define MODULE_VERSION(_version)					\
> -	MODULE_INFO(version, _version);					\
> -	static const struct module_version_attribute __modver_attr	\
> -		__used __section("__modver")				\
> -		__aligned(__alignof__(struct module_version_attribute)) \
> -		=3D {							\
> -			.mattr	=3D {					\
> -				.attr	=3D {				\
> -					.name	=3D "version",		\
> -					.mode	=3D S_IRUGO,		\
> -				},					\
> -				.show	=3D __modver_version_show,	\
> -			},						\
> -			.module_name	=3D KBUILD_MODNAME,		\
> -			.version	=3D _version,			\
> -		}
> -#endif
> +#define MODULE_VERSION(_version)

[Severity: Critical]
Does redefining this macro to empty immediately prevent the version tag from
being embedded in the .modinfo section of all loadable modules? Could this
cause a regression for userspace tools like modinfo that might rely on
extracting this information?

[ ... ]
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index 46dd8d25a6058..da8be9788d130 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
[ ... ]
> @@ -1084,7 +1083,6 @@ static const struct module_attribute modinfo_taint =
=3D
> =20
>  const struct module_attribute *const modinfo_attrs[] =3D {
>  	&module_uevent,
> -	&modinfo_version,

[Severity: Critical]
By removing this attribute, does this immediately break the loadable module
sysfs interface at /sys/module/module_name/version? Would it be safer to
provide a backward-compatible stub or deprecation period before completely
removing this stable ABI, to avoid regressions in userspace scripts?

>  	&modinfo_srcversion,
>  	&modinfo_import_ns,
>  	&modinfo_initstate,
[ ... ]
> diff --git a/kernel/params.c b/kernel/params.c
> index a668863a4bb63..6c5a1eb22b257 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
[ ... ]
> -static void __init version_sysfs_builtin(void)
> -{
> -	const struct module_version_attribute *vattr;
> -	struct module_kobject *mk;
> -	int err;
> -
> -	for (vattr =3D __start___modver; vattr < __stop___modver; vattr++) {
> -		mk =3D lookup_or_create_module_kobject(vattr->module_name);
> -		if (mk) {
> -			err =3D sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
> -			WARN_ON_ONCE(err);
> -			kobject_uevent(&mk->kobj, KOBJ_ADD);
> -			kobject_put(&mk->kobj);
> -		}
> -	}
> -}
> -
[ ... ]
> @@ -968,7 +939,6 @@ static int __init param_sysfs_builtin_init(void)
>  	if (!module_kset)
>  		return -ENOMEM;
> =20
> -	version_sysfs_builtin();

[Severity: Critical]
Does the removal of this function and its call immediately drop the sysfs
version node for all built-in modules? Could this cause hardware inventory
scripts or udev rules to fail with ENOENT when they expect the file to exis=
t?

>  	param_sysfs_builtin();
> =20
>  	return 0;

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260731-module_ver=
[email protected]?part=3D1