Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Fix libunwind segfault
@ 2018-06-08 17:17 Georgy Kirichenko
  0 siblings, 0 replies; only message in thread
From: Georgy Kirichenko @ 2018-06-08 17:17 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Georgy Kirichenko

Use volatile asm modifier to prevent unwanted and awkward optimizations
causing segfault while backtracing
---
branch: https://github.com/tarantool/tarantool/tree/gh-3448-unwind-fix
issues: https://github.com/tarantool/tarantool/issues/3448
 src/backtrace.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backtrace.cc b/src/backtrace.cc
index a86255e1f..2512bc045 100644
--- a/src/backtrace.cc
+++ b/src/backtrace.cc
@@ -210,11 +210,11 @@ unw_getcontext_f(unw_context_t *unw_context, void *stack)
  * @param @unw_context unwind context to store execution state.
  * @param @coro_ctx fiber context to unwind.
  */
-void
+static void
 coro_unwcontext(unw_context_t *unw_context, struct coro_context *coro_ctx)
 {
 #if __amd64
-__asm__(
+__asm__ volatile(
 	/* Preserve current context */
 	"\tpushq %%rbp\n"
 	"\tpushq %%rbx\n"
@@ -249,11 +249,11 @@ __asm__(
 	"\tpopq %%rbp\n"
 	:
 	: "r" (unw_context), "r" (coro_ctx), "i" (unw_getcontext_f)
-	: "rdi", "rsi", "rax"
+	: "rdi", "rsi", "rax"//, "r8"//"rsp", "r11", "r10", "r9", "r8"
 	);
 
 #elif __i386
-__asm__(
+__asm__ volatile(
 	/* Save current context */
 	"\tpushl %%ebp\n"
 	"\tpushl %%ebx\n"
@@ -284,7 +284,7 @@ __asm__(
 	);
 
 #elif __ARM_ARCH==7
-__asm__(
+__asm__ volatile(
 	/* Save current context */
 	".syntax unified\n"
 	"\tvpush {d8-d15}\n"
@@ -314,7 +314,7 @@ __asm__(
 	);
 
 #elif __aarch64__
-__asm__(
+__asm__ volatile(
 	/* Save current context */
 	"\tsub x1, sp, #8 * 20\n"
 	"\tstp x19, x20, [x1, #16 * 0]\n"
-- 
2.17.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-08 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 17:17 [tarantool-patches] [PATCH] Fix libunwind segfault Georgy Kirichenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox