From 5a5294948bc54d913a82a4f054035c63005a80a2 Mon Sep 17 00:00:00 2001 From: zyppe <210hcl@gmail.com> Date: Fri, 9 Feb 2024 17:51:16 +0800 Subject: [PATCH] Initialize for kmod --- .gitignore | 2 + .kmod.metadata | 2 + ...ze-allow-unsupported-modules-on-comm.patch | 41 ++ ...ecognize-allow_unsupported_modules-i.patch | 29 ++ ...t-filtering-of-unsupported-modules-o.patch | 108 +++++ ...-Implement-allow-unsupported-modules.patch | 97 ++++ ...supported-modules-when-running-a-van.patch | 52 +++ 0012-modprobe-print-unsupported-status.patch | 75 ++++ kmod.changes | 414 ++++++++++++++++++ kmod.spec | 183 ++++++++ ...info-even-for-modules-built-into-the.patch | 60 +++ no-stylesheet-download.patch | 8 + usr-lib-modprobe.patch | 87 ++++ 13 files changed, 1158 insertions(+) create mode 100644 .gitignore create mode 100644 .kmod.metadata create mode 100644 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch create mode 100644 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch create mode 100644 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch create mode 100644 0010-modprobe-Implement-allow-unsupported-modules.patch create mode 100644 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch create mode 100644 0012-modprobe-print-unsupported-status.patch create mode 100644 kmod.changes create mode 100644 kmod.spec create mode 100644 libkmod-Provide-info-even-for-modules-built-into-the.patch create mode 100644 no-stylesheet-download.patch create mode 100644 usr-lib-modprobe.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb0b516 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +kmod-29.tar.sign +kmod-29.tar.xz diff --git a/.kmod.metadata b/.kmod.metadata new file mode 100644 index 0000000..ff561c8 --- /dev/null +++ b/.kmod.metadata @@ -0,0 +1,2 @@ +16c93578be28e3561a1d232af4d817d68ca61a912ecee0b9a6f90fde8db55669 kmod-29.tar.sign +60a371df526908808c3f59bf6e21c5b670479bc62694aee21cb6a199455942bf kmod-29.tar.xz diff --git a/0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch b/0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch new file mode 100644 index 0000000..0878ee7 --- /dev/null +++ b/0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch @@ -0,0 +1,41 @@ +From bbeef7f559bd9c6b1aad11bcd65e56428f290bd8 Mon Sep 17 00:00:00 2001 +From: Michal Marek +Date: Wed, 26 Feb 2014 13:48:55 +0100 +Subject: [PATCH 1/6] modprobe: Recognize --allow-unsupported-modules on + commandline + +The option does not do anything yet, but it does not return error +either. + +References: fate#316971 +Patch-mainline: never +--- + tools/modprobe.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/tools/modprobe.c b/tools/modprobe.c +index a9e2331..3be2989 100644 +--- a/tools/modprobe.c ++++ b/tools/modprobe.c +@@ -85,6 +85,8 @@ static const struct option cmdopts[] = { + {"dirname", required_argument, 0, 'd'}, + {"set-version", required_argument, 0, 'S'}, + ++ {"allow-unsupported-modules", no_argument, 0, 128}, ++ + {"syslog", no_argument, 0, 's'}, + {"quiet", no_argument, 0, 'q'}, + {"verbose", no_argument, 0, 'v'}, +@@ -843,6 +845,9 @@ static int do_modprobe(int argc, char **orig_argv) + case 'S': + kversion = optarg; + break; ++ case 128: ++ /* --allow-unsupported-modules does nothing for now */ ++ break; + case 's': + env_modprobe_options_append("-s"); + use_syslog = 1; +-- +2.20.1 + diff --git a/0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch b/0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch new file mode 100644 index 0000000..e3c20a9 --- /dev/null +++ b/0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch @@ -0,0 +1,29 @@ +From ede3e6010e5a132286c3a1ee815ec88bdef847b8 Mon Sep 17 00:00:00 2001 +From: Michal Marek +Date: Wed, 26 Feb 2014 13:53:38 +0100 +Subject: [PATCH 2/6] libkmod-config: Recognize allow_unsupported_modules in + the configuration + +References: fate#316971 +Patch-mainline: never +--- + libkmod/libkmod-config.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c +index aaac0a1..1b24536 100644 +--- a/libkmod/libkmod-config.c ++++ b/libkmod/libkmod-config.c +@@ -650,6 +650,9 @@ static int kmod_config_parse(struct kmod_config *config, int fd, + || streq(cmd, "config")) { + ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n", + filename, cmd); ++ } else if (streq(cmd, "allow_unsupported_modules")) { ++ /* dummy option for now */ ++ ; + } else { + syntax_error: + ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n", +-- +2.20.1 + diff --git a/0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch b/0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch new file mode 100644 index 0000000..1f8a430 --- /dev/null +++ b/0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch @@ -0,0 +1,108 @@ +From 4a36f4a8b16c7fd345f6aec973d926d4e429328a Mon Sep 17 00:00:00 2001 +From: Michal Marek +Date: Wed, 5 Mar 2014 14:40:14 +0100 +Subject: [PATCH 3/6] libkmod: Implement filtering of unsupported modules (off + by default) + +References: fate#316971 +Patch-mainline: never +--- + libkmod/libkmod-config.c | 12 ++++++++++-- + libkmod/libkmod-internal.h | 1 + + libkmod/libkmod-module.c | 31 +++++++++++++++++++++++++++++++ + 3 files changed, 42 insertions(+), 2 deletions(-) + +diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c +index 1b24536..07d6a9e 100644 +--- a/libkmod/libkmod-config.c ++++ b/libkmod/libkmod-config.c +@@ -651,8 +651,16 @@ static int kmod_config_parse(struct kmod_config *config, int fd, + ERR(ctx, "%s: command %s is deprecated and not parsed anymore\n", + filename, cmd); + } else if (streq(cmd, "allow_unsupported_modules")) { +- /* dummy option for now */ +- ; ++ char *param = strtok_r(NULL, "\t ", &saveptr); ++ ++ if (param == NULL) ++ goto syntax_error; ++ if (streq(param, "yes") || streq(param, "1")) ++ config->block_unsupported = 0; ++ else if (streq(param, "no") || streq(param, "0")) ++ config->block_unsupported = 1; ++ else ++ goto syntax_error; + } else { + syntax_error: + ERR(ctx, "%s line %u: ignoring bad line starting with '%s'\n", +diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h +index a65ddd1..2ad74c7 100644 +--- a/libkmod/libkmod-internal.h ++++ b/libkmod/libkmod-internal.h +@@ -119,6 +119,7 @@ struct kmod_config { + struct kmod_list *softdeps; + + struct kmod_list *paths; ++ int block_unsupported; + }; + + int kmod_config_new(struct kmod_ctx *ctx, struct kmod_config **config, const char * const *config_paths) __attribute__((nonnull(1, 2,3))); +diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c +index bffe715..9a3a35a 100644 +--- a/libkmod/libkmod-module.c ++++ b/libkmod/libkmod-module.c +@@ -798,6 +798,24 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, + + extern long init_module(const void *mem, unsigned long len, const char *args); + ++static int check_module_supported(struct kmod_module *mod) ++{ ++ char **strings; ++ int i, count; ++ struct kmod_elf *elf; ++ ++ elf = kmod_file_get_elf(mod->file); ++ count = kmod_elf_get_strings(elf, ".modinfo", &strings); ++ if (count < 0) ++ return count; ++ for (i = 0; i < count; i++) ++ if (streq(strings[i], "supported=yes") || ++ streq(strings[i], "supported=external")) { ++ return 1; ++ } ++ return 0; ++} ++ + /** + * kmod_module_insert_module: + * @mod: kmod module +@@ -823,6 +841,7 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod, + struct kmod_elf *elf; + const char *path; + const char *args = options ? options : ""; ++ const struct kmod_config *config = kmod_get_config(mod->ctx); + + if (mod == NULL) + return -ENOENT; +@@ -841,6 +860,18 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod, + } + } + ++ if (config->block_unsupported) { ++ err = check_module_supported(mod); ++ if (err < 0) ++ return err; ++ else if (err == 0) { ++ ERR(mod->ctx, "module '%s' is unsupported\n", mod->name); ++ ERR(mod->ctx, "Use --allow-unsupported or set allow_unsupported_modules 1 in\n"); ++ ERR(mod->ctx, "/etc/modprobe.d/10-unsupported-modules.conf\n"); ++ return -EPERM; ++ } ++ } ++ + if (kmod_file_get_direct(mod->file)) { + unsigned int kernel_flags = 0; + +-- +2.20.1 + diff --git a/0010-modprobe-Implement-allow-unsupported-modules.patch b/0010-modprobe-Implement-allow-unsupported-modules.patch new file mode 100644 index 0000000..fbd5c43 --- /dev/null +++ b/0010-modprobe-Implement-allow-unsupported-modules.patch @@ -0,0 +1,97 @@ +From 6cf25e17064cb213ef8c3a9c84ab787dd2852f2a Mon Sep 17 00:00:00 2001 +From: Michal Marek +Date: Wed, 5 Mar 2014 15:02:44 +0100 +Subject: [PATCH 4/6] modprobe: Implement --allow-unsupported-modules + +References: fate#316971 +Patch-mainline: never +--- + Makefile.am | 4 +++- + libkmod/libkmod-unsupported.c | 9 +++++++++ + libkmod/libkmod-unsupported.h | 8 ++++++++ + tools/modprobe.c | 8 +++++++- + 4 files changed, 27 insertions(+), 2 deletions(-) + create mode 100644 libkmod/libkmod-unsupported.c + create mode 100644 libkmod/libkmod-unsupported.h + +diff -u kmod-28.orig/Makefile.am kmod-28/Makefile.am +--- kmod-28.orig/Makefile.am 2021-01-07 19:29:12.972438665 +0100 ++++ kmod-28/Makefile.am 2021-01-28 12:59:16.613421834 +0100 +@@ -108,7 +108,9 @@ + ${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS} + + noinst_LTLIBRARIES += libkmod/libkmod-internal.la +-libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES) ++libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES) \ ++ libkmod/libkmod-unsupported.c \ ++ libkmod/libkmod-unsupported.h + libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \ + -Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym + libkmod_libkmod_internal_la_DEPENDENCIES = $(libkmod_libkmod_la_DEPENDENCIES) +Index: kmod-27/libkmod/libkmod-unsupported.c +=================================================================== +--- /dev/null ++++ kmod-27/libkmod/libkmod-unsupported.c +@@ -0,0 +1,9 @@ ++#include "libkmod-internal.h" ++#include "libkmod-unsupported.h" ++ ++void kmod_internal_allow_unsupported(struct kmod_ctx *ctx) ++{ ++ struct kmod_config *config = (struct kmod_config *)kmod_get_config(ctx); ++ ++ config->block_unsupported = 0; ++} +Index: kmod-27/libkmod/libkmod-unsupported.h +=================================================================== +--- /dev/null ++++ kmod-27/libkmod/libkmod-unsupported.h +@@ -0,0 +1,8 @@ ++#pragma once ++ ++/* ++ * This function implements the --allow-unsupported-modules modprobe ++ * option. It is not part of the kmod API and not exported by the shared ++ * library ++ */ ++void kmod_internal_allow_unsupported(struct kmod_ctx *ctx); +Index: kmod-27/tools/modprobe.c +=================================================================== +--- kmod-27.orig/tools/modprobe.c ++++ kmod-27/tools/modprobe.c +@@ -38,6 +38,8 @@ + + #include "kmod.h" + ++#include "libkmod/libkmod-unsupported.h" ++ + static int log_priority = LOG_CRIT; + static int use_syslog = 0; + #define LOG(...) log_printf(log_priority, __VA_ARGS__) +@@ -761,6 +763,7 @@ static int do_modprobe(int argc, char ** + const char *dirname = NULL; + const char *root = NULL; + const char *kversion = NULL; ++ int allow_unsupported = 0; + int use_all = 0; + int do_remove = 0; + int do_show_config = 0; +@@ -852,7 +855,7 @@ static int do_modprobe(int argc, char ** + kversion = optarg; + break; + case 128: +- /* --allow-unsupported-modules does nothing for now */ ++ allow_unsupported = 1; + break; + case 's': + env_modprobe_options_append("-s"); +@@ -925,6 +928,9 @@ static int do_modprobe(int argc, char ** + + log_setup_kmod_log(ctx, verbose); + ++ if (allow_unsupported) ++ kmod_internal_allow_unsupported(ctx); ++ + kmod_load_resources(ctx); + + if (do_show_config) diff --git a/0011-Do-not-filter-unsupported-modules-when-running-a-van.patch b/0011-Do-not-filter-unsupported-modules-when-running-a-van.patch new file mode 100644 index 0000000..7be6304 --- /dev/null +++ b/0011-Do-not-filter-unsupported-modules-when-running-a-van.patch @@ -0,0 +1,52 @@ +From 9d2f7d1e372d79dfe732992effb33daf4ee56235 Mon Sep 17 00:00:00 2001 +From: Michal Marek +Date: Fri, 4 Apr 2014 10:08:01 +0200 +Subject: [PATCH 5/6] Do not filter unsupported modules when running a vanilla + kernel + +References: bnc#871066 +Patch-mainline: never +--- + libkmod/libkmod-config.c | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c +index 07d6a9e..550a612 100644 +--- a/libkmod/libkmod-config.c ++++ b/libkmod/libkmod-config.c +@@ -566,6 +566,18 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config) + return 0; + } + ++/* ++ * Check if kernel is built with the SUSE "suppported-flag" patch ++ */ ++static int is_suse_kernel(void) ++{ ++ if (access("/proc/sys/kernel/", F_OK) == 0 && ++ access("/proc/sys/kernel/unsupported", F_OK) == -1 && ++ errno == ENOENT) ++ return 0; ++ return 1; ++} ++ + /* + * Take an fd and own it. It will be closed on return. filename is used only + * for debug messages +@@ -657,9 +669,10 @@ static int kmod_config_parse(struct kmod_config *config, int fd, + goto syntax_error; + if (streq(param, "yes") || streq(param, "1")) + config->block_unsupported = 0; +- else if (streq(param, "no") || streq(param, "0")) +- config->block_unsupported = 1; +- else ++ else if (streq(param, "no") || streq(param, "0")) { ++ if (is_suse_kernel()) ++ config->block_unsupported = 1; ++ } else + goto syntax_error; + } else { + syntax_error: +-- +2.20.1 + diff --git a/0012-modprobe-print-unsupported-status.patch b/0012-modprobe-print-unsupported-status.patch new file mode 100644 index 0000000..424c138 --- /dev/null +++ b/0012-modprobe-print-unsupported-status.patch @@ -0,0 +1,75 @@ +From e48d1ee5980643f56165a9ee1687ff64f864aeb6 Mon Sep 17 00:00:00 2001 +From: Vlad Bespalov +Date: Fri, 8 Jun 2018 21:13:00 +0000 +Subject: [PATCH 6/6] modprobe: print status of "allow_unsupported_modules" + variable + +In SLES11 modprobe printed everything referenced in /etc/modprobe.d +in SLES12 config parsing changed to explicitly find and print +specific groups of modprobe options, which did not print +the status of "allow_unsupported_modules" option when running +modprobe -c +The proposed patch fixes this deficiency + +Patch-mainline: never +--- + libkmod/libkmod-config.c | 13 +++++++++++++ + libkmod/libkmod.h | 1 + + tools/modprobe.c | 5 +++++ + 3 files changed, 19 insertions(+) + +diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c +index 550a612..0fc2250 100644 +--- a/libkmod/libkmod-config.c ++++ b/libkmod/libkmod-config.c +@@ -1008,6 +1008,19 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx, + * @short_description: retrieve current libkmod configuration + */ + ++/* ++ * kmod_config_unsupported_allowed: ++ * @ctx: kmod library context ++ * ++ * Retrieve status of unsupported modules ++ */ ++KMOD_EXPORT bool kmod_config_unsupported_allowed(const struct kmod_ctx *ctx) ++{ ++ struct kmod_config *config = (struct kmod_config *)kmod_get_config(ctx); ++ ++ return !config->block_unsupported; ++} ++ + /** + * kmod_config_get_blacklists: + * @ctx: kmod library context +diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h +index 352627e..c2b9657 100644 +--- a/libkmod/libkmod.h ++++ b/libkmod/libkmod.h +@@ -115,6 +115,7 @@ const char *kmod_config_iter_get_key(const struct kmod_config_iter *iter); + const char *kmod_config_iter_get_value(const struct kmod_config_iter *iter); + bool kmod_config_iter_next(struct kmod_config_iter *iter); + void kmod_config_iter_free_iter(struct kmod_config_iter *iter); ++bool kmod_config_unsupported_allowed(const struct kmod_ctx *ctx); + + /* + * kmod_module +diff --git a/tools/modprobe.c b/tools/modprobe.c +index aa4033d..4f1c54a 100644 +--- a/tools/modprobe.c ++++ b/tools/modprobe.c +@@ -201,6 +201,11 @@ static int show_config(struct kmod_ctx *ctx) + kmod_config_iter_free_iter(iter); + } + ++ // SUSE specific option: ++ if (!kmod_config_unsupported_allowed(ctx)) { ++ puts("allow_unsupported_modules 0\n"); ++ } ++ + puts("\n# End of configuration files. Dumping indexes now:\n"); + fflush(stdout); + +-- +2.20.1 + diff --git a/kmod.changes b/kmod.changes new file mode 100644 index 0000000..30e8e93 --- /dev/null +++ b/kmod.changes @@ -0,0 +1,414 @@ +* Mon Dec 6 2021 msuchanek@suse.com +- Ensure that kmod and packages linking to libkmod provide same features + (bsc#1193430). +* Thu Oct 28 2021 msuchanek@suse.com +- Enable ZSTD on 15.3 as well (boo#1192104). +- Only test ZSTD in testsuite on releases where it is available. +* Fri Sep 24 2021 msuchanek@suse.de +- Enable ZSTD on 15.4 (jsc#SLE-21256). +* Mon Sep 6 2021 msuchanek@suse.com +- Use docbook 4 rather than docbook 5 for building man pages (bsc#1190190). + * Refres no-stylesheet-download.patch +* Fri Aug 27 2021 msuchanek@suse.com +- Add ZSTD support on Tumbleweed only. Add a way to detect ZSTD. +* Wed Aug 18 2021 msuchanek@suse.de +- 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 2021 gmbr3@opensuse.org +- Enable support for ZSTD compressed modules +* Sat May 29 2021 msuchanek@suse.de +- /usr/lib should override /lib where both are available. Support /usr/lib for + depmod.d as well. + * Refresh usr-lib-modprobe.patch +- Remove test patches included in release 29 + - kmod-populate-modules-Use-more-bash-more-quotes.patch + - kmod-testsuite-compress-modules-if-feature-is-enabled.patch + - kmod-also-test-xz-compression.patch +* Thu May 27 2021 jengelh@inai.de +- Update to release 29 + * Fix `modinfo -F` not working for built-in modules and + certain fields. + * Fix a memory leak, overflow and double free on error path. +- Drop 0001-Fix-modinfo-F-always-shows-name-for-built-ins.patch, + 0001-libkmod-config-revamp-kcmdline-parsing-into-a-state-.patch, + 0002-libkmod-config-re-quote-option-from-kernel-cmdline.patch + (all merged) +* Thu Feb 18 2021 jslaby@suse.cz +- Fix grub's requoted kernel parameters (bsc#1181111) + * 0001-libkmod-config-revamp-kcmdline-parsing-into-a-state-.patch + * 0002-libkmod-config-re-quote-option-from-kernel-cmdline.patch +* Thu Feb 4 2021 msuchanek@suse.de +- Fix tests to not test disabled features. Disable zstd again. + * kmod-populate-modules-Use-more-bash-more-quotes.patch + * kmod-testsuite-compress-modules-if-feature-is-enabled.patch + * kmod-also-test-xz-compression.patch +* Fri Jan 29 2021 dimstar@opensuse.org +- Supplement bash-completion subpackage against the main package + and bash-completion. +- Also require the main package plus bash-completion: the + completion package is useless without either of the two. +* Thu Jan 28 2021 msuchanek@suse.com +- Update to v28 + * Add Zstandard to the supported compression formats using libzstd + (tests only - cannot be disabled in tests) + * Ignore ill-formed kernel command line, e.g. with "ivrs_acpihid[00:14.5]=AMD0020:0" + option in it + * Fix some memory leaks + * Fix 0-length builtin.alias.bin: it needs at least the index header +* Thu Jan 28 2021 pvorel@suse.cz +- Backport upstream fix 0001-Fix-modinfo-F-always-shows-name-for-built-ins.patch +* Tue Jan 12 2021 msuchanek@suse.de +- Update usr-lib-modprobe.patch to upstream submission (boo#1180821). +- Require libxslt-tools for xsltproc and use local stylesheet. + * no-stylesheet-download.patch +* Fri Nov 6 2020 jengelh@inai.de +- Add usr-lib-modprobe.patch [boo#1092648] +* Fri Oct 16 2020 lnussel@suse.de +- prepare usrmerge (boo#1029961) +* Tue Jul 7 2020 jengelh@inai.de +- Drop old RPM constructs from the build recipe. +* Fri Jul 3 2020 msuchanek@suse.com +- Drop kmod-compat (boo#1173353): + The symlinks in kmod-compat are not obsolete. They are + desirable for kernel module autoload. The "kernel.modprobe" + sysctl references /sbin/modprobe, and changing it to + "/usr/bin/kmod load" is not possible, because this sysctl + specifies a single executable, not a command (so spaces will be + treated as part of the filename). +* Wed May 27 2020 jengelh@inai.de +- Update to release 27 + * Link to libcrypto rather than requiring openssl. + * Use PKCS#7 instead of CMS for parsing module signature to be + compatible with LibreSSL and OpenSSL < 1.1.0. + * Teach modinfo to parse modules.builtin.modinfo. When using + Linux kernel >= v5.2~rc1, it is possible to get module + information from this new file. +* Tue Feb 12 2019 msuchanek@suse.com +- Enable PKCS#7 signature parsing again - requires openssl +- Fix testsuite build - requires kernel-default-devel +* Fri Feb 8 2019 jengelh@inai.de +- Update to new upstream release 26 + * depmod now handles parallel invocations better by protecting + the temporary files being used. + * modprobe has a new --show-exports option. Under the hood, + this reads the .symtab and .strtab sections rather than + __versions so it shows useful data even if kernel is + configured without modversions (CONFIG_MODVERSIONS). + * modinfo supports PKCS#7 parsing by using openssl. +- Replaced the asn1c-based parser by an openssl-based PKCS + parser. +- Remove libkmod-signature-Fix-crash-when-module-signature-is.patch, + libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch, + libkmod-signature-implement-pkcs7-parsing-with-asn1c.patch + (not accepted upstream) +- Remove enum.patch, + depmod-Prevent-module-dependency-files-corruption-du.patch, + depmod-Prevent-module-dependency-files-missing-durin.patch, + depmod-shut-up-gcc-insufficinet-buffer-warning.patch + (accepted upstream) +* Fri Dec 7 2018 msuchanek@suse.de +- Fix module dependency file corruption on parallel invocation (bsc#1118629). +- Add depmod-Prevent-module-dependency-files-corruption-du.patch +- Add depmod-Prevent-module-dependency-files-missing-durin.patch +- Add depmod-shut-up-gcc-insufficinet-buffer-warning.patch +* Wed Jul 18 2018 jengelh@inai.de +- Remove enum padding constants, add enum.patch (boo#1097869). +* Fri Jun 8 2018 vlad.botanic@gmail.com +- allow 'modprobe -c' print the status of "allow_unsupported_modules" option. + Add 0012-modprobe-print-unsupported-status.patch +* Fri Apr 6 2018 msuchanek@suse.com +- Fix crash when PKCS#7 signer name is not present in signature (bsc#1088244) + Add libkmod-signature-pkcs-7-fix-crash-when-signer-info-.patch +* Fri Mar 16 2018 ro@suse.de +- for sle, buildexclude the 32bit platforms in kmod-testsuite, + they have no kernel binaries anyway (bnc#1085640) +* Thu Mar 8 2018 msuchanek@suse.com +- Fix PKCS#7 signature display in modinfo (bsc#1077693). + * Add libkmod-signature-implement-pkcs7-parsing-with-asn1c.patch + * Add libkmod-signature-Fix-crash-when-module-signature-is.patch + * Refresh 0010-modprobe-Implement-allow-unsupported-modules.patch +* Thu Feb 1 2018 msuchanek@suse.com +- Update to kmod v25 + * Fix resolving symbols with MODULE_REL_CRCS (bsc#1077867) +- Drop depmod-Don-t-add-.TOC.-when-it-s-in-the-kernel.patch +* Thu Dec 7 2017 msuchanek@suse.com +- Fix resolving .TOC. in modules on 4.4 and older kernel (bsc#1070209) + depmod-Don-t-add-.TOC.-when-it-s-in-the-kernel.patch +* Mon Nov 20 2017 msuchanek@suse.com +- Move dependency on suse-module-tools to kmod-compat (bsc#1047911). +* Mon Aug 28 2017 mmarek@suse.com +- Add missing coreutils dependency for initrd macros (bsc#1055492). +* Wed Jul 26 2017 jengelh@inai.de +- Add versioned requires between kmod-compat -> kmod +* Thu Jul 6 2017 jengelh@inai.de +- Update to new upstream release 24 + * libkmod: fix use of strcpy + * depmod: fix string overflow + * depmod: ignore related modules in depmod_report_cycles + * libkmod: Fix handling of quotes in kernel command line + * libkmod-config: replace 0/1 with bool + * depmod: handle nested loops +- Drop 0001-use-correct-sort-method-in-test-array.patch, + 0002-depmod-ignore-related-modules-in-depmod_report_cycle.patch, + 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch + (applied upstream) +- Remove support for openSUSE < 13.2 (non-dracut mkinitrd) +- Separate bash completion functions into extra package +- Move some of the symlinks from kmod-compat to kmod, + as kmod still does not have native support for all functions. +* Tue Nov 22 2016 yousaf.kaukab@suse.com +- 0002-depmod-ignore-related-modules-in-depmod_report_cycle.patch: + Fix buffer overflow when printing modules in cyclic dependency + chain (boo#1008186) +* Thu Jul 21 2016 jengelh@inai.de +- Update to new upstream release 23 + * Don't add comment to modules.devname if it would otherwise be + empty. + * Ignore .TOC. symbols in depmod parsing. + * Fix crash on modinfo while checking for available signature of + unknown type. + * Teach modinfo about PKCS#7 module signatures. +- Drop depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch (merged), + 0001-libkmod-Handle-long-lines-in-proc-modules.patch (merged) +* Thu Jul 21 2016 mmarek@suse.com +- Regenerate initrd on kmod update (bsc#989788) +- Sync specfile with openSUSE:Factory +* Fri Jun 17 2016 mmarek@suse.cz +- libkmod: Handle long lines in /proc/modules (bsc#983754) + 0001-libkmod-Handle-long-lines-in-proc-modules.patch +* Tue Feb 9 2016 dvaleev@suse.com +- Fix kernel master build for ppc64le (bsc#1070209) + depmod-Ignore_PowerPC64_ABIv2_.TOC.symbol.patch +* Mon Dec 7 2015 jengelh@inai.de +- Update to new upstream release 22 + * support `insmod -f` + * depmod: do not fall back to uname on bad version +* Sat Nov 7 2015 jengelh@inai.de +- Update to new upstream release 21 + * The kmod tool now prints the relevant configuration options it was built + with when the "--version" argument is passed. +* Tue Apr 21 2015 mmarek@suse.cz +- Update to kmod 20 + * More robust ELF parsing + * To fix a race, modprobe only looks at modules.builtin to + determine a builtin module, so e.g. 'modprobe vt' will no longer + work. + * Other fixes + * Testsuite moved to a separate package, since it is now building + the test modules from sources, which requires the kernel package. + * dropped kmod-blacklist-fixtest.patch (merged upstream) + * includes 0001-Fix-race-while-loading-modules.patch (bsc#998906) +* Thu Apr 2 2015 crrodriguez@opensuse.org +- If kmod packge changes, regenerate the initrd. +* Fri Mar 6 2015 meissner@suse.com +- 0001-use-correct-sort-method-in-test-array.patch: use correct test + bsc#920930 +* Sun Feb 22 2015 meissner@suse.com +- kmod-blacklist-fixtest.patch: tag the test in test-blacklist correctly +* Sun Nov 16 2014 jengelh@inai.de +- Move include files out of pkg/ into a normal subdir of includedir. +* Sun Nov 16 2014 crrodriguez@opensuse.org +- Update to kmod 19 + * Fix missing CLOEXEC in library + * Fix error message while opening kmod's index + * static-nodes: when writing in tmpfiles format, indicate that + creation of static nodes should only happen at boot. This is used + and required by systemd-217+. +* Sat Nov 8 2014 crrodriguez@opensuse.org +- Build with full RELRO. +- Enable verbose build (build checks depend on that) +* Thu Sep 4 2014 mmarek@suse.cz +- Do not filter unsupported modules when running a vanilla kernel + (bnc#871066). New patch: + 0011-Do-not-filter-unsupported-modules-when-running-a-van.patch +* Tue Jun 24 2014 jengelh@inai.de +- Update to new upstream release 18 + * Calling depmod with modules creating a dependency loop will now + make depmod return an error and not update the indexes. This is + to protect the current index not being overridden by another + index that may cause a boot failure, depending on the buggy module. +- Remove last vestiges of gpg-offline +- Remove 0001-depmod-Make-dependency-loops-be-fatal.patch + (applied upstream) +* Fri May 16 2014 matwey.kornilov@gmail.com +- Remove 0001-Fix-recursion-loop-in-mod_count_all_dependencies-whe.patch +- Add 0001-depmod-Make-dependency-loops-be-fatal.patch (upstream fix for bnc#872715) +* Sat Apr 12 2014 matwey.kornilov@gmail.com +- Add 0001-Fix-recursion-loop-in-mod_count_all_dependencies-whe.patch + * Fix segfault at cycled deps (bnc#872715) +* Fri Apr 11 2014 mmarek@suse.cz +- testsutie: Uncompress most modules (updated test-files.tar.xz) +- testsuite: Do not run tests with *.ko.gz if zlib is not enabled +- Disable compression support, as other tools do not support it + (e.g. module signing) +* Tue Apr 8 2014 mmarek@suse.cz +- Remove the now obsolete test-files.tar.xz tarball +* Mon Apr 7 2014 mmarek@suse.com +- Updated to kmod 17 + * Do not require xsltproc for build + * Parse softdeps stored in kernel modules + * Add experimental python bindings (not enabled in the package yet) + * Misc bugfixes +- Deleted patches that went upstream. Only the unsupported modules + feature remains: + 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch + 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch + 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch + 0010-modprobe-Implement-allow-unsupported-modules.patch +* Tue Apr 1 2014 mmarek@suse.cz +- libkmod: Ignore errors from softdeps (bnc#831227) +- config: also parse softdeps from modules (bnc#831227) +* Mon Mar 31 2014 mmarek@suse.cz +- libkmod-config,depmod: Accept special files as configuration + files, too +- libkmod-config: Only match dot before '=' in /proc/cmdline +* Tue Mar 11 2014 mmarek@suse.cz +- Provide and obsolete module-init-tools (bnc#867442) +* Fri Mar 7 2014 mmarek@suse.cz +- testsuite: Fix uname() during glibc startup +* Wed Mar 5 2014 mmarek@suse.cz +- testsuite: Check the list of loaded modules after a test +- testsuite: Add test for modprobe --force +- testsuite: Do not provide finit_module(2) on older kernels +- Add some tests for kernels without finit_module(2) +- libkmod-module: Simplify kmod_module_insert_module() +- libkmod: Implement filtering of unsupported modules (fate#316971) +- modprobe: Implement --allow-unsupported-modules (fate#316971) +- make the %%check section fatal +* Wed Feb 26 2014 mmarek@suse.cz +- Remove "rmmod -w" documentation and getopt entry +- modprobe: Recognize --allow-unsupported-modules on commandline + (fate#316971) +- libkmod-config: Recognize allow_unsupported_modules in the + configuration (fate#316971) +* Wed Feb 26 2014 mmarek@suse.cz +- Drop the non-upstream kmod-no-static.diff; the size difference is + negligible. +* Tue Jan 7 2014 jengelh@inai.de +- Update to new upstream release 16 + * The option to wait on module removal has been removed from the + kernel, and now from rmmod. The constant KMOD_REMOVE_NOWAIT in + libkmod is still there for backwards compatibility but it is + always enforced, passing O_NONBLOCK to delete_module(2). +* Mon Sep 2 2013 jengelh@inai.de +- Update to new upstream release 15 + * kmod static-nodes no longer fails if modules.devname does not exist + * Fix getting boolean parameter from kernel cmdline in case the + value is omitted + * kmod static-nodes creates parent directories if given a -o option +- Add kmod-no-static.diff +* Wed Jul 3 2013 jengelh@inai.de +- Update to new upstream release 14 + * Some bug fixes and a new "static-nodes" command to parse + modules.devname. +* Mon Apr 15 2013 crrodriguez@opensuse.org +- Update to new upstream release 13 + * depmod: --symbol-prefix actually requires an argument + * depmod: fix builtin symbols resolution when the prefix symbol is set + * libkmod: Use secure_getenv if available + * rmmod: Teach rmmod about builtin modules + * libkmod: add finit_module logic + * modprobe: Fix assertion on --show-depends with bogus config file + * Many other bugfixes see https://lwn.net/Articles/546711 +* Thu Dec 6 2012 jengelh@inai.de +- Update to new upstream release 12 + * Fix removing vermagic from module when told to force load a module + * Fix removing __versions section when told to force load a + module: we need to mangle the section header, not the section. + * modinfo no longer fails while loading a module from file when + path contains ".ko" substring +* Fri Nov 23 2012 jengelh@inai.de +- Require suse-module-tools now that it is present in Base:System +- kmod-compat depends on kmod, add that missing Requires. +* Sat Nov 10 2012 hrvoje.senjan@gmail.com +- Update to kmod-11 + * Fix testsuite defining symbols twice on 32 bit systems + * Allow to check generated files against correct ones + * libkmod now keeps a file opened after the first call to + * kmod_module_get_{info,versions,symbols,dependency_symbols}. This + reduces signficantly the amount of time depmod tool takes to + execute. Particularly if compressed modules are used. + * Remove --with-rootprefix from build system. It was not a great + idea after all and should not be use since it causes more harm + than benefits. + * Hide --wait option on rmmod. This feature is being targeted for + removal from kernel. rmmod still accepts this option, but it is + hidden now: man page and usage() says nothing about it and if + it is used, user will get a 10s sleep. This way we can check and + help if anyone is using this feature. + * Refactor message logging on all tools, giving proper prefix, + routing everything to syslog when asked for, etc. + * Fix parsing of modules.order when using compressed modules + * Usage messages go to stdout instead of stderr + * Fix memory leak in hash implementation +* Thu Sep 13 2012 jengelh@inai.de +- Provide the "modutils" virtual symbol +- Update to new upstream release 10 + * Read coresize from /sys if supported + * Add flag to kmod_module_probe_insert() to apply blacklisting + during probe only if mod is an alias. Now modprobe uses this + flag by default. +* Wed Jun 20 2012 rmilasan@suse.com +- Update to new upstream release 9 + * build-sys: allow compressed modules in testsuite + * build-sys: Make dirs writable on rootfs creation + * depmod: use ferror and fclose to check for error + * depmod: return error when index is truncated due to ENOSPC + * depmod: fix coding-style issue in array declaration + * depmod: fail if any index could not be created + * depmod: don't return error if modules.builtin don't exist + * libkmod-util: split function for usec conversion + * libkmod-util: add missing stdbool.h include +- Fix broken testsuites on 32bit systems. + add: fix-32bits.diff +* Sat Apr 21 2012 jengelh@medozas.de +- Restore patch descriptions + (and use `quilt setup` for rediff in future) +* Thu Apr 19 2012 rmilasan@suse.com +- Update to new upstream release 8 + * doc: remove links to NULL going nowhere. + * modprobe: handle -ENOENT return from init_module. + * doc: silent man page generation and fix gtk-doc warnings. + * modprobe: fix typo in config dump: option->options. +* Wed Apr 18 2012 rmilasan@suse.com +- Update to new upstream release 7 + * build-sys: don't set CFLAGS and LDFLAGS. + * build-sys: re-organize configure.ac. + * configure.ac: Move link only flags out of CFLAGS and into LDFLAGS. + * Add CC_CHECK_LDFLAGS_APPEND m4 macro. + * config: use order /etc, /run, /lib. + * modprobe: set log prio to 0 if user passed -q arg. + * modprobe: always try to remove all modules in command line. + * modprobe: don't check if module builtin to decide if it's builtin. + * modprobe: fix error path in removing modules. +* Sat Mar 10 2012 rschweikert@suse.com +- place binary in /usr tree (UsrMerge project) +* Sat Mar 3 2012 jengelh@medozas.de +- Update to new upstream release 6 + * New API: kmod_module_apply_filter, a function to apply filters + in a list of modules + * Lookup modules.builtin.bin to decide if a module is built into + the kernel + * Resolve infinite loops with softdeps and user configs with + install commands +* Tue Feb 7 2012 jengelh@medozas.de +- Update to new upstream release 5 + * modprobe no longer works with paths: it only accepts module names + and/or aliases now. More code is now shared by libkmod and + modprobe. +* Fri Jan 20 2012 jengelh@medozas.de +- Update to new upstream release 4 + * new APIs in libkmod: blacklists, install/remove commands, + aliases, options, softdeps and dumping indexes +* Fri Jan 6 2012 jengelh@medozas.de +- Update to new upstream release 3 + * new APIs in libkmod: get symbols from module, parsing the ELF + section, dependency symbols, insert module like modprobe + * support for Xz-compressed modules + * the depmod tool +* Sat Dec 24 2011 crrodriguez@opensuse.org +- Use --enable-zlib and buildRequire zlib +- run make check +* Sun Dec 18 2011 jengelh@medozas.de +- Initial package for build.opensuse.org diff --git a/kmod.spec b/kmod.spec new file mode 100644 index 0000000..a850686 --- /dev/null +++ b/kmod.spec @@ -0,0 +1,183 @@ +# +# spec file for package kmod +# +# Copyright (c) 2022-2023 ZhuningOS +# + + +%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150200 +%define use_zstd 1 +%endif + +Name: kmod +%define lname libkmod2 +Version: 29 +Release: 4.15.1 +Summary: Utilities to load modules into the kernel +License: GPL-2.0-or-later AND LGPL-2.1-or-later +Group: System/Kernel +URL: https://www.kernel.org/pub/linux/utils/kernel/kmod/ + +#Git-Web: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary +#Git-Clone: git://git.kernel.org/pub/scm/utils/kernel/kmod/kmod +Source: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.xz +Source2: https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-%version.tar.sign +Patch1: 0002-modprobe-Recognize-allow-unsupported-modules-on-comm.patch +Patch2: 0003-libkmod-config-Recognize-allow_unsupported_modules-i.patch +Patch3: 0009-libkmod-Implement-filtering-of-unsupported-modules-o.patch +Patch4: 0010-modprobe-Implement-allow-unsupported-modules.patch +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: docbook-xsl-stylesheets +BuildRequires: libopenssl-devel >= 1.1.0 +BuildRequires: libtool +BuildRequires: libxslt-tools +BuildRequires: pkgconfig >= 0.21 +BuildRequires: xz +BuildRequires: pkgconfig(liblzma) >= 4.99 +%if 0%{?use_zstd} +BuildRequires: pkgconfig(libzstd) +Provides: kmod-zstd +%endif +BuildRequires: pkgconfig(zlib) +Requires(post): coreutils +Obsoletes: kmod-compat < %version-%release +Provides: kmod-compat = %version-%release +# kmod and libkmod have no dependency but we want to provide +# same features across kmod provided tools and tools linking to libkmod +Conflicts: %lname < %version-%release +Conflicts: %lname > %version-%release +Requires: suse-module-tools +Obsoletes: module-init-tools < 3.16 +Provides: module-init-tools = 3.16 +Provides: modutils + +%description +kmod is a set of tools to handle common tasks with Linux kernel +modules like insert, remove, list, check properties, resolve +dependencies and aliases. + +These tools are designed on top of libkmod, a library that is shipped +with kmod. The aim is to be compatible with tools, configurations and +indexes from module-init-tools project. + +%package bash-completion +Summary: Bash completion routines for the kmod utilities +License: GPL-2.0-or-later AND LGPL-2.1-or-later +Group: System/Shells +BuildArch: noarch +Requires: %{name} +Requires: bash-completion +Supplements: (%{name} and bash-completion) + +%description bash-completion +Contains bash completion support for kmod utilities. + +%package -n %lname +Summary: Library to interact with Linux kernel modules +License: LGPL-2.1-or-later +Group: System/Libraries + +%description -n %lname +libkmod was created to allow programs to easily insert, remove and +list modules, also checking its properties, dependencies and aliases. + +%package -n libkmod-devel +Summary: Development files for libkmod +License: LGPL-2.1-or-later +Group: Development/Libraries/C and C++ +Requires: %lname = %version + +%description -n libkmod-devel +libkmod was created to allow programs to easily insert, remove and +list modules, also checking its properties, dependencies and aliases. + +This package contains the development headers for the library found +in %lname. + +%prep +%autosetup -p1 + +%build +autoreconf -fi +export LDFLAGS="-Wl,-z,relro,-z,now" +# The extra --includedir gives us the possibility to detect dependent +# packages which fail to properly use pkgconfig, cf. bugzilla.opensuse.org/795968 +%configure \ + --with-xz \ + --with-zlib \ + --with-openssl \ +%if 0%{?use_zstd} + --with-zstd \ +%endif + --includedir="%_includedir/kmod" \ + --with-rootlibdir="%_libdir" \ + --bindir="%_bindir" +%make_build + +%install +b="%buildroot" +%make_install +rm -f "$b/%_libdir"/*.la + +mkdir -p "$b/%_sbindir" "$b/sbin" +for i in depmod insmod lsmod modinfo modprobe rmmod; do + ln -s "%_bindir/kmod" "$b/%_sbindir/$i" +%if !0%{?usrmerged} + ln -s "%_bindir/kmod" "$b/sbin/$i" +%endif +done +mkdir -p "$b/%_bindir" "$b/bin" +for i in lsmod; do + ln -s "%_bindir/kmod" "$b/%_bindir/$i" +%if !0%{?usrmerged} + ln -s "%_bindir/kmod" "$b/bin/$i" +%endif +done + +%post +%{?regenerate_initrd_post} + +%posttrans +%{?regenerate_initrd_posttrans} + +%post -n %lname -p /sbin/ldconfig +%postun -n %lname -p /sbin/ldconfig + +%files +%_bindir/kmod +%_bindir/lsmod +%_sbindir/depmod +%_sbindir/insmod +%_sbindir/lsmod +%_sbindir/modinfo +%_sbindir/modprobe +%_sbindir/rmmod +%_mandir/man[58]/*.[58]* +%if !0%{?usrmerged} +/bin/lsmod +/sbin/depmod +/sbin/insmod +/sbin/lsmod +/sbin/modinfo +/sbin/modprobe +/sbin/rmmod +%endif + +%files bash-completion +%_datadir/bash-completion/ + +%files -n %lname +%_libdir/libkmod.so.2* + +%files -n libkmod-devel +%_includedir/* +%_libdir/pkgconfig/libkmod.pc +%_libdir/libkmod.so + +%changelog 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..a5e3b7a --- /dev/null +++ b/libkmod-Provide-info-even-for-modules-built-into-the.patch @@ -0,0 +1,60 @@ +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 + +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 | 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.31.1 + + diff --git a/no-stylesheet-download.patch b/no-stylesheet-download.patch new file mode 100644 index 0000000..04baf26 --- /dev/null +++ b/no-stylesheet-download.patch @@ -0,0 +1,8 @@ +--- kmod-27/man/Makefile.am~ 2018-01-31 18:10:59.569903733 +0100 ++++ kmod-27/man/Makefile.am 2021-01-12 21:48:28.488571775 +0100 +@@ -22,4 +22,4 @@ + --nonet \ + --stringparam man.output.quietly 1 \ + --param funcsynopsis.style "'ansi'" \ +- http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< ++ /usr/share/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl $< diff --git a/usr-lib-modprobe.patch b/usr-lib-modprobe.patch new file mode 100644 index 0000000..7339b0e --- /dev/null +++ b/usr-lib-modprobe.patch @@ -0,0 +1,87 @@ +From fc1b2c14e2ca4d7ccd4a3b75a435ab7d927533bc Mon Sep 17 00:00:00 2001 +From: Michal Suchanek +Date: Tue, 12 Jan 2021 16:54:46 +0100 +Subject: [PATCH] modprobe.d, depmod.d: load from /usr/lib. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There is an ongoing effort to limit use of files outside of /usr (or +$prefix on general). Currently all modprobe.d paths are hardcoded to +outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib. + +Cc: Marcus Rückert +Cc: Takashi Iwai +Cc: Dominique Leuenberger +Signed-off-by: Michal Suchanek +--- + Makefile.am | 1 + + libkmod/libkmod.c | 1 + + man/depmod.d.xml | 1 + + man/modprobe.d.xml | 1 + + tools/depmod.c | 1 + + 5 files changed, 5 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index d859c240178f..8553368988c0 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,6 +19,7 @@ AM_CPPFLAGS = \ + -include $(top_builddir)/config.h \ + -I$(top_srcdir) \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ ++ -DPREFIX=\""$(prefix)"\" \ + ${zlib_CFLAGS} + + AM_CFLAGS = $(OUR_CFLAGS) +diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c +index 7c2b889d713e..ddf13fb3d822 100644 +--- a/libkmod/libkmod.c ++++ b/libkmod/libkmod.c +@@ -65,6 +65,7 @@ static const char *default_config_paths[] = { + SYSCONFDIR "/modprobe.d", + "/run/modprobe.d", + "/usr/local/lib/modprobe.d", ++ PREFIX "/lib/modprobe.d", + "/lib/modprobe.d", + NULL + }; +diff --git a/man/depmod.d.xml b/man/depmod.d.xml +index b315e931d635..8a898cf4a9eb 100644 +--- a/man/depmod.d.xml ++++ b/man/depmod.d.xml +@@ -39,6 +39,7 @@ + + + ++ /lib/depmod.d/*.conf + /usr/lib/depmod.d/*.conf + /usr/local/lib/depmod.d/*.conf + /run/depmod.d/*.conf +diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml +index 0ab3e9110a7e..8a7c696dcee1 100644 +--- a/man/modprobe.d.xml ++++ b/man/modprobe.d.xml +@@ -41,6 +41,7 @@ + + + /lib/modprobe.d/*.conf ++ /usr/lib/modprobe.d/*.conf + /usr/local/lib/modprobe.d/*.conf + /run/modprobe.d/*.conf + /etc/modprobe.d/*.conf +diff --git a/tools/depmod.c b/tools/depmod.c +index eb810b811e35..8f6a4f8cd7cb 100644 +--- a/tools/depmod.c ++++ b/tools/depmod.c +@@ -54,6 +54,7 @@ static const char *default_cfg_paths[] = { + SYSCONFDIR "/depmod.d", + "/run/depmod.d", + "/usr/local/lib/depmod.d", ++ PREFIX "/lib/depmod.d", + "/lib/depmod.d", + NULL + }; +-- +2.26.2 +