!90 backport upstream patches
From: @xiezhipeng1 Reviewed-by: @lvying6 Signed-off-by: @lvying6
This commit is contained in:
commit
b1ac1bd765
51
0041-kpatch-cc-Add-more-file-ignores.patch
Normal file
51
0041-kpatch-cc-Add-more-file-ignores.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
From 846ea81bd9fd673ccbcb64c9e2732422fbd02798 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Josh Poimboeuf <jpoimboe@redhat.com>
|
||||||
|
Date: Wed, 17 Aug 2022 12:10:39 -0700
|
||||||
|
Subject: [PATCH 1/3] kpatch-cc: Add more file ignores
|
||||||
|
|
||||||
|
These files aren't in the kernel proper, and can be ignored.
|
||||||
|
|
||||||
|
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
|
||||||
|
---
|
||||||
|
kpatch-build/kpatch-cc | 18 +++++++++---------
|
||||||
|
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc
|
||||||
|
index 5e241dd..b9c511a 100755
|
||||||
|
--- a/kpatch-build/kpatch-cc
|
||||||
|
+++ b/kpatch-build/kpatch-cc
|
||||||
|
@@ -35,22 +35,22 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ ||
|
||||||
|
vmlinux.o|\
|
||||||
|
.tmp_kallsyms1.o|\
|
||||||
|
.tmp_kallsyms2.o|\
|
||||||
|
- init/version.o|\
|
||||||
|
- arch/x86/boot/version.o|\
|
||||||
|
- arch/x86/boot/compressed/eboot.o|\
|
||||||
|
- arch/x86/boot/header.o|\
|
||||||
|
- arch/x86/boot/compressed/efi_stub_64.o|\
|
||||||
|
- arch/x86/boot/compressed/piggy.o|\
|
||||||
|
- kernel/system_certificates.o|\
|
||||||
|
- arch/x86/vdso/*|\
|
||||||
|
+ arch/x86/boot/*|\
|
||||||
|
arch/x86/entry/vdso/*|\
|
||||||
|
- drivers/firmware/efi/libstub/*|\
|
||||||
|
+ arch/x86/purgatory/*|\
|
||||||
|
+ arch/x86/realmode/*|\
|
||||||
|
+ arch/x86/tools/*|\
|
||||||
|
+ arch/x86/vdso/*|\
|
||||||
|
arch/powerpc/kernel/prom_init.o|\
|
||||||
|
arch/powerpc/kernel/vdso64/*|\
|
||||||
|
arch/s390/boot/*|\
|
||||||
|
arch/s390/purgatory/*|\
|
||||||
|
arch/s390/kernel/vdso64/*|\
|
||||||
|
+ drivers/firmware/efi/libstub/*|\
|
||||||
|
+ init/version.o|\
|
||||||
|
+ kernel/system_certificates.o|\
|
||||||
|
lib/*|\
|
||||||
|
+ tools/*|\
|
||||||
|
.*.o|\
|
||||||
|
*/.lib_exports.o)
|
||||||
|
break
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
From 000f03dbeefddbf6c9f9336d4e043809eae6a7a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Josh Poimboeuf <jpoimboe@redhat.com>
|
||||||
|
Date: Mon, 21 Nov 2022 19:32:18 -0800
|
||||||
|
Subject: [PATCH 2/3] create-diff-object: fix __UNIQUE_ID() variable
|
||||||
|
correlation
|
||||||
|
|
||||||
|
kpatch_mangled_strcmp() only ignores the digits after the period, but in
|
||||||
|
the case of __UNIQUE_ID(), the symbol names have random digits before
|
||||||
|
the period due to the use of `__COUNTER__`. Make sure such symbols are
|
||||||
|
properly correlated.
|
||||||
|
|
||||||
|
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
|
||||||
|
---
|
||||||
|
kpatch-build/create-diff-object.c | 32 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 32 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
|
||||||
|
index 5d34717..8a671bd 100644
|
||||||
|
--- a/kpatch-build/create-diff-object.c
|
||||||
|
+++ b/kpatch-build/create-diff-object.c
|
||||||
|
@@ -399,6 +399,35 @@ static bool has_digit_tail(char *tail)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Hack for __UNIQUE_ID(). The following should match:
|
||||||
|
+ *
|
||||||
|
+ * __UNIQUE_ID_ddebug1131.186
|
||||||
|
+ * __UNIQUE_ID_ddebug1132.187
|
||||||
|
+ */
|
||||||
|
+static int __kpatch_unique_id_strcmp(char *s1, char *s2)
|
||||||
|
+{
|
||||||
|
+ /* match '__UNIQUE_ID_ddebug' */
|
||||||
|
+ while (*s1 == *s2) {
|
||||||
|
+ if (!*s1)
|
||||||
|
+ return 0;
|
||||||
|
+ s1++;
|
||||||
|
+ s2++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* skip digits before '.' or EOL */
|
||||||
|
+ while (isdigit(*s1))
|
||||||
|
+ s1++;
|
||||||
|
+ while (isdigit(*s2))
|
||||||
|
+ s2++;
|
||||||
|
+
|
||||||
|
+ if ((!*s1 || has_digit_tail(s1)) &&
|
||||||
|
+ (!*s2 || has_digit_tail(s2)))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* This is like strcmp, but for gcc-mangled symbols. It skips the comparison
|
||||||
|
* of any substring which consists of '.' followed by any number of digits.
|
||||||
|
@@ -412,6 +441,9 @@ static int kpatch_mangled_strcmp(char *s1, char *s2)
|
||||||
|
if (strstr(s1, ".str1."))
|
||||||
|
return strcmp(s1, s2);
|
||||||
|
|
||||||
|
+ if (!strncmp(s1, "__UNIQUE_ID_", 12))
|
||||||
|
+ return __kpatch_unique_id_strcmp(s1, s2);
|
||||||
|
+
|
||||||
|
while (*s1 == *s2) {
|
||||||
|
if (!*s1)
|
||||||
|
return 0;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
From b232188e0c220f779ce54955876b56a4161c258a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Joe Lawrence <joe.lawrence@redhat.com>
|
||||||
|
Date: Fri, 10 Feb 2023 13:38:05 -0500
|
||||||
|
Subject: [PATCH 3/3] create-diff-object: ignore __patchable_function_entries
|
||||||
|
|
||||||
|
Kernel v6.2+ commit bea75b33895f ("x86/Kconfig: Introduce function
|
||||||
|
padding") introduces the -fpatchable-function-entry=16,16 build flag on
|
||||||
|
x86. This leverages compiler support for generating a
|
||||||
|
__patchable_function_entries section similar to __mcount_loc.
|
||||||
|
|
||||||
|
That said, x86 still utilizes __mcount_loc even when
|
||||||
|
__patchable_function_entries exists. The latter point to the __pfx
|
||||||
|
symbols, but the section is discarded in the vmlinux link and isn't used
|
||||||
|
regardless, for ftrace or for any other purpose.
|
||||||
|
|
||||||
|
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
|
||||||
|
---
|
||||||
|
kpatch-build/create-diff-object.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
|
||||||
|
index 8a671bd..0e91513 100644
|
||||||
|
--- a/kpatch-build/create-diff-object.c
|
||||||
|
+++ b/kpatch-build/create-diff-object.c
|
||||||
|
@@ -2885,6 +2885,12 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf)
|
||||||
|
!strncmp(sec->name, ".llvm_addrsig", 13) ||
|
||||||
|
!strncmp(sec->name, ".llvm.", 6))
|
||||||
|
sec->ignore = 1;
|
||||||
|
+
|
||||||
|
+ if (kelf->arch == X86_64) {
|
||||||
|
+ if (!strcmp(sec->name, ".rela__patchable_function_entries") ||
|
||||||
|
+ !strcmp(sec->name, "__patchable_function_entries"))
|
||||||
|
+ sec->ignore = 1;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
sec = find_section_by_name(&kelf->sections, ".kpatch.ignore.sections");
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
11
kpatch.spec
11
kpatch.spec
@ -1,7 +1,7 @@
|
|||||||
Name: kpatch
|
Name: kpatch
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 0.9.7
|
Version: 0.9.7
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: A Linux dynamic kernel patching infrastructure
|
Summary: A Linux dynamic kernel patching infrastructure
|
||||||
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
@ -53,6 +53,9 @@ Patch0037:0037-create-diff-object-ignore-entsize-change-of-.return_.patch
|
|||||||
Patch0038:0038-kpatch-build-for-clang-use-.strtab-if-no-.shstrtab.patch
|
Patch0038:0038-kpatch-build-for-clang-use-.strtab-if-no-.shstrtab.patch
|
||||||
Patch0039:0039-create-diff-object-ignore-clang-s-.llvm_addrsig-sect.patch
|
Patch0039:0039-create-diff-object-ignore-clang-s-.llvm_addrsig-sect.patch
|
||||||
Patch0040:0040-create-diff-object-ignore-.llvm.-sections.patch
|
Patch0040:0040-create-diff-object-ignore-.llvm.-sections.patch
|
||||||
|
Patch0041:0041-kpatch-cc-Add-more-file-ignores.patch
|
||||||
|
Patch0042:0042-create-diff-object-fix-__UNIQUE_ID-variable-correlat.patch
|
||||||
|
Patch0043:0043-create-diff-object-ignore-__patchable_function_entri.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 +116,12 @@ popd
|
|||||||
%{_mandir}/man1/*.1.gz
|
%{_mandir}/man1/*.1.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Jul 29 2023 Zhipeng Xie <xiezhipeng1@huawei.com> -1:0.9.7-3
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:backport upsteam patches
|
||||||
|
|
||||||
* Mon May 29 2023 Zhipeng Xie <xiezhipeng1@huawei.com> -1:0.9.7-2
|
* Mon May 29 2023 Zhipeng Xie <xiezhipeng1@huawei.com> -1:0.9.7-2
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user