!70 修复kpatch-build不支持ftrace功能

From: @tangbinzy 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-09-05 12:15:53 +00:00 committed by Gitee
commit a11537b3e8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From ec538d436364293b15e41f3c2c2a8ab389c7b043 Mon Sep 17 00:00:00 2001
From: tangbin <tangbin@cmss.chinamobile.com>
Date: Mon, 5 Sep 2022 12:09:06 -0400
Subject: [PATCH] livepatch-patch-hook: fix kpatch-build error which do not
support ftrace
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When using the kernel 5.10.0-60.18.0.50.oe2203 in x86_64, and chose the
livepatch with ftrace, it will show not support for this feature, which
is not allowed, the error displays as follows:
In file included from /root/.kpatch/tmp/patch/patch-hook.c:21:
/root/.kpatch/tmp/patch/livepatch-patch-hook.c: In function patch_init:
/root/.kpatch/tmp/patch/livepatch-patch-hook.c:606:8: error: implicit declaration of function klp_register_patch; did you mean klp_enable_patch? [-Werror=implicit-function-declaration]
606 | ret = klp_register_patch(lpatch);
| ^~~~~~~~~~~~~~~~~~
| klp_enable_patch
So fix this problem.
Signed-off-by: tangbin <tangbin@cmss.chinamobile.com>
---
kmod/patch/livepatch-patch-hook.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kmod/patch/livepatch-patch-hook.c b/kmod/patch/livepatch-patch-hook.c
index b565a6a..5d8780c 100644
--- a/kmod/patch/livepatch-patch-hook.c
+++ b/kmod/patch/livepatch-patch-hook.c
@@ -70,6 +70,8 @@
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 2)
# define HAVE_SIMPLE_ENABLE
# endif
+# elif (defined(CONFIG_LIVEPATCH_FTRACE))
+# define HAVE_SIMPLE_ENABLE
#endif
#ifdef RHEL_RELEASE_CODE
--
2.18.4

View File

@ -1,7 +1,7 @@
Name: kpatch Name: kpatch
Epoch: 1 Epoch: 1
Version: 0.9.5 Version: 0.9.5
Release: 10 Release: 11
Summary: A Linux dynamic kernel patching infrastructure Summary: A Linux dynamic kernel patching infrastructure
License: GPLv2 License: GPLv2
@ -53,6 +53,7 @@ Patch0037:0037-create-diff-object-skip-creating-.kpatch.arch-sectio.patch
Patch0038:0038-kpatch-build-do-not-copy-linux-scripts-when.patch Patch0038:0038-kpatch-build-do-not-copy-linux-scripts-when.patch
Patch0039:0039-create-diff-object-ignore-change-of-certain.patch Patch0039:0039-create-diff-object-ignore-change-of-certain.patch
Patch0040:0040-create-diff-object-allow-__jump_table-section.patch Patch0040:0040-create-diff-object-allow-__jump_table-section.patch
Patch0041:0041-livepatch-patch-hook-fix-kpatch-build-error-which-do.patch
BuildRequires: gcc elfutils-libelf-devel kernel-devel git BuildRequires: gcc elfutils-libelf-devel kernel-devel git
Requires: bc make gcc patch bison flex openssl-devel Requires: bc make gcc patch bison flex openssl-devel
@ -113,6 +114,12 @@ popd
%{_mandir}/man1/*.1.gz %{_mandir}/man1/*.1.gz
%changelog %changelog
* Mon Sep 5 2022 Tang Bin <tangbin_yewu@cmss.chinamobile.com> -1:0.9.5-11
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:livepatch-patch-hook: fix kpatch-build error which do not support ftrace
* Mon May 30 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-10 * Mon May 30 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-10
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA