From 825beebeeb9d08feea71445b38e80967e9538416ccfeb53dff9851e3be79e1f6 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 18 Aug 2021 11:14:50 +0000 Subject: [PATCH 1/2] Accepting request 912880 from home:michals - Display module information even for modules built into the running kernel (bsc#1189537). + libkmod-Provide-info-even-for-modules-built-into-the.patch OBS-URL: https://build.opensuse.org/request/show/912880 OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=194 --- kmod-testsuite.spec | 1 + kmod.changes | 7 ++++ kmod.spec | 1 + ...info-even-for-modules-built-into-the.patch | 33 +++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 libkmod-Provide-info-even-for-modules-built-into-the.patch diff --git a/kmod-testsuite.spec b/kmod-testsuite.spec index dff62ba..cffa4a4 100644 --- a/kmod-testsuite.spec +++ b/kmod-testsuite.spec @@ -37,6 +37,7 @@ Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch Patch6: 0012-modprobe-print-unsupported-status.patch Patch7: usr-lib-modprobe.patch Patch8: no-stylesheet-download.patch +Patch9: libkmod-Provide-info-even-for-modules-built-into-the.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: docbook5-xsl-stylesheets diff --git a/kmod.changes b/kmod.changes index b5b86b2..1ab4632 100644 --- a/kmod.changes +++ b/kmod.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Aug 18 10:55:57 UTC 2021 - Michal Suchanek + +- Display module information even for modules built into the running kernel + (bsc#1189537). + + libkmod-Provide-info-even-for-modules-built-into-the.patch + ------------------------------------------------------------------- Mon Jun 7 06:29:19 UTC 2021 - Callum Farmer diff --git a/kmod.spec b/kmod.spec index c31a1d7..ed243d1 100644 --- a/kmod.spec +++ b/kmod.spec @@ -37,6 +37,7 @@ Patch5: 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch Patch6: 0012-modprobe-print-unsupported-status.patch Patch7: usr-lib-modprobe.patch Patch8: no-stylesheet-download.patch +Patch9: libkmod-Provide-info-even-for-modules-built-into-the.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: docbook5-xsl-stylesheets diff --git a/libkmod-Provide-info-even-for-modules-built-into-the.patch b/libkmod-Provide-info-even-for-modules-built-into-the.patch new file mode 100644 index 0000000..f1f5fd7 --- /dev/null +++ b/libkmod-Provide-info-even-for-modules-built-into-the.patch @@ -0,0 +1,33 @@ +From 446dd2bd337f88d71682b079ce7470a4232ac1e8 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 18 Aug 2021 12:42:17 +0200 +Subject: [PATCH] libkmod: Provide info even for modules built into the running + kernel. + +When a module is built-in examining the module file is skipped. + +However, a module that is built into the runnig kernel may be separate +in another kernel. Always examine the module file if it exists. + +Signed-off-by: Michal Suchanek +--- + libkmod/libkmod-module.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c +index 6e0ff1a99604..9e878a5345a1 100644 +--- a/libkmod/libkmod-module.c ++++ b/libkmod/libkmod-module.c +@@ -2292,7 +2292,8 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_ + assert(*list == NULL); + + /* remove const: this can only change internal state */ +- if (kmod_module_is_builtin((struct kmod_module *)mod)) { ++ if (!kmod_module_get_path(mod) && ++ kmod_module_is_builtin((struct kmod_module *)mod)) { + count = kmod_builtin_get_modinfo(mod->ctx, + kmod_module_get_name(mod), + &strings); +-- +2.31.1 + From b50de3156442918c23677b703e3d733aa2fd15bf45c6c5cdbf3223b1e5338d9e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 19 Aug 2021 11:12:41 +0000 Subject: [PATCH 2/2] Accepting request 913018 from home:michals Update patch to upstream version. OBS-URL: https://build.opensuse.org/request/show/913018 OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=195 --- ...info-even-for-modules-built-into-the.patch | 69 +++++++++++++------ 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/libkmod-Provide-info-even-for-modules-built-into-the.patch b/libkmod-Provide-info-even-for-modules-built-into-the.patch index f1f5fd7..a46501b 100644 --- a/libkmod-Provide-info-even-for-modules-built-into-the.patch +++ b/libkmod-Provide-info-even-for-modules-built-into-the.patch @@ -1,33 +1,60 @@ -From 446dd2bd337f88d71682b079ce7470a4232ac1e8 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Wed, 18 Aug 2021 12:42:17 +0200 -Subject: [PATCH] libkmod: Provide info even for modules built into the running - kernel. +From lucas.demarchi@intel.com Wed Aug 18 23:25:03 2021 +To: linux-modules +Subject: [PATCH v2] libkmod: Set builtin to no when module is created from path. +Date: Wed, 18 Aug 2021 14:24:39 -0700 +Message-Id: <20210818212440.2224127-1-lucas.demarchi@intel.com> +From: Michal Suchanek -When a module is built-in examining the module file is skipped. - -However, a module that is built into the runnig kernel may be separate -in another kernel. Always examine the module file if it exists. +A recent bug report showed that modinfo doesn't give the signature +information for certain modules, and it turned out to happen only on +the modules that are built-in on the running kernel; then modinfo +skips the signature check, as if the target module file never exists. +The behavior is, however, inconsistent when modinfo is performed for +external modules (no matter which kernel version is) and the module +file path is explicitly given by a command-line argument, which +guarantees the presence of the module file itself. +Fixes: e7e2cb61fa9f ("modinfo: Show information about built-in modules") +Link: https://lore.kernel.org/linux-modules/CAKi4VAJVvY3=JdSZm-GD1hJqyCPYaYz-jBJ_REeY5BakVb6_ww@mail.gmail.com/ +BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1189537 +Suggested-by: Lucas De Marchi Signed-off-by: Michal Suchanek --- - libkmod/libkmod-module.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + libkmod/libkmod-module.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index 6e0ff1a99604..9e878a5345a1 100644 +index 6e0ff1a..6f7747c 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c -@@ -2292,7 +2292,8 @@ KMOD_EXPORT int kmod_module_get_info(const struct kmod_module *mod, struct kmod_ - assert(*list == NULL); +@@ -431,17 +431,18 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx, + return -EEXIST; + } - /* remove const: this can only change internal state */ -- if (kmod_module_is_builtin((struct kmod_module *)mod)) { -+ if (!kmod_module_get_path(mod) && -+ kmod_module_is_builtin((struct kmod_module *)mod)) { - count = kmod_builtin_get_modinfo(mod->ctx, - kmod_module_get_name(mod), - &strings); +- *mod = kmod_module_ref(m); +- return 0; +- } ++ kmod_module_ref(m); ++ } else { ++ err = kmod_module_new(ctx, name, name, namelen, NULL, 0, &m); ++ if (err < 0) { ++ free(abspath); ++ return err; ++ } + +- err = kmod_module_new(ctx, name, name, namelen, NULL, 0, &m); +- if (err < 0) { +- free(abspath); +- return err; ++ m->path = abspath; + } + +- m->path = abspath; ++ m->builtin = KMOD_MODULE_BUILTIN_NO; + *mod = m; + + return 0; -- 2.31.1 +