X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e57d5f78c86b64290e11777801e4f21550754f9a..b0ccb7f468e82d573e86b3876c8f3badccdb5592:/src/kernel/context/ContextSwapped.cpp diff --git a/src/kernel/context/ContextSwapped.cpp b/src/kernel/context/ContextSwapped.cpp index e6e6a7bf00..afbaa915c0 100644 --- a/src/kernel/context/ContextSwapped.cpp +++ b/src/kernel/context/ContextSwapped.cpp @@ -30,6 +30,9 @@ #if HAVE_SANITIZER_ADDRESS_FIBER_SUPPORT #include #endif +#if HAVE_SANITIZER_THREAD_FIBER_SUPPORT +#include +#endif XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); @@ -122,6 +125,14 @@ SwappedContext::SwappedContext(std::function&& code, smx_actor_t actor, #endif #if HAVE_SANITIZER_ADDRESS_FIBER_SUPPORT this->asan_stack_ = get_stack_bottom(); +#endif +#if HAVE_SANITIZER_THREAD_FIBER_SUPPORT + this->tsan_fiber_ = __tsan_create_fiber(0); +#endif + } else { + // not has_code(): in maestro context +#if HAVE_SANITIZER_THREAD_FIBER_SUPPORT + this->tsan_fiber_ = __tsan_get_current_fiber(); #endif } } @@ -131,6 +142,9 @@ SwappedContext::~SwappedContext() if (stack_ == nullptr) // maestro has no extra stack return; +#if HAVE_SANITIZER_THREAD_FIBER_SUPPORT + __tsan_destroy_fiber(tsan_fiber_); +#endif #if HAVE_VALGRIND_H if (RUNNING_ON_VALGRIND) VALGRIND_STACK_DEREGISTER(valgrind_stack_id_); @@ -167,6 +181,9 @@ void SwappedContext::swap_into(SwappedContext* to) to->asan_ctx_ = this; __sanitizer_start_switch_fiber(this->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_); #endif +#if HAVE_SANITIZER_THREAD_FIBER_SUPPORT + __tsan_switch_to_fiber(to->tsan_fiber_, 0); +#endif swap_into_for_real(to);