[ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber
authorDmitry Vyukov <dvyukov@google.com>
Wed, 28 Sep 2016 12:28:16 +0000 (12:28 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 28 Sep 2016 12:28:16 +0000 (12:28 +0000)
commitb3587836bca51ea61af5a0c685c55d4b7a51450d
tree335dc10efc06d02156d9e49501bb844de9cc5068
parentb107a22afbd2a5a07259c56b7ce84450fe7c8783
[ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber

This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size.

This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it.

Author: Andrii Grynenko (andriigrynenko)
Reviewed in: https://reviews.llvm.org/D24628

llvm-svn: 282582
compiler-rt/include/sanitizer/common_interface_defs.h
compiler-rt/lib/asan/asan_thread.cc
compiler-rt/lib/asan/asan_thread.h
compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc