libcareplus/0003-elf-add-section-adderss-for-STT_NOTYPE-type-of-symbo.patch
yezengruan eda47481b9 update libcareplus to version 1.0.0-12
kpatch_process: fix possible double free.
ptrace: fix NULL pointer access problem
fix patched process crashing when acccess the global var
fix probably restore cc symbol link fail when kill patch building uncourteous
optimize: Remove unnecessary comparison code

Signed-off-by: yezengruan <yezengruan@huawei.com>
(cherry picked from commit f3d59711105eb667fa2f920958fcbdbb7068afd2)
2022-07-21 15:47:45 +08:00

31 lines
952 B
Diff

From 55b659c0b52a7c5f3fc493dd9c19ac76f09d0ccb Mon Sep 17 00:00:00 2001
From: Bihong Yu <yubihong@huawei.com>
Date: Sat, 22 Jan 2022 16:15:50 +0800
Subject: [PATCH] elf: add section adderss for STT_NOTYPE type of symbol
Sometimes, the symbol type of the new global static variable in the
patch may be STT_NOTYPE. We should add the section adderss to st_value
for this type symbol, otherwise, the calculated adderss for this type
symbol will be wrong, which may result in the patched process coredump.
Signed-off-by: Bihong Yu <yubihong@huawei.com>
---
src/kpatch_elf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/kpatch_elf.c b/src/kpatch_elf.c
index 3ac56d9..5acf370 100644
--- a/src/kpatch_elf.c
+++ b/src/kpatch_elf.c
@@ -789,6 +789,7 @@ symbol_resolve(struct object_file *o,
break;
case STT_NOTYPE: // for Systemtap symbol _.stapsdt.base.kpatch
+ s->st_value += shdr[s->st_shndx].sh_addr;
break;
default:
--
2.27.0