Skip to content

Commit 88d9dfe

Browse files
committed
Fix stack overflow detection during ASAN build.
See discussion in issue #4638.
1 parent 2a2dd19 commit 88d9dfe

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

core/iwasm/common/wasm_runtime_common.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7979,6 +7979,16 @@ wasm_runtime_get_module_name(wasm_module_t module)
79797979
return "";
79807980
}
79817981

7982+
#if defined(__GNUC__) || defined(__clang__)
7983+
/* In few places we use addresses of local variables for estimating used stack
7984+
size. This logic conficts with ASAN, since is uses fake stack for local
7985+
variables storage.
7986+
*/
7987+
#define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
7988+
#else
7989+
# define NO_SANITIZE_ADDRESS
7990+
#endif
7991+
79827992
/*
79837993
* wasm_runtime_detect_native_stack_overflow
79847994
*
@@ -7988,6 +7998,7 @@ wasm_runtime_get_module_name(wasm_module_t module)
79887998
*
79897999
* - update native_stack_top_min.
79908000
*/
8001+
NO_SANITIZE_ADDRESS
79918002
bool
79928003
wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
79938004
{
@@ -8010,6 +8021,7 @@ wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
80108021
return true;
80118022
}
80128023

8024+
NO_SANITIZE_ADDRESS
80138025
bool
80148026
wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
80158027
uint32 requested_size)

0 commit comments

Comments
 (0)