Compare commits

...

3 Commits

Author SHA1 Message Date
Wenyong Huang
607ae47d7b
core/shared/platform: Zero memory returned by os_mmap in some platforms (#3551)
Some checks are pending
compilation on SGX / build_iwasm (-DWAMR_DISABLE_HW_BOUND_CHECK=1, $FAST_JIT_BUILD_OPTIONS, ubuntu-20.04, linux-sgx) (push) Waiting to run
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $AOT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com/WebA… (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $CLASSIC_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://gith… (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_INTERP_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.… (push) Blocked by required conditions
compilation on SGX / run_samples_file (-DWAMR_BUILD_SGX_IPFS=1, $FAST_JIT_BUILD_OPTIONS, ${{ needs.build_llvm_libraries.outputs.cache_key }}, ubuntu-20.04, linux-sgx, https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz, https://github.com… (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -S -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, aot, -x -p -s spec -X -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, classic-interp, -x -p -s spec -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, fast-interp, -x -p -s spec -P) (push) Blocked by required conditions
compilation on SGX / spec_test_default (${{ needs.build_llvm_libraries.outputs.cache_key }}, fast-jit, -x -p -s spec -P) (push) Blocked by required conditions
compilation on windows-latest / build (-DWAMR_BUILD_AOT=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_CUSTOM_NAME_SECTION=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_DEBUG_INTERP=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_PTHREAD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_LIB_WASI_THREADS=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_REF_TYPES=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_SIMD=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_BUILD_TAIL_CALL=1) (push) Waiting to run
compilation on windows-latest / build (-DWAMR_DISABLE_HW_BOUND_CHECK=1) (push) Waiting to run
compilation on windows-latest / test (classic-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (classic-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $DEFAULT_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $MULTI_MODULES_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $THREADS_TEST_OPTIONS) (push) Blocked by required conditions
compilation on windows-latest / test (fast-interp, $WASI_TEST_OPTIONS) (push) Blocked by required conditions
The os_mmap should zero the mapped memory like what posix mmap does.
2024-06-21 13:33:12 +08:00
Benbuck Nason
e8df3b5c48
Consistent const keyword position in wasm_export.h (#3558) 2024-06-21 11:40:34 +08:00
Benbuck Nason
7d3bac62af
Add linked field comment for aot import type (#3557) 2024-06-21 10:24:56 +08:00
7 changed files with 52 additions and 25 deletions

View File

@ -4010,7 +4010,7 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
import_type->module_name = aot_import_table->module_name;
import_type->name = aot_import_table->table_name;
import_type->kind = WASM_IMPORT_EXPORT_KIND_TABLE;
import_type->linked = false;
import_type->linked = false; /* not supported */
import_type->u.table_type =
(WASMTableType *)&aot_import_table->table_type;
return;
@ -4023,7 +4023,7 @@ wasm_runtime_get_import_type(WASMModuleCommon *const module, int32 import_index,
import_type->module_name = aot_import_memory->module_name;
import_type->name = aot_import_memory->memory_name;
import_type->kind = WASM_IMPORT_EXPORT_KIND_MEMORY;
import_type->linked = false;
import_type->linked = false; /* not supported */
import_type->u.memory_type =
(WASMMemoryType *)&aot_import_memory->mem_type;
return;

View File

@ -712,7 +712,7 @@ wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
* @return the function instance found, NULL if not found
*/
WASM_RUNTIME_API_EXTERN wasm_function_inst_t
wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
const char *name);
/**
@ -724,8 +724,8 @@ wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
* @return the parameter count of the function instance
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_param_count(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst);
wasm_func_get_param_count(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst);
/**
* Get result count of the function instance
@ -736,8 +736,8 @@ wasm_func_get_param_count(wasm_function_inst_t const func_inst,
* @return the result count of the function instance
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_result_count(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst);
wasm_func_get_result_count(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst);
/**
* Get parameter types of the function instance
@ -747,8 +747,8 @@ wasm_func_get_result_count(wasm_function_inst_t const func_inst,
* @param param_types the parameter types returned
*/
WASM_RUNTIME_API_EXTERN void
wasm_func_get_param_types(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst,
wasm_func_get_param_types(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst,
wasm_valkind_t *param_types);
/**
@ -759,8 +759,8 @@ wasm_func_get_param_types(wasm_function_inst_t const func_inst,
* @param result_types the result types returned
*/
WASM_RUNTIME_API_EXTERN void
wasm_func_get_result_types(wasm_function_inst_t const func_inst,
wasm_module_inst_t const module_inst,
wasm_func_get_result_types(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst,
wasm_valkind_t *result_types);
/**
@ -1314,7 +1314,7 @@ wasm_runtime_get_export_type(const wasm_module_t module, int32_t export_index,
* @return the number of parameters for the function type
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_param_count(wasm_func_type_t const func_type);
wasm_func_type_get_param_count(const wasm_func_type_t func_type);
/**
* Get the kind of a parameter for a function type
@ -1325,7 +1325,7 @@ wasm_func_type_get_param_count(wasm_func_type_t const func_type);
* @return the kind of the parameter if successful, -1 otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_param_valkind(wasm_func_type_t const func_type,
wasm_func_type_get_param_valkind(const wasm_func_type_t func_type,
uint32_t param_index);
/**
@ -1336,7 +1336,7 @@ wasm_func_type_get_param_valkind(wasm_func_type_t const func_type,
* @return the number of results for the function type
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_type_get_result_count(wasm_func_type_t const func_type);
wasm_func_type_get_result_count(const wasm_func_type_t func_type);
/**
* Get the kind of a result for a function type
@ -1347,7 +1347,7 @@ wasm_func_type_get_result_count(wasm_func_type_t const func_type);
* @return the kind of the result if successful, -1 otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_result_valkind(wasm_func_type_t const func_type,
wasm_func_type_get_result_valkind(const wasm_func_type_t func_type,
uint32_t result_index);
/**
@ -1817,7 +1817,7 @@ wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst,
* and name string) if found, NULL otherwise
*/
WASM_RUNTIME_API_EXTERN const uint8_t *
wasm_runtime_get_custom_section(wasm_module_t const module_comm,
wasm_runtime_get_custom_section(const wasm_module_t module_comm,
const char *name, uint32_t *len);
/**

View File

@ -49,9 +49,15 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{
if ((uint64)size >= UINT32_MAX)
void *addr;
if (size >= UINT32_MAX)
return NULL;
return BH_MALLOC((uint32)size);
if ((addr = BH_MALLOC((uint32)size)))
memset(addr, 0, (uint32)size);
return addr;
}
void

View File

@ -43,8 +43,10 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin;
#if (WASM_MEM_DUAL_BUS_MIRROR != 0)
memset(buf_fixed + MEM_DUAL_BUS_OFFSET, 0, size);
return buf_fixed + MEM_DUAL_BUS_OFFSET;
#else
memset(buf_fixed, 0, size);
return buf_fixed;
#endif
}
@ -71,6 +73,7 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
uintptr_t *addr_field = buf_fixed - sizeof(uintptr_t);
*addr_field = (uintptr_t)buf_origin;
memset(buf_fixed, 0, size);
return buf_fixed;
}
}

View File

@ -52,9 +52,15 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{
if (size > ((unsigned)~0))
void *addr;
if (size >= UINT32_MAX)
return NULL;
return BH_MALLOC((unsigned)size);
if ((addr = BH_MALLOC((uint32)size)))
memset(addr, 0, (uint32)size);
return addr;
}
void *

View File

@ -200,7 +200,12 @@ os_cond_wait(korp_cond *cond, korp_mutex *mutex)
void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{
return rt_malloc(size);
void *addr;
if ((addr = rt_malloc(size)))
memset(addr, 0, size);
return addr;
}
void

View File

@ -179,12 +179,19 @@ strcspn(const char *s, const char *reject)
void *
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
{
void *addr;
if ((uint64)size >= UINT32_MAX)
return NULL;
if (exec_mem_alloc_func)
return exec_mem_alloc_func((uint32)size);
addr = exec_mem_alloc_func((uint32)size);
else
return BH_MALLOC(size);
addr = BH_MALLOC(size);
if (addr)
memset(addr, 0, size);
return addr;
}
void *