diff --git a/backport-libkmod-Set-builtin-to-no-when-module-is-created-fro.patch b/backport-libkmod-Set-builtin-to-no-when-module-is-created-fro.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6a6779fc3e7ccd59e64625ea7eccca06d5a09a2 --- /dev/null +++ b/backport-libkmod-Set-builtin-to-no-when-module-is-created-fro.patch @@ -0,0 +1,61 @@ +From 4e391ac92d1b9a2c8c0e9d8735d2913ee86c0ad8 Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Wed, 18 Aug 2021 22:52:00 +0200 +Subject: [PATCH] libkmod: Set builtin to no when module is created from path. + +Conflict:NA +Reference:https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit?id=4e391ac92d1b9a2c8c0e9d8735d2913ee86c0ad8 + +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 +Reviewed-by: Petr Vorel +--- + 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 6e0ff1a..6f7747c 100644 +--- a/libkmod/libkmod-module.c ++++ b/libkmod/libkmod-module.c +@@ -431,17 +431,18 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx, + return -EEXIST; + } + +- *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.33.0 + diff --git a/backport-modprobe-fix-the-NULL-termination-of-new_argv.patch b/backport-modprobe-fix-the-NULL-termination-of-new_argv.patch new file mode 100644 index 0000000000000000000000000000000000000000..119364f537a8cf1bb3d02de1d4859fed87555375 --- /dev/null +++ b/backport-modprobe-fix-the-NULL-termination-of-new_argv.patch @@ -0,0 +1,35 @@ +From 757b3599236c0fee9e2bb0770eb6b7c84a271276 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Thu, 10 Feb 2022 11:14:22 +0900 +Subject: [PATCH] modprobe: fix the NULL-termination of new_argv + +Conflict:NA +Reference:https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit?id=757b3599236c0fee9e2bb0770eb6b7c84a271276 + +The number of new arguments is (i + argc - 1) as it is set to *p_argc +one line below. + +The correct location of NULL termination is new_argv[i + argc - 1]. + +Signed-off-by: Masahiro Yamada +Signed-off-by: Lucas De Marchi +--- + tools/modprobe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/modprobe.c b/tools/modprobe.c +index eed951f..48b1c8c 100644 +--- a/tools/modprobe.c ++++ b/tools/modprobe.c +@@ -744,7 +744,7 @@ static char **prepend_options_from_env(int *p_argc, char **orig_argv) + } + + memcpy(new_argv + i, orig_argv + 1, sizeof(char *) * (argc - 1)); +- new_argv[i + argc] = NULL; ++ new_argv[i + argc - 1] = NULL; + *p_argc = i + argc - 1; + + return new_argv; +-- +2.33.0 + diff --git a/kmod.spec b/kmod.spec index be4c2c710e484c45da7741ebad471dce7f29903a..5c90bc909c55ed5cd70ac6ee301c910585ab738c 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 29 -Release: 6 +Release: 7 Summary: Kernel module management # GPLv2+ is used by programs, LGPLv2+ is used for libraries. License: GPLv2+ and LGPLv2+ @@ -16,6 +16,8 @@ Patch4: 0004-don-t-check-module-s-refcnt-when-rmmod-with-r.patch Patch6000: backport-libkmod-do-not-crash-on-unknown-signature-algorithm.patch Patch6001: backport-libkmod-error-out-on-unknown-hash-algorithm.patch +Patch6002: backport-libkmod-Set-builtin-to-no-when-module-is-created-fro.patch +Patch6003: backport-modprobe-fix-the-NULL-termination-of-new_argv.patch BuildRequires: gcc chrpath zlib-devel xz-devel libxslt openssl-devel @@ -123,6 +125,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %doc TODO NEWS README %changelog +* Mon Apr 17 2023 Fang Chuangchuang - 29-7 +- libkmod: Set builtin to no when module is created from path. + modprobe: fix the NULL-termination of new_argv + * Sun Mar 26 2023 Lai Hangliang - 29-6 - libkmod: fix error out on unknown hash algorithm