Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Declare fake_stack only with ASan.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 10 Jun 2018 19:37:29 +0000 (21:37 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 10 Jun 2018 19:37:29 +0000 (21:37 +0200)
src/kernel/context/ContextBoost.cpp
src/kernel/context/ContextRaw.cpp
src/kernel/context/ContextUnix.cpp
src/kernel/context/context_private.hpp

index b75b44c..5673295 100644 (file)
@@ -129,7 +129,7 @@ inline void BoostContext::swap(BoostContext* from, BoostContext* to)
   boost::context::jump_fcontext(&from->fc_, to->fc_, reinterpret_cast<intptr_t>(to));
 #else
   BoostContext* ctx[2] = {from, to};
   boost::context::jump_fcontext(&from->fc_, to->fc_, reinterpret_cast<intptr_t>(to));
 #else
   BoostContext* ctx[2] = {from, to};
-  void* fake_stack     = nullptr;
+  ASAN_ONLY(void* fake_stack = nullptr);
   ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   boost::context::detail::transfer_t arg = boost::context::detail::jump_fcontext(to->fc_, ctx);
   ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   boost::context::detail::transfer_t arg = boost::context::detail::jump_fcontext(to->fc_, ctx);
index 7f006bc..fbaec9b 100644 (file)
@@ -271,7 +271,7 @@ void RawContext::wrapper(void* arg)
 
 inline void RawContext::swap(RawContext* from, RawContext* to)
 {
 
 inline void RawContext::swap(RawContext* from, RawContext* to)
 {
-  void* fake_stack = nullptr;
+  ASAN_ONLY(void* fake_stack = nullptr);
   ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   raw_swapcontext(&from->stack_top_, to->stack_top_);
   ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   raw_swapcontext(&from->stack_top_, to->stack_top_);
index b4af204..af76c2c 100644 (file)
@@ -143,7 +143,7 @@ void UContext::make_ctx(ucontext_t* ucp, void (*func)(int, int), UContext* arg)
 
 inline void UContext::swap(UContext* from, UContext* to)
 {
 
 inline void UContext::swap(UContext* from, UContext* to)
 {
-  void* fake_stack = nullptr;
+  ASAN_ONLY(void* fake_stack = nullptr);
   ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   swapcontext(&from->uc_, &to->uc_);
   ASAN_ONLY(to->asan_ctx_ = from);
   ASAN_START_SWITCH(from->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
   swapcontext(&from->uc_, &to->uc_);
index 037ce01..756aba9 100644 (file)
@@ -17,7 +17,7 @@
 #else
 #define ASAN_ONLY(expr) (void)0
 #define ASAN_START_SWITCH(fake_stack_save, bottom, size) (void)0
 #else
 #define ASAN_ONLY(expr) (void)0
 #define ASAN_START_SWITCH(fake_stack_save, bottom, size) (void)0
-#define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old) (void)(fake_stack_save)
+#define ASAN_FINISH_SWITCH(fake_stack_save, bottom_old, size_old) (void)0
 #endif
 
 #endif
 #endif
 
 #endif