!103 fix error in making hotpatch when local_match be empty
From: @wangjiang37 Reviewed-by: @hubin95 Signed-off-by: @hubin95
This commit is contained in:
commit
fb36d53e41
@ -0,0 +1,69 @@
|
|||||||
|
From 75927e7bbbc81de662755cee9c2e65b975138e06 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Josh Poimboeuf <jpoimboe@redhat.com>
|
||||||
|
Date: Tue, 16 May 2023 15:46:18 -0700
|
||||||
|
Subject: [PATCH] lookup: skip duplicate local symbol table check for files
|
||||||
|
without locals
|
||||||
|
|
||||||
|
If the file doesn't have local object/func symbols, any empty match will
|
||||||
|
do, and duplicate matching local symbol lists aren't a problem.
|
||||||
|
|
||||||
|
Fixes #1345.
|
||||||
|
|
||||||
|
Reported-by: lzwycc <lzw32321226@163.com>
|
||||||
|
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
|
||||||
|
|
||||||
|
Reference:https://github.com/dynup/kpatch/commit/75927e7bbbc81de662755cee9c2e65b975138e06
|
||||||
|
Conflict: change 'return true' in fun locals_match to 'return sym_num'
|
||||||
|
in count_local_symbol
|
||||||
|
---
|
||||||
|
kpatch-build/lookup.c | 27 +++++++++++++++++++++++++++
|
||||||
|
1 file changed, 27 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c
|
||||||
|
index 875605d..458b447 100644
|
||||||
|
--- a/kpatch-build/lookup.c
|
||||||
|
+++ b/kpatch-build/lookup.c
|
||||||
|
@@ -182,6 +182,25 @@ static int count_local_symbol(struct list_head *sym_list)
|
||||||
|
return sym_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool file_has_locals(struct symbol *file_sym, struct list_head *sym_list)
|
||||||
|
+{
|
||||||
|
+ struct symbol *sym = file_sym;
|
||||||
|
+
|
||||||
|
+ list_for_each_entry_continue(sym, sym_list, list) {
|
||||||
|
+ if (sym->type == STT_FILE)
|
||||||
|
+ break;
|
||||||
|
+ if (sym->type != STB_LOCAL)
|
||||||
|
+ continue;
|
||||||
|
+ if (maybe_discarded_sym(sym->name))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ if (sym->type == STT_FUNC || sym->type == STT_OBJECT)
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void find_local_syms(struct lookup_table *table, struct symbol *file_sym,
|
||||||
|
struct list_head *sym_list)
|
||||||
|
{
|
||||||
|
@@ -204,6 +223,14 @@ static void find_local_syms(struct lookup_table *table, struct symbol *file_sym,
|
||||||
|
file_sym->name, table->objname);
|
||||||
|
|
||||||
|
lookup_table_file_sym = sym;
|
||||||
|
+
|
||||||
|
+ if (!file_has_locals(file_sym, sym_list)) {
|
||||||
|
+ /*
|
||||||
|
+ * If the file doesn't have local symbols, any empty
|
||||||
|
+ * match will do. Skip the duplicate check.
|
||||||
|
+ */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lookup_table_file_sym)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Name: kpatch
|
Name: kpatch
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 0.9.5
|
Version: 0.9.5
|
||||||
Release: 7
|
Release: 8
|
||||||
Summary: A Linux dynamic kernel patching infrastructure
|
Summary: A Linux dynamic kernel patching infrastructure
|
||||||
|
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
@ -59,6 +59,7 @@ 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
|
Patch0045:0045-backport-create-diff-object-add-support-for-.return_sites-sec.patch
|
||||||
Patch0046:0046-create-diff-object-ignore-entsize-change-of-.return_.patch
|
Patch0046:0046-create-diff-object-ignore-entsize-change-of-.return_.patch
|
||||||
|
Patch0047:0047-lookup-skip-duplicate-local-symbol-table-check-for-f.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
|
||||||
@ -119,6 +120,12 @@ popd
|
|||||||
%{_mandir}/man1/*.1.gz
|
%{_mandir}/man1/*.1.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Sep 25 2023 wangjiang <wangjiang37@h-partners.com> - 1:0.9.5-8
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix error in making hotpatch when local_match be empty
|
||||||
|
|
||||||
* Mon Oct 17 2022 Bin Hu<hubin73@huawei.com> -1:0.9.5-7
|
* Mon Oct 17 2022 Bin Hu<hubin73@huawei.com> -1:0.9.5-7
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user