bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.96k stars 624 forks source link

EXCE_NATIVE_STACK_OVERFLOW check inconsistencies #3059

Open yamt opened 10 months ago

yamt commented 10 months ago

looking at the aot runtime, we have EXCE_NATIVE_STACK_OVERFLOW checks in:

otoh, we don't have it in:

note: invoke_native_internal is used by aot_call_function and aot_call_indirect.

i suppose it isn't a big problem as far as WASM_STACK_GUARD_SIZE is large enough to run a native function. but it's better to be consistent anyway.

related: https://github.com/bytecodealliance/wasm-micro-runtime/issues/2287

wenyongh commented 9 months ago

Hi, when hw bound check is enabled, aot_call_function calls invoke_native_with_hw_bound_check, in which the EXCE_NATIVE_STACK_OVERFLOW check is already added. When hw bound check isn't enabled, it calls invoke_native_internal instead, which doesn't added the check, how about adding check in invoke_native_internal instead of in aot_call_function?

Agree to add check in aot_invoke_native, which calls wasm_runtime_invoke_c_api_native/wasm_runtime_invoke_native/wasm_runtime_invoke_native_raw.