MDEV-34388: Stack overflow on Alpine Linux (postfix - ASAN/MSAN+Debug)

In original fix, commit 82d7419e06,
a 16k stack frame limit was imposed. Under the stack usage is doubled due
to MSAN. Debug builds without optimization can use more as well.

ASAN Debug builds also exceeded the 16k stack frame limit.

To keep some safety limit, a 64k limit is imposed to the compiler
under MSAN or ASAN with CMAKE_BUILD_TYPE=Debug.
This commit is contained in:
Daniel Black
2025-05-23 19:59:58 +10:00
parent 5012402330
commit 8490901307

View File

@ -19,6 +19,12 @@ IF(MSVC OR MYSQL_MAINTAINER_MODE STREQUAL "NO")
RETURN()
ENDIF()
IF((WITH_MSAN OR WITH_ASAN) AND CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(STACK_FRAME_LIMIT 65536)
ELSE()
SET(STACK_FRAME_LIMIT 16384)
ENDIF()
# Common warning flags for GCC, G++, Clang and Clang++
SET(MY_WARNING_FLAGS
-Wall
@ -41,7 +47,7 @@ SET(MY_WARNING_FLAGS
-Wvla
-Wwrite-strings
-Wcast-function-type-strict
-Wframe-larger-than=16384
-Wframe-larger-than=${STACK_FRAME_LIMIT}
)
# Warning flags that are in testing before moving