Skip to content

Commit 75896c5

Browse files
committed
Fix stack overflow detection during ASAN build.
See discussion in issue #4638.
1 parent 9d1dc3e commit 75896c5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/iwasm/common/wasm_runtime_common.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8012,6 +8012,16 @@ wasm_runtime_get_module_name(wasm_module_t module)
80128012
return "";
80138013
}
80148014

8015+
#if defined(__GNUC__) || defined(__clang__)
8016+
/* In few places we use addresses of local variables for estimating used stack
8017+
size. This logic conficts with ASAN, since is uses fake stack for local
8018+
variables storage.
8019+
*/
8020+
#define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
8021+
#else
8022+
# define NO_SANITIZE_ADDRESS
8023+
#endif
8024+
80158025
/*
80168026
* wasm_runtime_detect_native_stack_overflow
80178027
*
@@ -8021,6 +8031,7 @@ wasm_runtime_get_module_name(wasm_module_t module)
80218031
*
80228032
* - update native_stack_top_min.
80238033
*/
8034+
NO_SANITIZE_ADDRESS
80248035
bool
80258036
wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
80268037
{
@@ -8043,6 +8054,7 @@ wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
80438054
return true;
80448055
}
80458056

8057+
NO_SANITIZE_ADDRESS
80468058
bool
80478059
wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
80488060
uint32 requested_size)

0 commit comments

Comments
 (0)