登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
登录
注册
医疗 AI 怎么落地?本周四晚 19:30,「智医灵枢」开发者直播开讲,来听听一线医院的实战分享!
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
12
Star
8
Fork
56
src-openEuler
/
kpatch
代码
Issues
5
Pull Requests
3
Wiki
统计
流水线
服务
JavaDoc
PHPDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
内核模块源码目录存在.git文件夹时,制作内核模块热补丁失败
已完成
#IC8A25
缺陷
肥牛卷卷卷
创建于
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 ```
评论 (
11
)
登录
后才可以发表评论
状态
已完成
待办的
已挂起
修复中
已确认
已完成
已验收
已取消
负责人
未设置
jinsaihang
boluo56
负责人
协作者
+负责人
+协作者
标签
sig/Base-service
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (28)
标签 (33)
master
openEuler-25.09
openEuler-24.03-LTS
openEuler-24.03-LTS-Next
openEuler-24.03-LTS-SP1
openEuler-24.03-LTS-SP2
openEuler-22.03-LTS-SP3
openEuler-22.03-LTS-SP4
openEuler-20.03-LTS-SP4
openEuler-25.03
openEuler-22.03-LTS
openEuler-24.09
openEuler-22.03-LTS-SP1
openEuler-22.03-LTS-Next
openEuler-22.03-LTS-SP2
openEuler-23.09
openEuler-23.03
openEuler-20.03-LTS-SP3
openEuler-22.09
openEuler-20.03-LTS-Next
openEuler-21.09
openEuler-20.03-LTS-SP2
openEuler-20.03-LTS
openEuler-21.03
openEuler-20.09
openEuler-20.03-LTS-SP1
openEuler1.0
openEuler1.0-base
openEuler-20.03-LTS-SP4-update-20250815
openEuler-24.03-LTS-SP2-release
openEuler-24.03-LTS-SP1-update-20250613
openEuler-24.03-LTS-update-20250425
openEuler-24.03-LTS-SP1-update-20250425
openEuler-24.03-LTS-SP1-update-20250428
openEuler-25.03-release
openEuler-24.03-LTS-update-20250117
openEuler-24.03-LTS-SP1-update-20250117
openEuler-24.03-LTS-SP1-release
openEuler-22.03-LTS-SP3-update-20241115
openEuler-22.03-LTS-SP4-update-20241115
openEuler-22.03-LTS-SP4-update-before-20241025
openEuler-22.03-LTS-SP4-release
openEuler-24.09-release
openEuler-24.03-LTS-release
openEuler-22.03-LTS-SP3-release
openEuler-23.09-rc5
openEuler-22.03-LTS-SP1-release
openEuler-22.09-release
openEuler-22.09-rc5
openEuler-22.09-20220829
openEuler-22.03-LTS-20220331
openEuler-22.03-LTS-round5
openEuler-22.03-LTS-round3
openEuler-22.03-LTS-round2
openEuler-22.03-LTS-round1
openEuler-20.03-LTS-SP3-release
openEuler-20.03-LTS-SP2-20210624
openEuler-21.03-20210330
openEuler-20.09-20200928
openEuler-20.03-LTS-20200606
openEuler-20.03-LTS-tag
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(1)
1
https://gitee.com/src-openeuler/kpatch.git
git@gitee.com:src-openeuler/kpatch.git
src-openeuler
kpatch
kpatch
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册