wasm-micro-runtime
wasm-micro-runtime copied to clipboard
Support custom stack guard size
Add a new option WAMR_BUILD_STACK_GUARD_SIZE to use custom stack guard size,
for most RTOS port, we use stack base as check boundry which may not safety as POSIX based system (like linux).
Just a little confused about the meaning of when exec_env->native_stack_boundary is NULL. Does it mean one of the below?
- be easy, there is no stack boundary at all.
- or, be panic, there is something wrong. There should always be value.
@lum1n0us In current implementation, I think NULL means there is no stack boundary at all.
@lum1n0us In current implementation, I think
NULLmeans there is no stack boundary at all.
Some platforms doesn't provide the related API to get native stack boundary,
so we return NULL in API os_thread_get_stack_boundary, e.g. alios.
in that case, such a comparison looks a little wired. It will be passed but ...
// if (&module_inst < NULL)
if ((uint8 *)&module_inst < exec_env->native_stack_boundary) {
aot_set_exception_with_id(module_inst, EXCE_NATIVE_STACK_OVERFLOW);
return false;
}
Would one of the below be better?
if (!exec_env->native_stack_boundary && &moudle_inst < exec_env->native_stack_bounbdary)- Or use
UINT64_MAXinstead ofNULLifnative_stack_boundaryisn't provided.
in that case, such a comparison looks a little wired. It will be passed but ...
// if (&module_inst < NULL) if ((uint8 *)&module_inst < exec_env->native_stack_boundary) { aot_set_exception_with_id(module_inst, EXCE_NATIVE_STACK_OVERFLOW); return false; }Would one of the below be better?
if (!exec_env->native_stack_boundary && &moudle_inst < exec_env->native_stack_bounbdary)- Or use
UINT64_MAXinstead ofNULLifnative_stack_boundaryisn't provided.
No need to do that, if exec_env->native_stack_boundary is NULL, this condition
if ((uint8 *)&module_inst < exec_env->native_stack_boundary) will be always false,
here the check is OK. The issue is in the platform API itself.