From cf1c381bb899186c936614d93faa31d85e917499 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 5 Jul 2024 14:26:13 +1000 Subject: [PATCH] MDEV-34099: AddressSanitizer running out of memory regardless of stack_thread size Address Sanitizer's know how to detect stack overrun, so there's no point in us doing it. As evidenced by perfschema tests where signficant test failures because this function failed under ASAN (MDEV-33210). Also, so since clang-16, we cannot assume much about how local variables are allocated on the stack (MDEV-31605). Disabling check idea thanks to Sanja. --- sql/sql_parse.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e0180b035d4..8a218290114 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7614,6 +7614,7 @@ __attribute__((optimize("-O0"))) #endif check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused))) { +#ifndef __SANITIZE_ADDRESS__ long stack_used; DBUG_ASSERT(thd == current_thd); if ((stack_used= available_stack_size(thd->thread_stack, &stack_used)) >= @@ -7636,6 +7637,7 @@ check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused))) #ifndef DBUG_OFF max_stack_used= MY_MAX(max_stack_used, stack_used); #endif +#endif /* __SANITIZE_ADDRESS__ */ return 0; }