libunwind/backport-avoid-calling-printf-because-OE-glibc-2.34-used-mno-.patch

47 lines
1.3 KiB
Diff

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