]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
When an exception is thrown from an mthread register stack switch in the ASAN case
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 12 Sep 2023 15:09:15 +0000 (17:09 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 13 Sep 2023 11:17:32 +0000 (13:17 +0200)
pdns/mtasker.cc
pdns/recursordist/test-mtasker.cc
pdns/recursordist/test-rec-zonetocache.cc

index 82d1bbe87547b39652a8bb7b8accc19723a4fdb8..dd7ccc50bd11eae72cba5931aa2cfcf1b5ba1fc4 100644 (file)
@@ -325,7 +325,14 @@ template<class Key, class Val, class Cmp>bool MTasker<Key,Val,Cmp>::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();
index dd716cae0e5ccca5e590840c71d811627e93d860..18a9620c7df921ddb845a69acc3fa32beb49ed15 100644 (file)
@@ -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()
index 6f95abced8a57201f35adfa63974977eb70b7874..12c0a6dc9aa63a971ddbf0461178e2bf67b40f7b 100644 (file)
@@ -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);
 }