diff --git a/cmake/XrplInterface.cmake b/cmake/XrplInterface.cmake index 7add613f5a..825cb63310 100644 --- a/cmake/XrplInterface.cmake +++ b/cmake/XrplInterface.cmake @@ -23,7 +23,6 @@ target_compile_definitions( BOOST_FILESYSTEM_NO_DEPRECATED > $<$>: - BOOST_COROUTINES2_NO_DEPRECATION_WARNING BOOST_BEAST_ALLOW_DEPRECATED BOOST_FILESYSTEM_DEPRECATED > diff --git a/conan/profiles/sanitizers b/conan/profiles/sanitizers index 6d37425f43..073fcf3072 100644 --- a/conan/profiles/sanitizers +++ b/conan/profiles/sanitizers @@ -82,5 +82,12 @@ tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags" boost/*:without_context=False # Boost stacktrace fails to build with some sanitizers boost/*:without_stacktrace=True + {% elif "thread" in sanitizers %} + # Build Boost.Context with ucontext backend for TSAN. fcontext (assembly) + # has no TSAN annotations, so without this the BOOST_USE_TSAN/BOOST_USE_UCONTEXT + # defines in [conf] would be ineffective. + boost/*:extra_b2_flags=context-impl=ucontext thread-sanitizer=on define=BOOST_USE_TSAN=1 + boost/*:without_context=False + boost/*:without_stacktrace=True {% endif %} {% endif %} diff --git a/conanfile.py b/conanfile.py index 4949516bfe..66de2e2d57 100644 --- a/conanfile.py +++ b/conanfile.py @@ -129,12 +129,6 @@ class Xrpl(ConanFile): if self.settings.compiler in ["clang", "gcc"]: self.options["boost"].without_cobalt = True - # Check if environment variable exists - if "SANITIZERS" in os.environ: - sanitizers = os.environ["SANITIZERS"] - if "address" in sanitizers.lower(): - self.default_options["fPIC"] = False - def requirements(self): self.requires("boost/1.90.0", force=True, transitive_headers=True) self.requires("date/3.0.4", transitive_headers=True) diff --git a/include/xrpl/core/Coro.ipp b/include/xrpl/core/Coro.ipp index 2343f805a5..e7461b1b85 100644 --- a/include/xrpl/core/Coro.ipp +++ b/include/xrpl/core/Coro.ipp @@ -2,17 +2,19 @@ namespace xrpl { +/// Coroutine stack size (1.5 MB). Increased from 1 MB because +/// ASAN-instrumented deep call stacks exceeded the original limit. +constexpr std::size_t coroStackSize = 1536 * 1024; + template JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string const& name, F&& f) : jq_(jq) , type_(type) , name_(name) , coro_( - // Stack size of 1MB wasn't sufficient for deep calls. ASAN tests flagged the issue. Hence - // increasing the size to 1.5MB. - boost::context::protected_fixedsize_stack(1536 * 1024), - [this, fn = std::forward(f)]( - boost::coroutines2::asymmetric_coroutine::push_type& do_yield) { + boost::context::protected_fixedsize_stack(coroStackSize), + [this, + fn = std::forward(f)](boost::coroutines2::coroutine::push_type& do_yield) { yield_ = &do_yield; yield(); fn(shared_from_this());