Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
description of repo status
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
12
Star
8
Fork
56
src-openEuler
/
kpatch
Closed
Code
Issues
4
Pull Requests
3
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
内核模块源码目录存在.git文件夹时,制作内核模块热补丁失败
Done
#IC8A25
Bug
肥牛卷卷卷
Opened this issue
2025-05-16 14:10
**【缺陷描述】:请补充详细的缺陷问题现象描述** **一、缺陷信息** **【缺陷所属的os版本】(如openEuler-22.03-LTS,参考命令"cat /etc/os-release"结果)** openEuler-24.03-LTS-SP1 **【内核版本】(如kernel-5.10.0-60.138.0.165,参考命令"uname -r"结果)** 6.6.0-84.0.0.89.oe2403sp1.aarch64 **【缺陷所属软件及版本号】(如kernel-5.10.0-60.138.0.165,参考命令"rpm -q 包名"结果)** kpatch-0.9.9-12.oe2403sp1.aarch64 **【环境信息】** 硬件信息 N/A 软件信息 N/A 网络信息 N/A **【问题复现步骤】:请描述具体的操作步骤** 1. 制作内核模块热补丁 2. 内核模块源码目录存在.git文件夹 **【实际结果】**,请描述出问题的结果和影响 当内核模块源码目录存在.git文件夹时,制作内核模块热补丁失败 **【期望结果】**,请描述出期望的结果和影响 成功 **【其他相关附件信息】** ``` CACHEDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build \ DISABLE_AFTER_LOAD=yes \ KEEP_JUMP_LABEL=yes \ NO_PROFILING_CALLS=yes \ OOT_MODULE=yes \ USERMODBUILDDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 \ kpatch-build \ --name testmod-846d130d \ --sourcedir /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 \ --config /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/kernel-6.6.0/linux-6.6.0-84.0.0.89.oe2403sp1.aarch64/.config \ --vmlinux /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux \ --jobs 128 \ --output /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/output \ --non-replace \ --oot-module /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0/testmod.ko \ --oot-module-src /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 \ /share/test/openEuler-24.03-LTS/kmod-patch/0001-testmod-modify-version-release.patch \ --skip-compiler-check \ --debug \ --skip-cleanup WARNING: Skipping compiler version matching check (not recommended) + [[ -n '' ]] + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + OOT_MODULE=yes + OOT_MODULE_SRCDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ -n yes ]] + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + mkdir -p /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/tmp + rm -rf '/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/tmp/*' + rm -f /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/build.log + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + KERNEL_SRCDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux ]] + [[ ! -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux ]] ++ strings /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux ++ grep -m 1 -e '^Linux version' ++ awk '{ print($3); }' + VMLINUX_VER=6.6.0-84.0.0.89.oe2403sp1.aarch64 + [[ -n '' ]] + [[ -z 6.6.0-84.0.0.89.oe2403sp1.aarch64 ]] + ARCHVERSION=6.6.0-84.0.0.89.oe2403sp1.aarch64 + [[ -n yes ]] + [[ yes != \y\e\s ]] + [[ -z 6.6.0-84.0.0.89.oe2403sp1.aarch64 ]] + [[ -n yes ]] + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + BUILDDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ 1 -eq 0 ]] + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + KVER=6.6.0 + [[ 6.6.0-84.0.0.89.oe2403sp1.aarch64 =~ - ]] + [[ '' = photon ]] + KREL=84.0.0.89.oe2403sp1.aarch64 + KREL=84.0.0.89.oe2403sp1 + [[ 6.6.0-84.0.0.89.oe2403sp1.aarch64 =~ .el7a. ]] + [[ -z '' ]] + [[ -z yes ]] + [[ '' = fedora ]] + [[ '' = rhel ]] + [[ '' = ol ]] + [[ '' = centos ]] + [[ '' = openEuler ]] + [[ '' = photon ]] + [[ '' = ubuntu ]] + [[ '' = debian ]] + save_env + export -p + grep -wv -e OLDPWD= -e PWD= + find_dirs + [[ -e /usr/bin/create-diff-object ]] + [[ -e /usr/bin/../libexec/kpatch/create-diff-object ]] ++ readlink -f /usr/bin/../libexec/kpatch + TOOLSDIR=/usr/libexec/kpatch ++ readlink -f /usr/bin/../share/kpatch + DATADIR=/usr/share/kpatch + PLUGINDIR=/usr/libexec/kpatch + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + echo 'Using source directory at /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0' + [[ /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux -ef /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0/vmlinux ]] Using source directory at /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/kernel-6.6.0/linux-6.6.0-84.0.0.89.oe2403sp1.aarch64/.config ]] + [[ ! -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/kernel-6.6.0/linux-6.6.0-84.0.0.89.oe2403sp1.aarch64/.config ]] + [[ -z yes ]] + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + [[ -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0/.git ]] + cd /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + cp -f scripts/setlocalversion /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/tmp cp: cannot stat 'scripts/setlocalversion': No such file or directory + die + [[ -z '' ]] + msg='kpatch build failed' + [[ -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/build.log ]] + warn 'kpatch build failed.' + echo 'ERROR: kpatch build failed.' ERROR: kpatch build failed. ``` **【缺陷详情及分析指导参考链接】** 问题源码: `vim /usr/bin/kpatch-build +1130` ``` 1128 if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then 1129 cd "$KERNEL_SRCDIR" || die 1130 cp -f scripts/setlocalversion "$TEMPDIR" || die 1131 LOCALVERSION="$(make kernelversion)" 1132 LOCALVERSION="$(KERNELVERSION="$LOCALVERSION" ./scripts/setlocalversion)" 1133 [[ -n "$LOCALVERSION" ]] || die "setlocalversion failed" 1134 echo "echo $LOCALVERSION" > scripts/setlocalversion 1135 fi ``` kmod源码目录: ``` root@vm-oe2403sp1:[testmod-1.0]$ ll -a total 20 drwxr-xr-x. 3 root root 4096 May 16 14:23 . drwxr-xr-x. 3 root root 4096 Apr 1 10:52 .. drwxr-xr-x. 8 root root 4096 Apr 1 10:52 .git -rw-r--r--. 1 root root 1365 Apr 1 10:52 main.c -rw-r--r--. 1 root root 261 Apr 1 10:52 Makefile ``` **复现时请务必在kmod源码目录下创建.git目录!!!** **复现时请务必在kmod源码目录下创建.git目录!!!** **复现时请务必在kmod源码目录下创建.git目录!!!** main.c: ``` #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/kobject.h> #include <linux/sysfs.h> static struct kobject *testmod_kobj; static ssize_t testmod_show_version(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "1.0\n"); } static ssize_t testmod_show_release(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "1\n"); } static struct kobj_attribute testmod_version = __ATTR(version, 0444, testmod_show_version, NULL); static struct kobj_attribute testmod_release = __ATTR(release, 0444, testmod_show_release, NULL); static int __init testmod_init(void) { int retval; testmod_kobj = kobject_create_and_add("testmod", kernel_kobj); if (!testmod_kobj) { return -ENOMEM; } retval = sysfs_create_file(testmod_kobj, &testmod_version.attr); if (retval) { kobject_put(testmod_kobj); } retval = sysfs_create_file(testmod_kobj, &testmod_release.attr); if (retval) { kobject_put(testmod_kobj); } return retval; } static void __exit testmod_exit(void) { kobject_put(testmod_kobj); } module_init(testmod_init); module_exit(testmod_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("renoseven"); MODULE_DESCRIPTION("Create /sys/kernel/testmod/version file"); ``` Makefile: ``` KERNEL_VERSION ?= $(shell uname -r) KERNEL_SOURCE_DIR ?= /lib/modules/$(KERNEL_VERSION)/build EXTRA_CFLAGS += -g obj-m := testmod.o testmod-y := main.o all: make -C $(KERNEL_SOURCE_DIR) M=$(PWD) modules clean: make -C $(KERNEL_SOURCE_DIR) M=$(PWD) clean ``` Patch: ``` From 4b22d3c626cd9f07fdfeae7ab6e97755a8b63eb8 Mon Sep 17 00:00:00 2001 From: renoseven <dev@renoseven.net> Date: Thu, 6 Mar 2025 04:41:03 +0800 Subject: [PATCH] testmod: modify version & release Signed-off-by: renoseven <dev@renoseven.net> --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index fe7c54c..16fa1fd 100644 --- a/main.c +++ b/main.c @@ -8,11 +8,11 @@ static struct kobject *testmod_kobj; static ssize_t testmod_show_version(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "1.0\n"); + return sprintf(buf, "syscare kmod patch test\n"); } static ssize_t testmod_show_release(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "1\n"); + return sprintf(buf, "syscare kmod patch test\n"); } static struct kobj_attribute testmod_version = __ATTR(version, 0444, testmod_show_version, NULL); -- 2.33.0 ```
**【缺陷描述】:请补充详细的缺陷问题现象描述** **一、缺陷信息** **【缺陷所属的os版本】(如openEuler-22.03-LTS,参考命令"cat /etc/os-release"结果)** openEuler-24.03-LTS-SP1 **【内核版本】(如kernel-5.10.0-60.138.0.165,参考命令"uname -r"结果)** 6.6.0-84.0.0.89.oe2403sp1.aarch64 **【缺陷所属软件及版本号】(如kernel-5.10.0-60.138.0.165,参考命令"rpm -q 包名"结果)** kpatch-0.9.9-12.oe2403sp1.aarch64 **【环境信息】** 硬件信息 N/A 软件信息 N/A 网络信息 N/A **【问题复现步骤】:请描述具体的操作步骤** 1. 制作内核模块热补丁 2. 内核模块源码目录存在.git文件夹 **【实际结果】**,请描述出问题的结果和影响 当内核模块源码目录存在.git文件夹时,制作内核模块热补丁失败 **【期望结果】**,请描述出期望的结果和影响 成功 **【其他相关附件信息】** ``` CACHEDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build \ DISABLE_AFTER_LOAD=yes \ KEEP_JUMP_LABEL=yes \ NO_PROFILING_CALLS=yes \ OOT_MODULE=yes \ USERMODBUILDDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 \ kpatch-build \ --name testmod-846d130d \ --sourcedir /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 \ --config /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/kernel-6.6.0/linux-6.6.0-84.0.0.89.oe2403sp1.aarch64/.config \ --vmlinux /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux \ --jobs 128 \ --output /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/output \ --non-replace \ --oot-module /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0/testmod.ko \ --oot-module-src /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 \ /share/test/openEuler-24.03-LTS/kmod-patch/0001-testmod-modify-version-release.patch \ --skip-compiler-check \ --debug \ --skip-cleanup WARNING: Skipping compiler version matching check (not recommended) + [[ -n '' ]] + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + OOT_MODULE=yes + OOT_MODULE_SRCDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ -n yes ]] + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + mkdir -p /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/tmp + rm -rf '/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/tmp/*' + rm -f /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/build.log + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + KERNEL_SRCDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux ]] + [[ ! -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux ]] ++ strings /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux ++ grep -m 1 -e '^Linux version' ++ awk '{ print($3); }' + VMLINUX_VER=6.6.0-84.0.0.89.oe2403sp1.aarch64 + [[ -n '' ]] + [[ -z 6.6.0-84.0.0.89.oe2403sp1.aarch64 ]] + ARCHVERSION=6.6.0-84.0.0.89.oe2403sp1.aarch64 + [[ -n yes ]] + [[ yes != \y\e\s ]] + [[ -z 6.6.0-84.0.0.89.oe2403sp1.aarch64 ]] + [[ -n yes ]] + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + BUILDDIR=/share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ 1 -eq 0 ]] + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + KVER=6.6.0 + [[ 6.6.0-84.0.0.89.oe2403sp1.aarch64 =~ - ]] + [[ '' = photon ]] + KREL=84.0.0.89.oe2403sp1.aarch64 + KREL=84.0.0.89.oe2403sp1 + [[ 6.6.0-84.0.0.89.oe2403sp1.aarch64 =~ .el7a. ]] + [[ -z '' ]] + [[ -z yes ]] + [[ '' = fedora ]] + [[ '' = rhel ]] + [[ '' = ol ]] + [[ '' = centos ]] + [[ '' = openEuler ]] + [[ '' = photon ]] + [[ '' = ubuntu ]] + [[ '' = debian ]] + save_env + export -p + grep -wv -e OLDPWD= -e PWD= + find_dirs + [[ -e /usr/bin/create-diff-object ]] + [[ -e /usr/bin/../libexec/kpatch/create-diff-object ]] ++ readlink -f /usr/bin/../libexec/kpatch + TOOLSDIR=/usr/libexec/kpatch ++ readlink -f /usr/bin/../share/kpatch + DATADIR=/usr/share/kpatch + PLUGINDIR=/usr/libexec/kpatch + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + echo 'Using source directory at /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0' + [[ /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/debuginfo/usr/lib/debug/lib/modules/6.6.0-84.0.0.89.oe2403sp1.aarch64/vmlinux -ef /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0/vmlinux ]] Using source directory at /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + [[ -z /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/kernel-6.6.0/linux-6.6.0-84.0.0.89.oe2403sp1.aarch64/.config ]] + [[ ! -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/kernel-6.6.0/linux-6.6.0-84.0.0.89.oe2403sp1.aarch64/.config ]] + [[ -z yes ]] + [[ -n /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 ]] + [[ -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0/.git ]] + cd /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/package/source/root/rpmbuild/BUILD/testmod-1.0 + cp -f scripts/setlocalversion /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/tmp cp: cannot stat 'scripts/setlocalversion': No such file or directory + die + [[ -z '' ]] + msg='kpatch build failed' + [[ -e /share/test/openEuler-24.03-LTS/kmod-patch/syscare-build.3463621/patch/build/build.log ]] + warn 'kpatch build failed.' + echo 'ERROR: kpatch build failed.' ERROR: kpatch build failed. ``` **【缺陷详情及分析指导参考链接】** 问题源码: `vim /usr/bin/kpatch-build +1130` ``` 1128 if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then 1129 cd "$KERNEL_SRCDIR" || die 1130 cp -f scripts/setlocalversion "$TEMPDIR" || die 1131 LOCALVERSION="$(make kernelversion)" 1132 LOCALVERSION="$(KERNELVERSION="$LOCALVERSION" ./scripts/setlocalversion)" 1133 [[ -n "$LOCALVERSION" ]] || die "setlocalversion failed" 1134 echo "echo $LOCALVERSION" > scripts/setlocalversion 1135 fi ``` kmod源码目录: ``` root@vm-oe2403sp1:[testmod-1.0]$ ll -a total 20 drwxr-xr-x. 3 root root 4096 May 16 14:23 . drwxr-xr-x. 3 root root 4096 Apr 1 10:52 .. drwxr-xr-x. 8 root root 4096 Apr 1 10:52 .git -rw-r--r--. 1 root root 1365 Apr 1 10:52 main.c -rw-r--r--. 1 root root 261 Apr 1 10:52 Makefile ``` **复现时请务必在kmod源码目录下创建.git目录!!!** **复现时请务必在kmod源码目录下创建.git目录!!!** **复现时请务必在kmod源码目录下创建.git目录!!!** main.c: ``` #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/kobject.h> #include <linux/sysfs.h> static struct kobject *testmod_kobj; static ssize_t testmod_show_version(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "1.0\n"); } static ssize_t testmod_show_release(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "1\n"); } static struct kobj_attribute testmod_version = __ATTR(version, 0444, testmod_show_version, NULL); static struct kobj_attribute testmod_release = __ATTR(release, 0444, testmod_show_release, NULL); static int __init testmod_init(void) { int retval; testmod_kobj = kobject_create_and_add("testmod", kernel_kobj); if (!testmod_kobj) { return -ENOMEM; } retval = sysfs_create_file(testmod_kobj, &testmod_version.attr); if (retval) { kobject_put(testmod_kobj); } retval = sysfs_create_file(testmod_kobj, &testmod_release.attr); if (retval) { kobject_put(testmod_kobj); } return retval; } static void __exit testmod_exit(void) { kobject_put(testmod_kobj); } module_init(testmod_init); module_exit(testmod_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("renoseven"); MODULE_DESCRIPTION("Create /sys/kernel/testmod/version file"); ``` Makefile: ``` KERNEL_VERSION ?= $(shell uname -r) KERNEL_SOURCE_DIR ?= /lib/modules/$(KERNEL_VERSION)/build EXTRA_CFLAGS += -g obj-m := testmod.o testmod-y := main.o all: make -C $(KERNEL_SOURCE_DIR) M=$(PWD) modules clean: make -C $(KERNEL_SOURCE_DIR) M=$(PWD) clean ``` Patch: ``` From 4b22d3c626cd9f07fdfeae7ab6e97755a8b63eb8 Mon Sep 17 00:00:00 2001 From: renoseven <dev@renoseven.net> Date: Thu, 6 Mar 2025 04:41:03 +0800 Subject: [PATCH] testmod: modify version & release Signed-off-by: renoseven <dev@renoseven.net> --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index fe7c54c..16fa1fd 100644 --- a/main.c +++ b/main.c @@ -8,11 +8,11 @@ static struct kobject *testmod_kobj; static ssize_t testmod_show_version(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "1.0\n"); + return sprintf(buf, "syscare kmod patch test\n"); } static ssize_t testmod_show_release(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sprintf(buf, "1\n"); + return sprintf(buf, "syscare kmod patch test\n"); } static struct kobj_attribute testmod_version = __ATTR(version, 0444, testmod_show_version, NULL); -- 2.33.0 ```
Comments (
11
)
Sign in
to comment
Status
Done
Backlog
已挂起
Fixing
Confirmed
Done
Accepted
Canceled
Assignees
Not set
jinsaihang
boluo56
Assignee
Collaborator
+Assign
+Mention
Labels
sig/Base-service
Not set
Projects
Unprojected
Unprojected
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(3)
1
https://gitee.com/src-openeuler/kpatch.git
git@gitee.com:src-openeuler/kpatch.git
src-openeuler
kpatch
kpatch
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register