Kernel Hot patch Creation Issue: dmesg Reporting Missing sssnic Module
Context
During kernel hot patch creation for openEuler LTS SP3, an unexpected dependency on the unmodified sssnic driver module caused activation failures. System logs indicate the livepatch system cannot find the required sssdk module, though the patch never intentionally modified this network driver module.
Version Information
- Kernel: 5.10.0-182.0.0.95.oe2203sp3.aarch64
- kpatch: 0.9.5-7.oe2203sp3.aarch64
Symptom
The hot patch creation command ./make_hotpatch -d .new -i procversion executed successfully but produced a non-functional patch. Diagnostic logs showed the system incorrectly marked the sssnic driver as modified, creating an unnecessary module dependency. Since this network driver is not loaded by default, the hot patch fails to activate with a missing module error.
[166439.721426] klp_procversion: tainting kernel with TAINT_LIVEPATCH
[166439.760137] livepatch: module 'sssdk' not loadedPossible Causes
The hot patch tool incorrectly identified changes in two driver components (
sss_tool_nic_func.candsss_tool_sdk.c) during ELF section comparison, despite no intentional modifications.Investigation revealed the build system always recompiles the sssnic module during incremental builds. kpatch detects binary differences between these compiled objects, erroneously including them in the hot patch.
Solution
Option 1: When creating hot patches not related to the sssnic module, you can exclude this module during difference detection by modifying the /usr/libexec/kpatch/kpatch-cc file. Add the sssnic source code path to the ignore list, then rebuild the hot patch to eliminate sssnic module dependencies and ensure proper hot patch functionality.
diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc
index 80d310c...688d92b 100755
--- a/kpatch-build/kpatch-cc
+++ b/kpatch-build/kpatch-cc
@@ -49,7 +49,8 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ ||
arch/powerpc/kernel/prom_init.o|\
lib/*|\
.*.o|\
- */.lib_exports.o)
+ */.lib_exports.o|\
+ drivers/net/ethernet/3snic/sssnic/*)
break
;;
*.o)Option 2: When compiler optimizations cause unmodified functions to be mistakenly flagged as changed, use the KPATCH_IGNORE_FUNCTION macro to exclude these functions from hot patch generation.
The build log reveals two modified functions in the sssnic module:
Testing patch file(s)
Reading special section data
Building original source
Building patched source
Extracting new and modified ELF sections
sss_tool_nic_func.o: changed function: sss_tool_ioctl
sss_tool_sdk.o: changed function: sss_tool_get_hw_drv_version
version.o: changed function: version_proc_showAdd the following statements after the function declarations in their respective files (note: place KPATCH_IGNORE_FUNCTION after function declarations to avoid symbol lookup errors):
#include "/usr/share/kpatch/patch/kpatch-macros.h"
KPATCH_IGNORE_FUNCTION(sss_tool_ioctl);#include "/usr/share/kpatch/patch/kpatch-macros.h"
KPATCH_IGNORE_FUNCTION(sss_tool_get_hw_drv_version);Re-run the command ./make_hotpatch -d .new -i procversion to rebuild the hot patch. This will resolve errors related to the unloaded sssnic module.
Licensed under the MulanPSL2