update to 1.2.1-7
Signed-off-by: ningyu <405888464@qq.com>
This commit is contained in:
parent
114fadad46
commit
4ee0e0f02e
165
0021-upatch-diff-only-check-changed-file-symbols.patch
Normal file
165
0021-upatch-diff-only-check-changed-file-symbols.patch
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
From 2d711186e1c134b069102e72d6d451942c931eb5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: renoseven <dev@renoseven.net>
|
||||||
|
Date: Mon, 13 May 2024 21:27:13 +0800
|
||||||
|
Subject: [PATCH 21/22] upatch-diff: only check changed file symbols
|
||||||
|
|
||||||
|
1. sync compare results (SAME/NEW/CHANGED) to correlated objects
|
||||||
|
2. mark file changes by looking up symbol changes
|
||||||
|
3. check orignal object & debuginfo when file changes were detected
|
||||||
|
4. defer symbol check until after calculation changes
|
||||||
|
|
||||||
|
Signed-off-by: renoseven <dev@renoseven.net>
|
||||||
|
---
|
||||||
|
upatch-diff/create-diff-object.c | 26 +++++++++++++--
|
||||||
|
upatch-diff/elf-compare.c | 57 ++++++++++++++++++--------------
|
||||||
|
upatch-diff/running-elf.c | 2 +-
|
||||||
|
3 files changed, 56 insertions(+), 29 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/upatch-diff/create-diff-object.c b/upatch-diff/create-diff-object.c
|
||||||
|
index 01c58b8..1a05869 100644
|
||||||
|
--- a/upatch-diff/create-diff-object.c
|
||||||
|
+++ b/upatch-diff/create-diff-object.c
|
||||||
|
@@ -481,12 +481,32 @@ static void find_debug_symbol(struct upatch_elf *uelf, struct running_elf *relf)
|
||||||
|
struct symbol *file_sym = NULL;
|
||||||
|
|
||||||
|
list_for_each_entry(file_sym, &uelf->symbols, list) {
|
||||||
|
- if (file_sym->type == STT_FILE) {
|
||||||
|
+ if ((file_sym->type == STT_FILE) && (file_sym->status == CHANGED)) {
|
||||||
|
+ log_debug("file '%s' is CHANGED\n", file_sym->name);
|
||||||
|
find_local_syms(uelf, relf, file_sym);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void mark_file_symbols(struct upatch_elf *uelf)
|
||||||
|
+{
|
||||||
|
+ struct symbol *curr_sym = NULL;
|
||||||
|
+ struct symbol *file_sym = NULL;
|
||||||
|
+
|
||||||
|
+ list_for_each_entry(curr_sym, &uelf->symbols, list) {
|
||||||
|
+ if (curr_sym->type == STT_FILE) {
|
||||||
|
+ file_sym = curr_sym;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if ((file_sym == NULL) || (file_sym->status == CHANGED)) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if (curr_sym->status == CHANGED) {
|
||||||
|
+ file_sym->status = CHANGED;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void mark_grouped_sections(struct upatch_elf *uelf)
|
||||||
|
{
|
||||||
|
struct section *groupsec, *sec;
|
||||||
|
@@ -937,8 +957,6 @@ int main(int argc, char*argv[])
|
||||||
|
detect_child_functions(&uelf_source);
|
||||||
|
detect_child_functions(&uelf_patched);
|
||||||
|
|
||||||
|
- find_debug_symbol(&uelf_source, &relf);
|
||||||
|
-
|
||||||
|
mark_grouped_sections(&uelf_patched);
|
||||||
|
|
||||||
|
replace_section_syms(&uelf_source);
|
||||||
|
@@ -952,6 +970,8 @@ int main(int argc, char*argv[])
|
||||||
|
mark_ignored_sections(&uelf_patched);
|
||||||
|
|
||||||
|
upatch_compare_correlated_elements(&uelf_patched);
|
||||||
|
+ mark_file_symbols(&uelf_source);
|
||||||
|
+ find_debug_symbol(&uelf_source, &relf);
|
||||||
|
|
||||||
|
mark_ignored_functions_same(&uelf_patched);
|
||||||
|
mark_ignored_sections_same(&uelf_patched);
|
||||||
|
diff --git a/upatch-diff/elf-compare.c b/upatch-diff/elf-compare.c
|
||||||
|
index 9b857b1..ef8dd23 100644
|
||||||
|
--- a/upatch-diff/elf-compare.c
|
||||||
|
+++ b/upatch-diff/elf-compare.c
|
||||||
|
@@ -336,38 +336,45 @@ static bool line_macro_change_only(struct upatch_elf *uelf, struct section *sec)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void update_section_status(struct section *sec, enum status status)
|
||||||
|
+{
|
||||||
|
+ if (sec == NULL) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ if (sec->twin != NULL) {
|
||||||
|
+ sec->twin->status = status;
|
||||||
|
+ }
|
||||||
|
+ if (is_rela_section(sec)) {
|
||||||
|
+ if ((sec->base != NULL) &&
|
||||||
|
+ (sec->base->sym != NULL)) {
|
||||||
|
+ sec->base->sym->status = status;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ if (sec->sym != NULL) {
|
||||||
|
+ sec->sym->status = status;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void upatch_compare_sections(struct upatch_elf *uelf)
|
||||||
|
{
|
||||||
|
- struct section *sec;
|
||||||
|
- struct list_head *seclist = &uelf->sections;
|
||||||
|
+ struct section *sec = NULL;
|
||||||
|
|
||||||
|
- /* compare all sections */
|
||||||
|
- list_for_each_entry(sec, seclist, list) {
|
||||||
|
- if (sec->twin)
|
||||||
|
- compare_correlated_section(sec, sec->twin);
|
||||||
|
- else
|
||||||
|
+ list_for_each_entry(sec, &uelf->sections, list) {
|
||||||
|
+ if (sec->twin == NULL) {
|
||||||
|
sec->status = NEW;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* exclude WARN-only, might_sleep changes */
|
||||||
|
- list_for_each_entry(sec, seclist, list) {
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ compare_correlated_section(sec, sec->twin);
|
||||||
|
+ }
|
||||||
|
+ /* exclude WARN-only, might_sleep changes */
|
||||||
|
if (line_macro_change_only(uelf, sec)) {
|
||||||
|
log_debug("reverting macro / line number section %s status to SAME\n", sec->name);
|
||||||
|
sec->status = SAME;
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* sync symbol status */
|
||||||
|
- list_for_each_entry(sec, seclist, list) {
|
||||||
|
- if (is_rela_section(sec)) {
|
||||||
|
- /* sync bundleable symbol for relocation section */
|
||||||
|
- if (sec->base->sym && sec->base->sym->status != CHANGED)
|
||||||
|
- sec->base->sym->status = sec->status;
|
||||||
|
- } else {
|
||||||
|
- struct symbol *sym = sec->sym;
|
||||||
|
- if (sym && sym->status != CHANGED)
|
||||||
|
- sym->status = sec->status;
|
||||||
|
- /* TODO: handle child func */
|
||||||
|
- }
|
||||||
|
+ /* sync status */
|
||||||
|
+ update_section_status(sec, sec->status);
|
||||||
|
+ update_section_status(sec->twin, sec->status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/upatch-diff/running-elf.c b/upatch-diff/running-elf.c
|
||||||
|
index 3bb35e7..676880f 100644
|
||||||
|
--- a/upatch-diff/running-elf.c
|
||||||
|
+++ b/upatch-diff/running-elf.c
|
||||||
|
@@ -139,7 +139,7 @@ bool lookup_relf(struct running_elf *relf,
|
||||||
|
result->sympos = sympos;
|
||||||
|
result->global =
|
||||||
|
((symbol->bind == STB_GLOBAL) || (symbol->bind == STB_WEAK));
|
||||||
|
- log_normal("found symbol '%s'\n", lookup_sym->name);
|
||||||
|
+ log_debug("found symbol '%s'\n", lookup_sym->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (result->symbol != NULL);
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
From 06ef9f212e17cdaa93dc5255d2c881c0b52d603f Mon Sep 17 00:00:00 2001
|
||||||
|
From: renoseven <dev@renoseven.net>
|
||||||
|
Date: Tue, 14 May 2024 14:10:05 +0800
|
||||||
|
Subject: [PATCH 22/22] upatch-diff: remove rela check while build rebuilding
|
||||||
|
.eh_frame
|
||||||
|
|
||||||
|
Signed-off-by: renoseven <dev@renoseven.net>
|
||||||
|
---
|
||||||
|
upatch-diff/elf-debug.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/upatch-diff/elf-debug.c b/upatch-diff/elf-debug.c
|
||||||
|
index 6b5fc53..f9c5327 100644
|
||||||
|
--- a/upatch-diff/elf-debug.c
|
||||||
|
+++ b/upatch-diff/elf-debug.c
|
||||||
|
@@ -181,8 +181,6 @@ void upatch_rebuild_eh_frame(struct section *sec)
|
||||||
|
if (found_rela)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- if (!found_rela)
|
||||||
|
- ERROR("No FDE found for relocation at 0x%x \n", offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
############################################
|
############################################
|
||||||
Name: syscare
|
Name: syscare
|
||||||
Version: 1.2.1
|
Version: 1.2.1
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: System hot-fix service
|
Summary: System hot-fix service
|
||||||
License: MulanPSL-2.0 and GPL-2.0-only
|
License: MulanPSL-2.0 and GPL-2.0-only
|
||||||
URL: https://gitee.com/openeuler/syscare
|
URL: https://gitee.com/openeuler/syscare
|
||||||
@ -37,6 +37,8 @@ Patch0017: 0017-security-change-directory-permission.patch
|
|||||||
Patch0018: 0018-security-change-daemon-socket-permission.patch
|
Patch0018: 0018-security-change-daemon-socket-permission.patch
|
||||||
Patch0019: 0019-upatch-manage-Fixed-the-core-dump-issue-after-applyi.patch
|
Patch0019: 0019-upatch-manage-Fixed-the-core-dump-issue-after-applyi.patch
|
||||||
Patch0020: 0020-upatch-diff-fix-lookup_relf-failed-issue.patch
|
Patch0020: 0020-upatch-diff-fix-lookup_relf-failed-issue.patch
|
||||||
|
Patch0021: 0021-upatch-diff-only-check-changed-file-symbols.patch
|
||||||
|
Patch0022: 0022-upatch-diff-remove-rela-check-while-build-rebuilding.patch
|
||||||
|
|
||||||
BuildRequires: cmake >= 3.14 make
|
BuildRequires: cmake >= 3.14 make
|
||||||
BuildRequires: rust >= 1.51 cargo >= 1.51
|
BuildRequires: rust >= 1.51 cargo >= 1.51
|
||||||
@ -188,6 +190,9 @@ fi
|
|||||||
################ Change log ################
|
################ Change log ################
|
||||||
############################################
|
############################################
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 14 2024 ningyu<ningyu9@huawei.com> - 1.2.1-7
|
||||||
|
- upatch diff only check changed file symbols
|
||||||
|
- upatch diff remove rela check while build rebuilding
|
||||||
* Sat May 11 2024 renoseven<dev@renoseven.net> - 1.2.1-6
|
* Sat May 11 2024 renoseven<dev@renoseven.net> - 1.2.1-6
|
||||||
- upatch-diff: fix 'lookup_elf failed' issue
|
- upatch-diff: fix 'lookup_elf failed' issue
|
||||||
- upatch-manage: fixed the core dump issue after applying hot patches to nginx on x86_64 architecture
|
- upatch-manage: fixed the core dump issue after applying hot patches to nginx on x86_64 architecture
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user