Kaynağa Gözat

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

See discussion in issue #4638.
Vyacheslav Chigrin 2 ay önce
ebeveyn
işleme
8d069c230c
1 değiştirilmiş dosya ile 12 ekleme ve 0 silme
  1. 12 0
      core/iwasm/common/wasm_runtime_common.c

+ 12 - 0
core/iwasm/common/wasm_runtime_common.c

@@ -8012,6 +8012,16 @@ wasm_runtime_get_module_name(wasm_module_t module)
     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
  *
@@ -8021,6 +8031,7 @@ wasm_runtime_get_module_name(wasm_module_t module)
  *
  * - update native_stack_top_min.
  */
+NO_SANITIZE_ADDRESS
 bool
 wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
 {
@@ -8043,6 +8054,7 @@ wasm_runtime_detect_native_stack_overflow(WASMExecEnv *exec_env)
     return true;
 }
 
+NO_SANITIZE_ADDRESS
 bool
 wasm_runtime_detect_native_stack_overflow_size(WASMExecEnv *exec_env,
                                                uint32 requested_size)