With newer clang and gcc versions (observed on clang-17.0.6 as
well as gcc 12/13), asan is throwing stack-use-after-return
during OSD startup related to usage of seastar::async, which
relies on swapcontext internally.
seastar/src/core/thread.cc supports asan's hooks, but only if
SEASTAR_HAVE_ASAN_FIBER_SUPPORT is set. seastar's CMakeList.txt
sets it based on Sanitizers_FIBER_SUPPORT, which probably should
be set by the module at src/seastar/cmake/FindSanitizers.cmake,
but that module doesn't seem to be actually invoked anywhere.
Ceph's version of that module (cmake/modules/FindSanitizers.cmake)
does not set Sanitizers_FIBER_SUPPORT.
This commit adds that check as well as the related code snippet.
Fixes: https://tracker.ceph.com/issues/64512
Signed-off-by: Samuel Just <sjust@redhat.com>
set(CMAKE_REQUIRED_LIBRARIES ${Sanitizers_COMPILE_OPTIONS})
check_cxx_source_compiles("int main() {}"
Sanitizers_ARE_SUPPORTED)
+
+file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Sanitizers_fiber_test.cc _sanitizers_fiber_test_code)
+check_cxx_source_compiles ("${_sanitizers_fiber_test_code}" Sanitizers_FIBER_SUPPORT)
cmake_pop_check_state()
include(FindPackageHandleStandardArgs)
--- /dev/null
+#include <cstddef>
+
+extern "C" {
+ void __sanitizer_start_switch_fiber(void**, const void*, size_t);
+ void __sanitizer_finish_switch_fiber(void*, const void**, size_t*);
+}
+
+int main() {
+ __sanitizer_start_switch_fiber(nullptr, nullptr, 0);
+ __sanitizer_finish_switch_fiber(nullptr, nullptr, nullptr);
+}