From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 426AD2631D for ; Fri, 8 Jun 2018 13:17:38 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6GFXB6313tZ5 for ; Fri, 8 Jun 2018 13:17:38 -0400 (EDT) Received: from smtp62.i.mail.ru (smtp62.i.mail.ru [217.69.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 002F926315 for ; Fri, 8 Jun 2018 13:17:37 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH] Fix libunwind segfault Date: Fri, 8 Jun 2018 20:17:33 +0300 Message-Id: <5c3b30016bc65a77804f995de0024a66a699ccc1.1528478042.git.georgy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org 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