[PATCH] D19148: Always inlining PrintCurrentStackSlow of tsan library to fix tail-call issue

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 01:56:39 PDT 2016


cycheng added a comment.

In http://reviews.llvm.org/D19148#406208, @dvyukov wrote:

> It's all messy. The real problem is that __sanitizer_print_stack_trace obtains current PC and expects the PC to be in the stack trace after function calls. We don't prevent tail calls in sanitizer runtimes, so this assumption does not necessary hold. For example, even if we add the ALWAYS_INLINE but introduce another function between __sanitizer_print_stack_trace and PrintCurrentStackSlow (__sanitizer_print_stack_trace calls Foo and Foo calls PrintCurrentStackSlow), then the test will become flaky again (__sanitizer_print_stack_trace tail calls Foo and the PC disappears from the stack trace).
>  Another problem is that asan/msan does not turn off tail calls during compilation, so __sanitizer_print_stack_trace can be tail called, and then we get broken stack trace again.
>
> Having said that, I don't see any simple, reliable solution. And anything complex probably does not worth it. So let's submit this fix.
>
> Thanks for fixing this, btw.


Agree :D
Thanks for the comments, may I borrow it as my commit message?
By the way, whether I should submit the test case or not?


http://reviews.llvm.org/D19148





More information about the llvm-commits mailing list