From: Otto Moerbeek Date: Tue, 12 Sep 2023 15:09:15 +0000 (+0200) Subject: When an exception is thrown from an mthread register stack switch in the ASAN case X-Git-Tag: dnsdist-1.9.0-alpha1~6^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=027330ebea75279547ca6db37811dfa3397386c7;p=thirdparty%2Fpdns.git When an exception is thrown from an mthread register stack switch in the ASAN case --- diff --git a/pdns/mtasker.cc b/pdns/mtasker.cc index 82d1bbe875..dd7ccc50bd 100644 --- a/pdns/mtasker.cc +++ b/pdns/mtasker.cc @@ -325,7 +325,14 @@ templatebool MTasker::schedule(con d_threads[d_tid].dt.start(); #endif notifyStackSwitch(d_threads[d_tid].startOfStack, d_stacksize); - pdns_swapcontext(d_kernel, *d_threads[d_tid].context); + try { + pdns_swapcontext(d_kernel, *d_threads[d_tid].context); + } + catch (...) { + notifyStackSwitchDone(); + // It is not clear if the d_runQueue.pop() should be done in this case + throw; + } notifyStackSwitchDone(); d_runQueue.pop(); diff --git a/pdns/recursordist/test-mtasker.cc b/pdns/recursordist/test-mtasker.cc index dd716cae0e..18a9620c7d 100644 --- a/pdns/recursordist/test-mtasker.cc +++ b/pdns/recursordist/test-mtasker.cc @@ -78,19 +78,6 @@ BOOST_AUTO_TEST_CASE(test_AlmostStackOverflow) BOOST_CHECK_EQUAL(g_result, o); } -#if defined(HAVE_FIBER_SANITIZER) && defined(__APPLE__) && defined(__arm64__) - -// This test is buggy on MacOS when compiled with asan. It also causes subsequents tests to report spurious issues. -// So switch it off for now -// See https://github.com/PowerDNS/pdns/issues/12151 - -BOOST_AUTO_TEST_CASE(test_MtaskerException) -{ - cerr << "test_MtaskerException test disabled on this platform with asan enabled, please fix" << endl; -} - -#else - static void willThrow(void* /* p */) { throw std::runtime_error("Help!"); @@ -111,6 +98,4 @@ BOOST_AUTO_TEST_CASE(test_MtaskerException) std::exception); } -#endif // defined(HAVE_FIBER_SANITIZER) && defined(__APPLE__) && defined(__arm64__) - BOOST_AUTO_TEST_SUITE_END() diff --git a/pdns/recursordist/test-rec-zonetocache.cc b/pdns/recursordist/test-rec-zonetocache.cc index 6f95abced8..12c0a6dc9a 100644 --- a/pdns/recursordist/test-rec-zonetocache.cc +++ b/pdns/recursordist/test-rec-zonetocache.cc @@ -169,6 +169,8 @@ static void zonemdGenericTest(const std::string& lines, pdns::ZoneMD::Config mod BOOST_AUTO_TEST_CASE(test_zonetocachegeneric) { + g_log.setLoglevel(Logger::Critical); + g_log.toConsole(Logger::Critical); zonemdGenericTest(genericTest, pdns::ZoneMD::Config::Require, pdns::ZoneMD::Config::Ignore, 4U); zonemdGenericTest(genericBadTest, pdns::ZoneMD::Config::Require, pdns::ZoneMD::Config::Ignore, 0U); }