AddressSanitizer (ASan) reports an error if the alternate signal stack remains
active when a thread exits:
==28272==ERROR: AddressSanitizer failed to deallocate 0x2000 (8192) bytes at address 0x7f53ebba7c00
==28272==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_posix.cc:141 "(("unable to unmap" && 0)) != (0)" (0x0, 0x0)
#0 0x7f53ebc950e5 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe40e5)
#1 0x7f53ebcb1c15 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x100c15)
#2 0x7f53ebca975f (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf875f)
#3 0x7f53ebcaa560 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xf9560)
#4 0x7f53ebc98764 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe7764)
#5 0x7f53ea57a5e8 in __nptl_deallocate_tsd.part.4 (/lib/x86_64-linux-gnu/libpthread.so.0+0x65e8)
#6 0x7f53ea57b647 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7647)
#7 0x7f53e93e0abe in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8abe)
// Tell main that we have finished:
xbt_os_sem_release(context->end_);
+#ifndef WIN32
+ stack.ss_flags = SS_DISABLE;
+ sigaltstack(&stack, nullptr);
+#endif
return nullptr;
}
// Signal to the maestro that it has finished:
xbt_os_sem_release(this->end_);
+#ifndef WIN32
+ stack_t stack;
+ stack.ss_flags = SS_DISABLE;
+ sigaltstack(&stack, nullptr);
+#endif
xbt_os_thread_exit(nullptr);
}