* [PATCH v2 0/2] module: remove MODULE_VERSION() and srcversion
@ 2026-07-31 13:02 Greg Kroah-Hartman
2026-07-31 13:02 ` [PATCH v2 1/2] module: remove MODULE_VERSION() Greg Kroah-Hartman
2026-07-31 13:02 ` [PATCH v2 2/2] module: remove srcversion module attribute Greg Kroah-Hartman
0 siblings, 2 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-31 13:02 UTC (permalink / raw)
To: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
Aaron Tomlin, Shyam Saini, Kees Cook, Thorsten Blum,
Christoph Hellwig, linux-kernel, linux-kbuild, linux-modules,
Greg Kroah-Hartman
Cc: Christoph Hellwig
Module "versions" do not make sense as the kernel is built all at once,
the "version" is the overall kernel version number, so modules can not
really be described as having a unique version given that they rely on
the infrastructure of the whole kernel.
So remove the version and the srcversion fields as there is no need for
them anymore.
Note, for now, MODULE_VERSION() is just an "empty" define, to keep
existing code building properly as the tree is slowly purged of the use
of this over time. This macro will be removed entirely in the future
when there are no in-tree users.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Changes in v2:
- remove version from struct module and the sysfs file
- amd driver THIS_MODULE->version logic removal as it's pointless.
- add second patch in series to remove srcversion
- Link to v1: https://lore.kernel.org/r/2026031341-evolve-repeater-987b@gregkh
---
Greg Kroah-Hartman (2):
module: remove MODULE_VERSION()
module: remove srcversion module attribute
Documentation/ABI/stable/sysfs-module | 12 -------
arch/x86/tools/relocs.c | 1 -
drivers/block/drbd/drbd_buildtag.c | 7 +---
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 7 +---
include/asm-generic/vmlinux.lds.h | 5 ---
include/linux/module.h | 58 ++++++--------------------------
kernel/module/Kconfig | 11 ------
kernel/module/main.c | 32 ------------------
kernel/params.c | 30 -----------------
scripts/Makefile.modpost | 1 -
scripts/mod/modpost.c | 24 -------------
scripts/mod/modpost.h | 1 -
12 files changed, 13 insertions(+), 176 deletions(-)
---
base-commit: 8ba098e6b6ff0db8edf28528d1552be261af30d4
change-id: 20260731-module_ver_remove-fd505b32b111
Best regards,
--
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] module: remove MODULE_VERSION()
2026-07-31 13:02 [PATCH v2 0/2] module: remove MODULE_VERSION() and srcversion Greg Kroah-Hartman
@ 2026-07-31 13:02 ` Greg Kroah-Hartman
2026-07-31 13:18 ` sashiko-bot
2026-07-31 13:02 ` [PATCH v2 2/2] module: remove srcversion module attribute Greg Kroah-Hartman
1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-31 13:02 UTC (permalink / raw)
To: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
Aaron Tomlin, Shyam Saini, Kees Cook, Thorsten Blum,
Christoph Hellwig, linux-kernel, linux-kbuild, linux-modules,
Greg Kroah-Hartman
Cc: Christoph Hellwig
Module "versions" do not make sense as the kernel is built all at once,
the "version" is the overall kernel version number, so modules can not
really be described as having a unique version given that they rely on
the infrastructure of the whole kernel.
For now, just make this an "empty" define, to keep existing code
building properly as the tree is slowly purged of the use of this over
time.
This macro will be removed entirely in the future when there are no
in-tree users.
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Daniel Gomez <da.gomez@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Shyam Saini <shyamsaini@linux.microsoft.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Documentation/ABI/stable/sysfs-module | 6 ----
arch/x86/tools/relocs.c | 1 -
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 7 +---
include/asm-generic/vmlinux.lds.h | 5 ---
include/linux/module.h | 57 ++++++--------------------------
kernel/module/main.c | 2 --
kernel/params.c | 30 -----------------
7 files changed, 12 insertions(+), 96 deletions(-)
diff --git a/Documentation/ABI/stable/sysfs-module b/Documentation/ABI/stable/sysfs-module
index 41b1f16e8795..7a3cdd8a8d9f 100644
--- a/Documentation/ABI/stable/sysfs-module
+++ b/Documentation/ABI/stable/sysfs-module
@@ -39,9 +39,3 @@ Date: Jun 2005
Description:
If the module source has MODULE_VERSION, this file will contain
the checksum of the source code.
-
-What: /sys/module/<MODULENAME>/version
-Date: Jun 2005
-Description:
- If the module source has MODULE_VERSION, this file will contain
- the version of the source code.
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index e5a2b9a912d1..1426ddcb3a89 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -81,7 +81,6 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
"__(start|stop)___ksymtab(_gpl)?|"
"__(start|stop)___kcrctab(_gpl)?|"
"__(start|stop)___param|"
- "__(start|stop)___modver|"
"__(start|stop)___bug_table|"
"__tracedata_(start|end)|"
"__(start|stop)_notes|"
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 9e8f7d2b898c..a1ca1bc27f93 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -677,12 +677,7 @@ static int amdgpu_virt_write_vf2pf_data(struct amdgpu_device *adev)
vf2pf_info->header.size = sizeof(struct amd_sriov_msg_vf2pf_info);
vf2pf_info->header.version = AMD_SRIOV_MSG_FW_VRAM_VF2PF_VER;
-#ifdef MODULE
- if (THIS_MODULE->version != NULL)
- strscpy(vf2pf_info->driver_version, THIS_MODULE->version);
- else
-#endif
- strscpy(vf2pf_info->driver_version, "N/A");
+ strscpy(vf2pf_info->driver_version, "N/A");
vf2pf_info->pf2vf_version_required = 0; // no requirement, guest understands all
vf2pf_info->driver_cert = 0;
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 5659f4b5a125..80bc90ec9ee1 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -544,11 +544,6 @@
BOUNDED_SECTION_BY(__param, ___param) \
} \
\
- /* Built-in module versions. */ \
- __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
- BOUNDED_SECTION_BY(__modver, ___modver) \
- } \
- \
KCFI_TRAPS \
\
RO_EXCEPTION_TABLE \
diff --git a/include/linux/module.h b/include/linux/module.h
index 7566815fabbe..209b6a388be7 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -62,15 +62,6 @@ struct module_attribute {
void (*free)(struct module *);
};
-struct module_version_attribute {
- struct module_attribute mattr;
- const char *module_name;
- const char *version;
-};
-
-extern ssize_t __modver_version_show(const struct module_attribute *,
- struct module_kobject *, char *);
-
extern const struct module_attribute module_uevent;
/* These are either module local, or the kernel's dummy ones. */
@@ -256,43 +247,18 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name);
static typeof(name) __mod_device_table(type, name) \
__attribute__ ((used, alias(__stringify(name))))
-/* Version of form [<epoch>:]<version>[-<extra-version>].
- * Or for CVS/RCS ID version, everything but the number is stripped.
- * <epoch>: A (small) unsigned integer which allows you to start versions
- * anew. If not mentioned, it's zero. eg. "2:1.0" is after
- * "1:2.0".
-
- * <version>: The <version> may contain only alphanumerics and the
- * character `.'. Ordered by numeric sort for numeric parts,
- * ascii sort for ascii parts (as per RPM or DEB algorithm).
-
- * <extraversion>: Like <version>, but inserted for local
- * customizations, eg "rh3" or "rusty1".
-
- * Using this automatically adds a checksum of the .c files and the
- * local headers in "srcversion".
+/*
+ * Module "versions" do not make sense as the kernel is built all at once, the
+ * "version" is the overall kernel version number, so modules can not really be
+ * described as having a unique version given that they rely on the
+ * infrastructure of the whole kernel.
+ *
+ * For now, just make this an "empty" define, to keep existing code building
+ * properly as the tree is slowly purged of the use of this over time.
+ *
+ * It will be removed in the future when there are no in-tree users.
*/
-
-#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)) \
- = { \
- .mattr = { \
- .attr = { \
- .name = "version", \
- .mode = S_IRUGO, \
- }, \
- .show = __modver_version_show, \
- }, \
- .module_name = KBUILD_MODNAME, \
- .version = _version, \
- }
-#endif
+#define MODULE_VERSION(_version)
/* Optional firmware file (or files) needed by the module
* format is simply firmware file name. Multiple firmware
@@ -411,7 +377,6 @@ struct module {
/* Sysfs stuff. */
struct module_kobject mkobj;
struct module_attribute *modinfo_attrs;
- const char *version;
const char *srcversion;
const char *imported_namespaces;
struct kobject *holders_dir;
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 46dd8d25a605..da8be9788d13 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -602,7 +602,6 @@ static const struct module_attribute modinfo_##field = { \
.free = free_modinfo_##field, \
};
-MODINFO_ATTR(version);
MODINFO_ATTR(srcversion);
static void setup_modinfo_import_ns(struct module *mod, const char *s)
@@ -1084,7 +1083,6 @@ static const struct module_attribute modinfo_taint =
const struct module_attribute *const modinfo_attrs[] = {
&module_uevent,
- &modinfo_version,
&modinfo_srcversion,
&modinfo_import_ns,
&modinfo_initstate,
diff --git a/kernel/params.c b/kernel/params.c
index a668863a4bb6..6c5a1eb22b25 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -837,35 +837,6 @@ static void __init param_sysfs_builtin(void)
}
}
-ssize_t __modver_version_show(const struct module_attribute *mattr,
- struct module_kobject *mk, char *buf)
-{
- const struct module_version_attribute *vattr =
- container_of_const(mattr, struct module_version_attribute, mattr);
-
- return scnprintf(buf, PAGE_SIZE, "%s\n", vattr->version);
-}
-
-extern const struct module_version_attribute __start___modver[];
-extern const struct module_version_attribute __stop___modver[];
-
-static void __init version_sysfs_builtin(void)
-{
- const struct module_version_attribute *vattr;
- struct module_kobject *mk;
- int err;
-
- for (vattr = __start___modver; vattr < __stop___modver; vattr++) {
- mk = lookup_or_create_module_kobject(vattr->module_name);
- if (mk) {
- err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
- WARN_ON_ONCE(err);
- kobject_uevent(&mk->kobj, KOBJ_ADD);
- kobject_put(&mk->kobj);
- }
- }
-}
-
/* module-related sysfs stuff */
static ssize_t module_attr_show(struct kobject *kobj,
@@ -968,7 +939,6 @@ static int __init param_sysfs_builtin_init(void)
if (!module_kset)
return -ENOMEM;
- version_sysfs_builtin();
param_sysfs_builtin();
return 0;
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] module: remove srcversion module attribute
2026-07-31 13:02 [PATCH v2 0/2] module: remove MODULE_VERSION() and srcversion Greg Kroah-Hartman
2026-07-31 13:02 ` [PATCH v2 1/2] module: remove MODULE_VERSION() Greg Kroah-Hartman
@ 2026-07-31 13:02 ` Greg Kroah-Hartman
2026-07-31 13:35 ` sashiko-bot
1 sibling, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-31 13:02 UTC (permalink / raw)
To: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
Aaron Tomlin, Shyam Saini, Kees Cook, Thorsten Blum,
Christoph Hellwig, linux-kernel, linux-kbuild, linux-modules,
Greg Kroah-Hartman
Cc: Christoph Hellwig
Now that module versions are gone, there is no need for srcversion
either. So drop the logic for this from both the kernel and the helper
module tools.
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Daniel Gomez <da.gomez@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Shyam Saini <shyamsaini@linux.microsoft.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Documentation/ABI/stable/sysfs-module | 6 ------
drivers/block/drbd/drbd_buildtag.c | 7 +------
include/linux/module.h | 1 -
kernel/module/Kconfig | 11 -----------
kernel/module/main.c | 30 ------------------------------
scripts/Makefile.modpost | 1 -
scripts/mod/modpost.c | 24 ------------------------
scripts/mod/modpost.h | 1 -
8 files changed, 1 insertion(+), 80 deletions(-)
diff --git a/Documentation/ABI/stable/sysfs-module b/Documentation/ABI/stable/sysfs-module
index 7a3cdd8a8d9f..5c028af9921a 100644
--- a/Documentation/ABI/stable/sysfs-module
+++ b/Documentation/ABI/stable/sysfs-module
@@ -33,9 +33,3 @@ Description:
Note: If the module is built into the kernel, or if the
CONFIG_MODULE_UNLOAD kernel configuration value is not enabled,
this file will not be present.
-
-What: /sys/module/<MODULENAME>/srcversion
-Date: Jun 2005
-Description:
- If the module source has MODULE_VERSION, this file will contain
- the checksum of the source code.
diff --git a/drivers/block/drbd/drbd_buildtag.c b/drivers/block/drbd/drbd_buildtag.c
index cd0389488f63..22f1e842f9ce 100644
--- a/drivers/block/drbd/drbd_buildtag.c
+++ b/drivers/block/drbd/drbd_buildtag.c
@@ -10,13 +10,8 @@ const char *drbd_buildtag(void)
static char buildtag[38] = "\0uilt-in";
- if (buildtag[0] == 0) {
-#ifdef MODULE
- sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
-#else
+ if (buildtag[0] == 0)
buildtag[0] = 'b';
-#endif
- }
return buildtag;
}
diff --git a/include/linux/module.h b/include/linux/module.h
index 209b6a388be7..cafb99479966 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -377,7 +377,6 @@ struct module {
/* Sysfs stuff. */
struct module_kobject mkobj;
struct module_attribute *modinfo_attrs;
- const char *srcversion;
const char *imported_namespaces;
struct kobject *holders_dir;
diff --git a/kernel/module/Kconfig b/kernel/module/Kconfig
index 43b1bb01fd27..e27f12778e24 100644
--- a/kernel/module/Kconfig
+++ b/kernel/module/Kconfig
@@ -238,17 +238,6 @@ config BASIC_MODVERSIONS
endif # MODVERSIONS
-config MODULE_SRCVERSION_ALL
- bool "Source checksum for all modules"
- help
- Modules which contain a MODULE_VERSION get an extra "srcversion"
- field inserted into their modinfo section, which contains a
- sum of the source files which made it. This helps maintainers
- see exactly which source was used to build a module (since
- others sometimes change the module source without updating
- the version). With this option, such a "srcversion" field
- will be created for all modules. If unsure, say N.
-
config MODULE_SIG
bool "Module signature verification"
select MODULE_SIG_FORMAT
diff --git a/kernel/module/main.c b/kernel/module/main.c
index da8be9788d13..5f590ce90f2d 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -575,35 +575,6 @@ bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
#endif /* CONFIG_SMP */
-#define MODINFO_ATTR(field) \
-static void setup_modinfo_##field(struct module *mod, const char *s) \
-{ \
- mod->field = kstrdup(s, GFP_KERNEL); \
-} \
-static ssize_t show_modinfo_##field(const struct module_attribute *mattr, \
- struct module_kobject *mk, char *buffer) \
-{ \
- return scnprintf(buffer, PAGE_SIZE, "%s\n", mk->mod->field); \
-} \
-static int modinfo_##field##_exists(struct module *mod) \
-{ \
- return mod->field != NULL; \
-} \
-static void free_modinfo_##field(struct module *mod) \
-{ \
- kfree(mod->field); \
- mod->field = NULL; \
-} \
-static const struct module_attribute modinfo_##field = { \
- .attr = { .name = __stringify(field), .mode = 0444 }, \
- .show = show_modinfo_##field, \
- .setup = setup_modinfo_##field, \
- .test = modinfo_##field##_exists, \
- .free = free_modinfo_##field, \
-};
-
-MODINFO_ATTR(srcversion);
-
static void setup_modinfo_import_ns(struct module *mod, const char *s)
{
mod->imported_namespaces = NULL;
@@ -1083,7 +1054,6 @@ static const struct module_attribute modinfo_taint =
const struct module_attribute *const modinfo_attrs[] = {
&module_uevent,
- &modinfo_srcversion,
&modinfo_import_ns,
&modinfo_initstate,
&modinfo_coresize,
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index d7d45067d08b..b6c1467cf527 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -45,7 +45,6 @@ modpost-args = \
$(if $(CONFIG_MODVERSIONS),-m) \
$(if $(CONFIG_BASIC_MODVERSIONS),-b) \
$(if $(CONFIG_EXTENDED_MODVERSIONS),-x) \
- $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
$(if $(KBUILD_MODPOST_WARN),-w) \
$(if $(KBUILD_NSDEPS),-d modules.nsdeps) \
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a7b72a81d248..2e969be7f414 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -33,8 +33,6 @@
static bool module_enabled;
/* Are we using CONFIG_MODVERSIONS? */
static bool modversions;
-/* Is CONFIG_MODULE_SRCVERSION_ALL set? */
-static bool all_versions;
/* Is CONFIG_BASIC_MODVERSIONS set? */
static bool basic_modversions;
/* Is CONFIG_EXTENDED_MODVERSIONS set? */
@@ -1584,7 +1582,6 @@ static void mod_set_crcs(struct module *mod)
static void read_symbols(const char *modname)
{
const char *symname;
- char *version;
char *license;
char *namespace;
struct module *mod;
@@ -1645,13 +1642,6 @@ static void read_symbols(const char *modname)
check_sec_ref(mod, &info);
- if (!mod->is_vmlinux) {
- version = get_modinfo(&info, "version");
- if (version || all_versions)
- get_src_version(mod->name, mod->srcversion,
- sizeof(mod->srcversion) - 1);
- }
-
parse_elf_finish(&info);
if (modversions) {
@@ -2035,15 +2025,6 @@ static void add_depends(struct buffer *b, struct module *mod)
buf_printf(b, "\");\n");
}
-static void add_srcversion(struct buffer *b, struct module *mod)
-{
- if (mod->srcversion[0]) {
- buf_printf(b, "\n");
- buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n",
- mod->srcversion);
- }
-}
-
static void write_buf(struct buffer *b, const char *fname)
{
FILE *file;
@@ -2149,8 +2130,6 @@ static void write_mod_c_file(struct module *mod)
free(alias);
}
- add_srcversion(&buf, mod);
-
ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name);
if (ret >= sizeof(fname)) {
error("%s: too long path was truncated\n", fname);
@@ -2327,9 +2306,6 @@ int main(int argc, char **argv)
case 'o':
dump_write = optarg;
break;
- case 'a':
- all_versions = true;
- break;
case 'T':
files_source = optarg;
break;
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 2aecb8f25c87..2c2f1d2b4021 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -126,7 +126,6 @@ struct module {
bool seen;
bool has_init;
bool has_cleanup;
- char srcversion[25];
// Missing namespace dependencies
struct list_head missing_namespaces;
// Actual imported namespaces
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] module: remove MODULE_VERSION()
2026-07-31 13:02 ` [PATCH v2 1/2] module: remove MODULE_VERSION() Greg Kroah-Hartman
@ 2026-07-31 13:18 ` sashiko-bot
2026-07-31 13:51 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-07-31 13:18 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-modules
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Immediate, unphased removal of the `/sys/module/*/version` sysfs ABI and `modinfo` version outputs.
--
--- Patch [1]: [PATCH v2 1/2] module: remove MODULE_VERSION() ---
commit b77f8591ff850600dbc1da5c9c2f45e06be183fe
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <mcgrof@kernel.org>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Daniel Gomez <da.gomez@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Shyam Saini <shyamsaini@linux.microsoft.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>
[ ... ]
> 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)) \
> - = { \
> - .mattr = { \
> - .attr = { \
> - .name = "version", \
> - .mode = S_IRUGO, \
> - }, \
> - .show = __modver_version_show, \
> - }, \
> - .module_name = KBUILD_MODNAME, \
> - .version = _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 =
>
> const struct module_attribute *const modinfo_attrs[] = {
> &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 = __start___modver; vattr < __stop___modver; vattr++) {
> - mk = lookup_or_create_module_kobject(vattr->module_name);
> - if (mk) {
> - err = 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;
>
> - 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 exist?
> param_sysfs_builtin();
>
> return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-module_ver_remove-v2-0-c9163858f382@linuxfoundation.org?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] module: remove srcversion module attribute
2026-07-31 13:02 ` [PATCH v2 2/2] module: remove srcversion module attribute Greg Kroah-Hartman
@ 2026-07-31 13:35 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-31 13:35 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-modules
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Low] Incomplete feature removal leaves `sumversion.c` as entirely dead code that is still compiled.
- [Low] The `-a` command-line option was not removed from the `getopt` string, causing silent failures if passed.
- [Low] DRBD modules unconditionally report their version string as `"built-in"` even when dynamically loaded.
--
--- Patch [2]: [PATCH v2 2/2] module: remove srcversion module attribute ---
commit 461ecb5f73545c4d962415cbd1b5ef67b64b2f0a
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
module: remove srcversion module attribute
This commit removes the srcversion module attribute from the kernel and the
helper module tools. Since module versions are no longer used, the
associated logic is dropped.
> diff --git a/drivers/block/drbd/drbd_buildtag.c b/drivers/block/drbd/drbd_buildtag.c
> index cd0389488f63e..22f1e842f9ced 100644
> --- a/drivers/block/drbd/drbd_buildtag.c
> +++ b/drivers/block/drbd/drbd_buildtag.c
> @@ -10,13 +10,8 @@ const char *drbd_buildtag(void)
>
> static char buildtag[38] = "\0uilt-in";
>
> - if (buildtag[0] == 0) {
> -#ifdef MODULE
> - sprintf(buildtag, "srcversion: %-24s", THIS_MODULE->srcversion);
> -#else
> + if (buildtag[0] == 0)
> buildtag[0] = 'b';
> -#endif
> - }
>
> return buildtag;
> }
[Severity: Low]
With the removal of the conditional logic in drbd_buildtag(), will this
unconditionally report the DRBD module version string as "built-in" even
when it is dynamically loaded?
[ ... ]
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index a7b72a81d2482..2e969be7f414c 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
[ ... ]
> @@ -2327,9 +2306,6 @@ int main(int argc, char **argv)
> case 'o':
> dump_write = optarg;
> break;
> - case 'a':
> - all_versions = true;
> - break;
> case 'T':
> files_source = optarg;
> break;
[Severity: Low]
Should the 'a' flag also be removed from the getopt() option string earlier
in main()?
scripts/mod/modpost.c:main() {
...
while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:xb")) != -1) {
...
}
If the deprecated -a flag is passed to modpost, getopt considers it valid
and returns 'a'. Since the switch statement no longer has a case for 'a', it
falls through to the default case and silently calls exit(1) without
emitting an invalid option error message.
[ ... ]
> diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
> index 2aecb8f25c87e..2c2f1d2b40211 100644
> --- a/scripts/mod/modpost.h
> +++ b/scripts/mod/modpost.h
> @@ -126,7 +126,6 @@ struct module {
> bool seen;
> bool has_init;
> bool has_cleanup;
> - char srcversion[25];
> // Missing namespace dependencies
> struct list_head missing_namespaces;
> // Actual imported namespaces
[Severity: Low]
Since the srcversion feature is being removed, should
scripts/mod/sumversion.c also be deleted and removed from modpost-objs in
scripts/mod/Makefile?
The file appears to be dead code now that its only entry point
get_src_version() is never called, though the function declaration still
remains further down in scripts/mod/modpost.h.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-module_ver_remove-v2-0-c9163858f382@linuxfoundation.org?part=2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] module: remove MODULE_VERSION()
2026-07-31 13:18 ` sashiko-bot
@ 2026-07-31 13:51 ` Greg Kroah-Hartman
0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-31 13:51 UTC (permalink / raw)
To: sashiko-reviews; +Cc: linux-modules
On Fri, Jul 31, 2026 at 01:18:54PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Critical] Immediate, unphased removal of the `/sys/module/*/version` sysfs ABI and `modinfo` version outputs.
Heh, that is intentional! :)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-31 13:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 13:02 [PATCH v2 0/2] module: remove MODULE_VERSION() and srcversion Greg Kroah-Hartman
2026-07-31 13:02 ` [PATCH v2 1/2] module: remove MODULE_VERSION() Greg Kroah-Hartman
2026-07-31 13:18 ` sashiko-bot
2026-07-31 13:51 ` Greg Kroah-Hartman
2026-07-31 13:02 ` [PATCH v2 2/2] module: remove srcversion module attribute Greg Kroah-Hartman
2026-07-31 13:35 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.