fix failed testcase

This commit is contained in:
wangjiang 2023-06-01 10:05:47 +08:00
parent c95160b80f
commit 8f3102b190
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From 8a0e2fa6579085dc8f51b2bdd90d8b00a2e7d6ab Mon Sep 17 00:00:00 2001
From: he7850 <im.bin.hu@gmail.com>
Date: Wed, 3 May 2023 15:18:27 +0800
Subject: [PATCH] aarch64: unw_step() validates address before calling
dwarf_get
Signed-off-by: he7850 <im.bin.hu@gmail.com>
---
src/aarch64/Gstep.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/aarch64/Gstep.c b/src/aarch64/Gstep.c
index f4ef369d3..a2ed9bc35 100644
--- a/src/aarch64/Gstep.c
+++ b/src/aarch64/Gstep.c
@@ -156,18 +156,28 @@ unw_step (unw_cursor_t *cursor)
dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_X30], &c->dwarf.ip);
}
- /* Restore default memory validation state */
- c->validate = validate;
-
ret = dwarf_step (&c->dwarf);
Debug(1, "dwarf_step()=%d\n", ret);
+ /* Restore default memory validation state */
+ c->validate = validate;
+
if (unlikely (ret == -UNW_ESTOPUNWIND))
return ret;
if (unlikely (ret < 0))
{
/* DWARF failed. */
+
+ /*
+ * We could get here because of missing/bad unwind information.
+ * Validate all addresses before dereferencing.
+ */
+ if (c->dwarf.as == unw_local_addr_space)
+ {
+ c->validate = 1;
+ }
+
if (is_plt_entry (&c->dwarf))
{
Debug (2, "found plt entry\n");

View File

@ -1,7 +1,7 @@
Name: libunwind
Epoch: 2
Version: 1.6.2
Release: 4
Release: 5
Summary: Libunwind provides a C ABI to determine the call-chain of a program
License: BSD
URL: http://savannah.nongnu.org/projects/libunwind
@ -10,6 +10,7 @@ Source: http://download-mirror.savannah.gnu.org/releases/libunwind/libunwind-%{v
Patch0001: 0001-fix-byte_order_is_valid-function-logic.patch
Patch2: backport-check-namespace.sh-adjust-aarch64-symbols.patch
Patch3: backport-tests-run-coredump-unwind-Skip-test-if-no-coredump-h.patch
Patch4: backport-aarch64-unw_step-validates-address-before-calling-dwarf_get.patch
ExclusiveArch: aarch64 %{ix86} x86_64 riscv64
@ -87,6 +88,12 @@ make check || true
%{_mandir}/*/*
%changelog
* Thu Jun 01 2023 wangjiang <wangjiang37@h-partners.com> - 2:1.6.2-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix failed testcase
* Tue Feb 21 2023 shixuantong <shixuantong1@huawei.com> - 2:1.6.2-4
- Type:bugfix
- ID:NA