From 3cebe7464cf60b2b577f2b961e39277eff036f25 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Tue, 13 Dec 2022 17:44:00 +0100 Subject: [PATCH] fix: protect against jumping over the stack guard page --- src/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36bdc9ab0b..1e95e7b7a4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -146,6 +146,9 @@ if ((${MULTI_THREAD} MATCHES "ON") AND (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) set(LEAN_EXTRA_MAKE_OPTS -s40000 ${LEAN_EXTRA_MAKE_OPTS}) endif () +# We want explicit stack probes in huge Lean stack frames for robust stack overflow detection +string(APPEND LEANC_EXTRA_FLAGS " -fstack-clash-protection") + if(NOT MULTI_THREAD) message(STATUS "Disabled multi-thread support, it will not be safe to run multiple threads in parallel") set(AUTO_THREAD_FINALIZATION OFF)