diff --git a/0002-Module-replace-the-module-with-new-module.patch b/0001-Module-replace-the-module-with-new-module.patch similarity index 91% rename from 0002-Module-replace-the-module-with-new-module.patch rename to 0001-Module-replace-the-module-with-new-module.patch index 8084b4c826edec1a3d3bd6a32840dbc3d09a16d0..d35c21350282a0e5e9231074319fe046f38da84f 100644 --- a/0002-Module-replace-the-module-with-new-module.patch +++ b/0001-Module-replace-the-module-with-new-module.patch @@ -1,4 +1,4 @@ -From 7b595d0319908149edb603c49da05f8d5904a8d3 Mon Sep 17 00:00:00 2001 +From 0eac0869e201a08170cb2255b623eab9d78072f8 Mon Sep 17 00:00:00 2001 From: Jason Luan Date: Wed, 16 Sep 2020 01:21:50 +0000 Subject: [PATCH 1/2] Module: replace the module with new module @@ -12,10 +12,10 @@ Signed-off-by: fu.lin 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index 714ee21..a243672 100644 +index 12d8ed1..fd9861a 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c -@@ -854,8 +854,11 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod, +@@ -911,8 +911,11 @@ KMOD_EXPORT int kmod_module_insert_module(struct kmod_module *mod, kernel_flags |= MODULE_INIT_IGNORE_VERMAGIC; if (flags & KMOD_INSERT_FORCE_MODVERSION) kernel_flags |= MODULE_INIT_IGNORE_MODVERSIONS; @@ -28,10 +28,10 @@ index 714ee21..a243672 100644 goto init_finished; } diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h -index 3cab2e5..241431e 100644 +index 7251aa7..a56e5b4 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h -@@ -148,6 +148,9 @@ enum kmod_remove { +@@ -153,6 +153,9 @@ enum kmod_remove { enum kmod_insert { KMOD_INSERT_FORCE_VERMAGIC = 0x1, KMOD_INSERT_FORCE_MODVERSION = 0x2, @@ -41,7 +41,7 @@ index 3cab2e5..241431e 100644 }; /* Flags to kmod_module_probe_insert_module() */ -@@ -159,6 +162,9 @@ enum kmod_probe { +@@ -164,6 +167,9 @@ enum kmod_probe { KMOD_PROBE_DRY_RUN = 0x00010, KMOD_PROBE_FAIL_ON_LOADED = 0x00020, @@ -104,5 +104,5 @@ index c422971..f0be196 100644 puts(PACKAGE " version " VERSION); puts(KMOD_FEATURES); -- -2.31.1 +2.35.1 diff --git a/0001-libkmod-module-check-new_from_name-return-value-in-g.patch b/0001-libkmod-module-check-new_from_name-return-value-in-g.patch deleted file mode 100644 index a91450ef87c8bca58246e4864b12bfa3b4e9651e..0000000000000000000000000000000000000000 --- a/0001-libkmod-module-check-new_from_name-return-value-in-g.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 64541d6aad210879e104e4796beeef49d4311f6d Mon Sep 17 00:00:00 2001 -From: Yauheni Kaliuta -Date: Tue, 8 Jun 2021 09:29:22 +0300 -Subject: [PATCH] libkmod-module: check "new_from_name" return value in - get_builtin - -Conflict:NA -Reference:https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/?id=64541d6aad210879e104e4796beeef49d4311f6d - -kmod_module_new_from_name() may fail and return error value. It is -handled properly across the code, but in this particular place the -check is missing. - -Signed-off-by: Yauheni Kaliuta ---- - libkmod/libkmod-module.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index b6320cc..6e0ff1a 100644 ---- a/libkmod/libkmod-module.c -+++ b/libkmod/libkmod-module.c -@@ -2912,7 +2912,10 @@ int kmod_module_get_builtin(struct kmod_ctx *ctx, struct kmod_list **list) - goto fail; - } - -- kmod_module_new_from_name(ctx, modname, &mod); -+ err = kmod_module_new_from_name(ctx, modname, &mod); -+ if (err < 0) -+ goto fail; -+ - kmod_module_set_builtin(mod, true); - - *list = kmod_list_append(*list, mod); --- -2.23.0 - diff --git a/0003-Module-suspend-the-module-by-rmmod-r-option.patch b/0002-Module-suspend-the-module-by-rmmod-r-option.patch similarity index 88% rename from 0003-Module-suspend-the-module-by-rmmod-r-option.patch rename to 0002-Module-suspend-the-module-by-rmmod-r-option.patch index 0e8a6ef1d638202dae0db6cb4802b8ebfb6500b8..d84410e0ff046dd3c86a74fc92b019e058ba2dea 100644 --- a/0003-Module-suspend-the-module-by-rmmod-r-option.patch +++ b/0002-Module-suspend-the-module-by-rmmod-r-option.patch @@ -1,4 +1,4 @@ -From 6a31ae1b9bdd731ffa71c2aeb1ce13e979c194d1 Mon Sep 17 00:00:00 2001 +From 3466b9698c4372ec81ed71384e1845898b7044d0 Mon Sep 17 00:00:00 2001 From: Ruidong Cao Date: Fri, 25 Sep 2020 03:00:25 -0400 Subject: [PATCH 2/2] Module: suspend the module by rmmod r option @@ -13,10 +13,10 @@ Signed-off-by: fu.lin 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index a243672..70b633f 100644 +index fd9861a..96f462a 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c -@@ -790,7 +790,7 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, +@@ -846,7 +846,7 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, return -ENOENT; /* Filter out other flags and force ONONBLOCK */ @@ -26,13 +26,13 @@ index a243672..70b633f 100644 err = delete_module(mod->name, flags); diff --git a/libkmod/libkmod.h b/libkmod/libkmod.h -index 241431e..bcdefc4 100644 +index a56e5b4..78d11b3 100644 --- a/libkmod/libkmod.h +++ b/libkmod/libkmod.h -@@ -142,6 +142,9 @@ struct kmod_module *kmod_module_get_module(const struct kmod_list *entry); - enum kmod_remove { - KMOD_REMOVE_FORCE = O_TRUNC, +@@ -147,6 +147,9 @@ enum kmod_remove { KMOD_REMOVE_NOWAIT = O_NONBLOCK, /* always set */ + /* libkmod-only defines, not passed to kernel */ + KMOD_REMOVE_NOLOG = 1, + + /* custom flag */ + KMOD_REMOVE_REPLACE = 0x1000, @@ -87,5 +87,5 @@ index 3942e7b..1278234 100644 use_syslog = 1; break; -- -2.31.1 +2.35.1 diff --git a/0004-don-t-check-module-s-refcnt-when-rmmod-with-r.patch b/0004-don-t-check-module-s-refcnt-when-rmmod-with-r.patch deleted file mode 100644 index f8a9247bb46d22b7c5d4fbf2bd24b6368fbe2eb0..0000000000000000000000000000000000000000 --- a/0004-don-t-check-module-s-refcnt-when-rmmod-with-r.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e48b7f950e8a6c8b6ba825a14a5aeb8a5064cdfc Mon Sep 17 00:00:00 2001 -From: Liu Chao -Date: Mon, 7 Jun 2021 06:46:49 +0000 -Subject: [PATCH] kmod: don't check module's refcnt when rmmod with -r - -When we remove module that only kernel livepatches depend on it by -remmod -r, we want to only invoke resume function. But kmod will check -refcnt first, if refcnt is more than zero, kmod won't call kernel's -delete_module. - -Signed-off-by: Liu Chao ---- - tools/rmmod.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/rmmod.c b/tools/rmmod.c -index 1278234..1d8d20b 100644 ---- a/tools/rmmod.c -+++ b/tools/rmmod.c -@@ -178,7 +178,7 @@ static int do_rmmod(int argc, char *argv[]) - break; - } - -- if (!(flags & KMOD_REMOVE_FORCE) && check_module_inuse(mod) < 0) { -+ if (!(flags & KMOD_REMOVE_FORCE) && !(flags & KMOD_REMOVE_REPLACE) && check_module_inuse(mod) < 0) { - r++; - goto next; - } --- -2.23.0 - diff --git a/Support-to-display-sm3-sig_hashalgo.patch b/Support-to-display-sm3-sig_hashalgo.patch deleted file mode 100644 index 6941cc6f330c4baa0a92439a1331476c93d6096e..0000000000000000000000000000000000000000 --- a/Support-to-display-sm3-sig_hashalgo.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9cf5b4af477347bb0f9ed51c28742c6baf62302b Mon Sep 17 00:00:00 2001 -From: luhuaxin -Date: Wed, 29 Jun 2022 14:33:30 +0800 -Subject: [PATCH] Support to display sm3 sig_hashalgo - -Signed-off-by: luhuaxin ---- - libkmod/libkmod-signature.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c -index 4e8748c..142570b 100644 ---- a/libkmod/libkmod-signature.c -+++ b/libkmod/libkmod-signature.c -@@ -56,6 +56,7 @@ enum pkey_hash_algo { - PKEY_HASH_SHA384, - PKEY_HASH_SHA512, - PKEY_HASH_SHA224, -+ PKEY_HASH_SM3, - PKEY_HASH__LAST - }; - -@@ -68,6 +69,7 @@ const char *const pkey_hash_algo[PKEY_HASH__LAST] = { - [PKEY_HASH_SHA384] = "sha384", - [PKEY_HASH_SHA512] = "sha512", - [PKEY_HASH_SHA224] = "sha224", -+ [PKEY_HASH_SM3] = "sm3", - }; - - enum pkey_id_type { -@@ -161,6 +163,10 @@ static int obj_to_hash_algo(const ASN1_OBJECT *o) - return PKEY_HASH_SHA512; - case NID_sha224: - return PKEY_HASH_SHA224; -+# ifndef OPENSSL_NO_SM3 -+ case NID_sm3: -+ return PKEY_HASH_SM3; -+# endif - default: - return -1; - } --- -1.8.3.1 - diff --git a/kmod.changes b/kmod.changes new file mode 100644 index 0000000000000000000000000000000000000000..7252645e18cc56a1eee4a68773ce361ca7ef41ca --- /dev/null +++ b/kmod.changes @@ -0,0 +1,90 @@ +%changelog +* Fri Sep 02 2022 fu.lin - 30-2 +- fit the old patch + +* Tue Jul 26 2022 Qingqing Li - 30-1 +- upgrade to kmod-30 + +* Wed Jun 29 2022 luhuaxin - 29-5 +- support to display sm3 sig_hashalgo + +* Thu Feb 24 2022 Yang Yanchao - 29-4 +- add package python3-kmod. + +* Fri Jan 7 2022 zhouwenpei - 29-3 +- kmod-devel: add requires on kmod-libs + +* Thu Dec 9 2021 Jiangfeng Xiao - 29-2 +- kmod: revert "depmod: Do not unlinkat orig depfile and add fync" + +* Fri Dec 3 2021 zhouwenpei - 29-1 +- update kmod to 29 + +* Mon Nov 29 2021 Yang Yanchao - 27-8 +- kmod: don't check module's refcnt when rmmod with -r + Module: replace the module with new module + Module: suspend the module by rmmod r option + +* Wed Nov 24 2021 Yang Yanchao - 27-7 +- Precisely filters ko files in "/lib/modules/$kernel/extra" + to avoid creating unnecessary symbols. + +* Tue Nov 9 2021 Yang Yanchao - 27-6 +- Sync the weak-modules script from the 20.03-LTS-SP1 +- use -V to sort kernel version in weak-modules + +* Fri Jun 18 2021 hushiyuan - 27-5 +- libkmod-module: check "new_from_name" return value in get_builtin +- libkmod:fix double free for modinfo in modules.buildin.modinfo +- libkmod:fix an overflow with wrong modules.builtin.modinfo +- libkmod-config:fix a memory leak when kmod_list_append failes +- Fix "modinfo -F always shows name for build-ins" + +* Thu Jan 14 2021 xinghe - 27-4 +- fix memory leak in kmodinfo and build warning + +* Fri Sep 04 2020 xinghe - 27-3 +- backport patch to deal with lspci -v error report + +* Fri Aug 21 2020 Wang Shuo - 27-2 +- remove unnecessary message + +* Fri Apr 17 2020 Wang Shuo - 27-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: update kmod to 27 + +* Wed Feb 26 2020 Wang Shuo - 25-6 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: move libs files to libs package + +* Sat Apr 6 2019 luochunsheng - 25-5 +- Type:enhancement +- ID:NA +- SUG:NA + +* Fri Mar 22 2019 kangenbo - 25-4 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: backport patches from communities + +* Tue Mar 19 2019 hexiaowen - 25-3 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: add /etc/depmod.d/dist.conf + +* Fri Jan 25 2019 Xiaoqi Guo - 25-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:add patches, include + bugfix-kmod-20-8-depmod-Don-t-unlinkat-orig-depfile-and-add-fsync.patch + +* Thu Jan 24 2019 openEuler Buildteam - 25-1 +- Package init + diff --git a/kmod.spec b/kmod.spec index 6cbf85fea4fbe65f2c2f2b25040f89a69102ff96..424c60f2e563e1a21c0778b7d5871cd1bbbdea66 100644 --- a/kmod.spec +++ b/kmod.spec @@ -1,6 +1,6 @@ Name: kmod Version: 30 -Release: 1 +Release: 2 Summary: Kernel module management # GPLv2+ is used by programs, LGPLv2+ is used for libraries. License: GPLv2+ and LGPLv2+ @@ -13,6 +13,8 @@ BuildRequires: gcc chrpath zlib-devel xz-devel libxslt openssl-devel Provides: module-init-tools = 4.0-1 Provides: /sbin/modprobe +Patch: 0001-Module-replace-the-module-with-new-module.patch +Patch: 0002-Module-suspend-the-module-by-rmmod-r-option.patch %description The kmod package provides several commands to manage the kernel modules, @@ -115,89 +117,3 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf %doc TODO NEWS README.md %changelog -* Tue Jul 26 2022 Qingqing Li - 30-1 -- upgrade to kmod-30 - -* Wed Jun 29 2022 luhuaxin - 29-5 -- support to display sm3 sig_hashalgo - -* Thu Feb 24 2022 Yang Yanchao - 29-4 -- add package python3-kmod. - -* Fri Jan 7 2022 zhouwenpei - 29-3 -- kmod-devel: add requires on kmod-libs - -* Thu Dec 9 2021 Jiangfeng Xiao - 29-2 -- kmod: revert "depmod: Do not unlinkat orig depfile and add fync" - -* Fri Dec 3 2021 zhouwenpei - 29-1 -- update kmod to 29 - -* Mon Nov 29 2021 Yang Yanchao - 27-8 -- kmod: don't check module's refcnt when rmmod with -r - Module: replace the module with new module - Module: suspend the module by rmmod r option - -* Wed Nov 24 2021 Yang Yanchao - 27-7 -- Precisely filters ko files in "/lib/modules/$kernel/extra" - to avoid creating unnecessary symbols. - -* Tue Nov 9 2021 Yang Yanchao - 27-6 -- Sync the weak-modules script from the 20.03-LTS-SP1 -- use -V to sort kernel version in weak-modules - -* Fri Jun 18 2021 hushiyuan - 27-5 -- libkmod-module: check "new_from_name" return value in get_builtin -- libkmod:fix double free for modinfo in modules.buildin.modinfo -- libkmod:fix an overflow with wrong modules.builtin.modinfo -- libkmod-config:fix a memory leak when kmod_list_append failes -- Fix "modinfo -F always shows name for build-ins" - -* Thu Jan 14 2021 xinghe - 27-4 -- fix memory leak in kmodinfo and build warning - -* Fri Sep 04 2020 xinghe - 27-3 -- backport patch to deal with lspci -v error report - -* Fri Aug 21 2020 Wang Shuo - 27-2 -- remove unnecessary message - -* Fri Apr 17 2020 Wang Shuo - 27-1 -- Type:enhancement -- ID:NA -- SUG:NA -- DESC: update kmod to 27 - -* Wed Feb 26 2020 Wang Shuo - 25-6 -- Type:enhancement -- ID:NA -- SUG:NA -- DESC: move libs files to libs package - -* Sat Apr 6 2019 luochunsheng - 25-5 -- Type:enhancement -- ID:NA -- SUG:NA - -* Fri Mar 22 2019 kangenbo - 25-4 -- Type:enhancement -- ID:NA -- SUG:NA -- DESC: backport patches from communities - -* Tue Mar 19 2019 hexiaowen - 25-3 -- Type:enhancement -- ID:NA -- SUG:NA -- DESC: add /etc/depmod.d/dist.conf - -* Fri Jan 25 2019 Xiaoqi Guo - 25-2 -- Type:bugfix -- ID:NA -- SUG:NA -- DESC:add patches, include - bugfix-kmod-20-8-depmod-Don-t-unlinkat-orig-depfile-and-add-fsync.patch - -* Thu Jan 24 2019 openEuler Buildteam - 25-1 -- Package init -