Add more checks to enhance security (#446)

add more checks to enhance security
clear "wasi proc exit" exception before return to caller in wasm/aot call functions
fix memory profiling issue
change movdqa to movdqu in simd invokeNative asm codes to fix issue of unaligned address access
move setjmp/longjmp from libc-builtin to libc-emcc
fix zephyr platform compilation issue in latest zephyr version
This commit is contained in:
Wenyong Huang
2020-11-24 14:00:09 +08:00
committed by GitHub
parent f4770ae8c8
commit 74be7a0b7c
24 changed files with 397 additions and 216 deletions

View File

@ -267,6 +267,21 @@ getentropy_wrapper(wasm_exec_env_t exec_env, void *buffer, uint32 length)
return getentropy(buffer, length);
}
static int
setjmp_wrapper(wasm_exec_env_t exec_env,
void *jmp_buf)
{
os_printf("setjmp() called\n");
return 0;
}
static void
longjmp_wrapper(wasm_exec_env_t exec_env,
void *jmp_buf, int val)
{
os_printf("longjmp() called\n");
}
#if !defined(BH_PLATFORM_LINUX_SGX)
static FILE *file_list[32] = { 0 };
@ -506,6 +521,8 @@ static NativeSymbol native_symbols_libc_emcc[] = {
REG_NATIVE_FUNC(munmap, "(ii)i"),
REG_NATIVE_FUNC(__munmap, "(ii)i"),
REG_NATIVE_FUNC(getentropy, "(*~)i"),
REG_NATIVE_FUNC(setjmp, "(*)i"),
REG_NATIVE_FUNC(longjmp, "(*i)"),
#if !defined(BH_PLATFORM_LINUX_SGX)
REG_NATIVE_FUNC(fopen, "($$)i"),
REG_NATIVE_FUNC(fread, "(*iii)i"),