From 70d8016c29a80fb1502193400def05a0cd186eec Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 5 Jun 2025 15:55:29 +0200 Subject: [PATCH] rec: Fix stack-use-after-scope reported by ASAN Technically we are indeed using a stack that is no longer the active one, because we just switched to a different context, but since the previous stack still exists that I do not believe it is a real issue. After this commit we access the previous stack before notifying ASAN that the stack switch is finished, so we are still allowed to do that. Note that clang 19 ASAN is fine with both behaviour, but GCC 14 and 15 ASAN aren't. Signed-off-by: Remi Gacogne --- pdns/recursordist/mtasker_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/recursordist/mtasker_context.cc b/pdns/recursordist/mtasker_context.cc index b162d68771..d2d9157a86 100644 --- a/pdns/recursordist/mtasker_context.cc +++ b/pdns/recursordist/mtasker_context.cc @@ -160,11 +160,11 @@ extern "C" *ptr = res.fctx; } #endif + auto start = std::move(*work); notifyStackSwitchDone(); args = nullptr; try { - auto start = std::move(*work); start(); } catch (...) { -- 2.47.2