backport upstream patch to fix failed run-ptrace-mapper testcase

This commit is contained in:
chenziyang 2023-07-11 10:37:01 +08:00
parent bbc0dbb2cc
commit 2e86d21eb4
3 changed files with 55 additions and 3 deletions

View File

@ -0,0 +1,46 @@
From ffb69e2384538a7d4b634bdc491d7da9b7220f57 Mon Sep 17 00:00:00 2001
From: chenziyang <chenziyang4@huawei.com>
Date: Tue, 11 Jul 2023 10:19:22 +0800
Subject: [PATCH] avoid calling printf because OE glibc-2.34 used
-mno-outline-atomics buildflag, it will cause printf to be non-atomic
operations on ARMv8.1 platform. This will cause printf to stuck into dead
loop because ptrace sing-step execution cause race condition during printf
instructions.
---
tests/mapper.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/mapper.c b/tests/mapper.c
index b47ae78..fcfb080 100644
--- a/tests/mapper.c
+++ b/tests/mapper.c
@@ -43,6 +43,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# define MAP_NORESERVE 0
#endif
+void __attribute__((noinline)) push_some_stacks(int n)
+{
+ if (n >= 1)
+ {
+ push_some_stacks(n - 1);
+ push_some_stacks(n - 1);
+ }
+}
+
int
main (void)
{
@@ -71,7 +80,7 @@ main (void)
printf ("Turning on single-stepping...\n");
kill (getpid (), SIGUSR1); /* tell test-ptrace to start single-stepping */
- printf ("Va bene?\n");
+ push_some_stacks (4);
kill (getpid (), SIGUSR2); /* tell test-ptrace to stop single-stepping */
printf ("Turned single-stepping off...\n");
return 0;
--
2.33.0

View File

@ -1,7 +1,7 @@
Name: libunwind
Epoch: 2
Version: 1.6.2
Release: 6
Release: 7
Summary: Libunwind provides a C ABI to determine the call-chain of a program
License: BSD
URL: http://savannah.nongnu.org/projects/libunwind
@ -11,8 +11,8 @@ 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
Patch9000: Fix-run-ptrace-mapper-test-case-failed-by-allowing-u.patch
Patch5: backport-avoid-calling-printf-because-OE-glibc-2.34-used-mno-.patch
Patch6: backport-fix-run-ptrace-mapper-test-case-failed.patch
ExclusiveArch: aarch64 %{ix86} x86_64 riscv64
@ -90,6 +90,12 @@ make check || true
%{_mandir}/*/*
%changelog
* Tue Jul 11 2023 chenziyang <chenziyang4@huawei.com> - 2:1.6.2-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:backport upstream patch to fix failed run-ptrace-mapper testcase
* Mon Jul 03 2023 chenziyang <chenziyang4@huawei.com> - 2:1.6.2-6
- Type:bugfix
- ID:NA