Fix stack overflow detection during ASAN build. (#4642)

See discussion in issue #4638.
This commit is contained in:
Vyacheslav Chigrin 2026-03-23 04:49:42 +03:00 committed by GitHub
parent bdb58e042b
commit 8d069c230c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8012,6 +8012,16 @@ wasm_runtime_get_module_name(wasm_module_t module)
return ""; return "";
} }
#if defined(__GNUC__) || defined(__clang__)
/* In few places we use addresses of local variables for estimating used stack
size. This logic conficts with ASAN, since it uses fake stack for local
variables storage.
*/
#define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
#define NO_SANITIZE_ADDRESS
#endif
/* /*
* wasm_runtime_detect_native_stack_overflow * wasm_runtime_detect_native_stack_overflow
* *
@ -8021,6 +8031,7 @@ wasm_runtime_get_module_name(wasm_module_t module)
* *
* - update native_stack_top_min. * - update native_stack_top_min.
*/ */
NO_SANITIZE_ADDRESS
bool bool
wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env) wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
{ {
@ -8043,6 +8054,7 @@ wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
return true; return true;
} }
NO_SANITIZE_ADDRESS
bool bool
wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env, wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
uint32 requested_size) uint32 requested_size)