Fix windows AOT hw bound check (#2475)
When AOT out of bound linear memory access or stack overflow occurs, the call stack of AOT functions cannot be unwound currently, so from the exception handler, runtime cannot jump back into the place that calls the AOT function. We temporarily skip the current instruction and let AOT code continue to run and return to caller as soon as possible. And use the zydis library the decode the current instruction to get its size. And remove using RtlAddFunctionTable to register the AOT functions since it doesn't work currently.
This commit is contained in:
@ -69,9 +69,6 @@ get_plt_table_size()
|
||||
{
|
||||
uint32 size =
|
||||
get_plt_item_size() * (sizeof(target_sym_map) / sizeof(SymbolMap));
|
||||
#if defined(OS_ENABLE_HW_BOUND_CHECK) && defined(BH_PLATFORM_WINDOWS)
|
||||
size += get_plt_item_size() + sizeof(AOTUnwindInfo);
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -93,18 +90,6 @@ init_plt_table(uint8 *plt)
|
||||
*p++ = 0xE0;
|
||||
plt += get_plt_item_size();
|
||||
}
|
||||
|
||||
#if defined(OS_ENABLE_HW_BOUND_CHECK) && defined(BH_PLATFORM_WINDOWS)
|
||||
p = plt;
|
||||
/* mov exception_handler, rax */
|
||||
*p++ = 0x48;
|
||||
*p++ = 0xB8;
|
||||
*(uint64 *)p = 0; /*(uint64)(uintptr_t)aot_exception_handler;*/
|
||||
p += sizeof(uint64);
|
||||
/* jmp rax */
|
||||
*p++ = 0xFF;
|
||||
*p++ = 0xE0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
Reference in New Issue
Block a user