!77 create-diff-object: add support for .return_sites section

From: @hubin95 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-10-09 09:42:47 +00:00 committed by Gitee
commit b83e435751
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 87 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From 764baf9f38c15d48a7cacbafcad9b83b7a23d842 Mon Sep 17 00:00:00 2001
From: hubin <hubin73@huawei.com>
Date: Thu, 1 Sep 2022 06:13:03 +0800
Subject: [PATCH] create-diff-object: add support for .return_sites section
Signed-off-by: Jonathan Dobson <jdobson@redhat.com>
Reference:https://github.com/dynup/kpatch/commit/33368a88cdf875b0edd02b0dfd3356a7e93b24db
Conflict:kpatch-build/create-diff-object.c
---
kpatch-build/create-diff-object.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index 58d4763..3c55013 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -2242,6 +2242,11 @@ static int retpoline_sites_group_size(struct kpatch_elf *kelf, int offset)
{
return 4;
}
+
+static int return_sites_group_size(struct kpatch_elf *kelf, int offset)
+{
+ return 4;
+}
#endif
#ifdef __powerpc64__
static int fixup_entry_group_size(struct kpatch_elf *kelf, int offset)
@@ -2362,6 +2367,10 @@ static struct special_section special_sections[] = {
.name = ".retpoline_sites",
.group_size = retpoline_sites_group_size,
},
+ {
+ .name = ".return_sites",
+ .group_size = return_sites_group_size,
+ },
#endif
#ifdef __powerpc64__
{
--
2.33.0

View File

@ -0,0 +1,35 @@
From 594f0810329ca074d53399f6d1927aa87607c34a Mon Sep 17 00:00:00 2001
From: hubin <hubin73@huawei.com>
Date: Sun, 9 Oct 2022 14:33:13 +0800
Subject: [PATCH] create-diff-object: ignore entsize change of .return_sites
section
If a patch contains newly exported function, kernel Makefile.build
script will add one ld step when generating object file, which
causes the entsize of patched object's .return_sites section changed
to 0, and differs from the original entsize 4.
For this change, currently just ignore it.
Signed-off-by: hubin <hubin73@huawei.com>
---
kpatch-build/create-diff-object.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
index d7a6789..77ee7b2 100644
--- a/kpatch-build/create-diff-object.c
+++ b/kpatch-build/create-diff-object.c
@@ -555,7 +555,8 @@ static void kpatch_compare_correlated_section(struct section *sec)
/* Compare section headers (must match or fatal) */
if (sec1->sh.sh_type != sec2->sh.sh_type ||
sec1->sh.sh_flags != sec2->sh.sh_flags ||
- sec1->sh.sh_entsize != sec2->sh.sh_entsize ||
+ (sec1->sh.sh_entsize != sec2->sh.sh_entsize &&
+ strcmp(sec1->name, ".return_sites")) ||
(sec1->sh.sh_addralign != sec2->sh.sh_addralign &&
!is_text_section(sec1) && strcmp(sec1->name, ".rodata")))
DIFF_FATAL("%s section header details differ from %s", sec1->name, sec2->name);
--
2.27.0

View File

@ -1,7 +1,7 @@
Name: kpatch Name: kpatch
Epoch: 1 Epoch: 1
Version: 0.9.5 Version: 0.9.5
Release: 14 Release: 15
Summary: A Linux dynamic kernel patching infrastructure Summary: A Linux dynamic kernel patching infrastructure
License: GPLv2 License: GPLv2
@ -57,6 +57,8 @@ Patch0041:0041-livepatch-patch-hook-fix-kpatch-build-error-which-do.patch
Patch0042:0042-kpatch-build-fix-loading-error-in-aarch64.patch Patch0042:0042-kpatch-build-fix-loading-error-in-aarch64.patch
Patch0043:0043-kpatch-build-Remove-duplicate-functions.patch Patch0043:0043-kpatch-build-Remove-duplicate-functions.patch
Patch0044:0044-lookup-skip-finding-local-symbols-for-object-with-no.patch Patch0044:0044-lookup-skip-finding-local-symbols-for-object-with-no.patch
Patch0045:0045-backport-create-diff-object-add-support-for-.return_sites-sec.patch
Patch0046:0046-create-diff-object-ignore-entsize-change-of-.return_.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
@ -117,6 +119,12 @@ popd
%{_mandir}/man1/*.1.gz %{_mandir}/man1/*.1.gz
%changelog %changelog
* Sun Oct 9 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-15
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:create-diff-object: add support for .return_sites section
* Sun Oct 9 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-14 * Sun Oct 9 2022 Bin Hu <hubin73@huawei.com> -1:0.9.5-14
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA