mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-07-18 02:08:24 +00:00
Compare commits
10 Commits
373e3c4938
...
eaea7c15ec
Author | SHA1 | Date | |
---|---|---|---|
![]() |
eaea7c15ec | ||
![]() |
2a952b371a | ||
![]() |
b3158e643c | ||
![]() |
c8f7a7fc1a | ||
![]() |
2c4a660c4c | ||
![]() |
53feadc2b0 | ||
![]() |
5d48cfdbc0 | ||
![]() |
65d3ffa7a4 | ||
![]() |
47c7c85ac2 | ||
![]() |
0cfe3ce452 |
119
RELEASE_NOTES.md
119
RELEASE_NOTES.md
|
@ -1,3 +1,122 @@
|
|||
## WAMR-2.4.0
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- Refactor copy callstack feature (#4401)
|
||||
- Enable WAMR_BUILD_WASI_EPHEMERAL_NN by default (#4381)
|
||||
- Enable aot memory64 sw bounds checks by default (#4350)
|
||||
|
||||
### New Features
|
||||
|
||||
- Support extended constant expressions (#4432)
|
||||
- Shared heap enhancements for Interpreter and AOT (#4400)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- posix os_socket_addr_resolve: return the consistent max_info_size (#4467)
|
||||
- fix a wamrc debug mode compile issue (#4470)
|
||||
- wasi-nn: do not pretend to support legacy abi in openvino and llamacpp (#4468)
|
||||
- appease a few compiler warnings (-Wstrict-prototypes) (#4465)
|
||||
- enable aux stack frame for aot compiler fuzz test (#4462)
|
||||
- improve logic of `heap_type` validation when `ref.null` (#4372)
|
||||
- wasi_nn_llamacpp.c: explicitly reject unimplemented input index (#4446)
|
||||
- wasi: avoid user-triggerable 0-sized allocations (#4452)
|
||||
- Fix socket shutdown (#12) (#4449)
|
||||
- wasi_nn_llamacpp.c: validate input tensor type/dimensions (#4442)
|
||||
- wasi_nn_llamacpp.c: reject invalid graph and execution context (#4422)
|
||||
- wasi_nn_openvino.c: avoid self-assignment warning (#4434)
|
||||
- Fix potential integer overflow issues (#4429)
|
||||
- Improve run.py of regression (#4417)
|
||||
- wasi-nn: reduce code duplication a bit (#4433)
|
||||
- Refactor AOTObjectData definition to use a forward declaration (#4428)
|
||||
- CI: revert SGX retry attempts (#4421)
|
||||
- loader: fix a potential overflow issue (#4427)
|
||||
- wasi_nn_openvino.c: fix a debug build (#4416)
|
||||
- Fix few shadow warnings (#4409)
|
||||
- wasi_nn_llamacpp.c: remove an unused variable (#4415)
|
||||
- wasi_nn_llamacpp.c: fix buffer overruns in set_input (#4420)
|
||||
- wasi-nn: make the host use the wasi_ephemeral_nn version of tensor_data (#4411)
|
||||
- Collective fix (#4413)
|
||||
- fix bug in bh_vector when extending (#4414)
|
||||
- wasi_nn_llamacpp.c: make this compilable (#4403)
|
||||
- Fix handling of non-nullable global_type during global import (#4408)
|
||||
- loader: add type index checking (#4402)
|
||||
- wasi_nn_tensorflowlite.cpp: fix get_output return size (#4390)
|
||||
- wasi-nn: fix context lifetime issues (#4396)
|
||||
- CI: fix the description of upload_url (#4407)
|
||||
- wamr-wasi-extensions/socket: disable reference-types (#4392)
|
||||
- wasi_nn_openvino.c: implement multiple models per instance (#4380)
|
||||
- Improve spec test execution by adding retry logic for transient errors (#4393)
|
||||
- wasi-nn: add minimum serialization on WASINNContext (#4387)
|
||||
- deprecate legacy WAMR-specific "wasi_nn" module (#4382)
|
||||
- wasi-nn: fix tensor_data abi for wasi_ephemeral_nn (#4379)
|
||||
- core/iwasm/libraries/wasi-nn/test: use the correct version of keras (#4383)
|
||||
- Fix several issues related to night-run CI and test scripts. (#4385)
|
||||
- wasi_nn_tensorflowlite.cpp: reject non-fp32 input earlier (#4388)
|
||||
- core/iwasm/libraries/wasi-nn/test/build.sh: add a tip for intel mac (#4389)
|
||||
- wasi-nn: don't try to deinit uninitialized backend (#4375)
|
||||
- wasi-nn: apply the shared library hack to darwin as well (#4374)
|
||||
- add nn-cli example (#4373)
|
||||
- wasi_nn_openvino.c: remove pre/postprocessing and layout assumptions (#4361)
|
||||
- send an empty/error reply from server (#4362)
|
||||
- wasi_nn_openvino.c: add a missing buffer overflow check in get_output (#4353)
|
||||
- wasi_ephemeral_nn.h: prefix identfiers to avoid too generic names (#4358)
|
||||
- wamr-wasi-extensions: add lib-socket things (#4360)
|
||||
- wasi_nn_openvino.c: remove broken xml check (#4365)
|
||||
- add validation for array type in load_init_expr(GC only) (#4370)
|
||||
- wasi-nn: fix backend leak on multiple loads (#4366)
|
||||
- Collective fix for typos and minor bugs (#4369)
|
||||
- Modify AOT static PGO to conform to llvm-18 and add a CI job to test static PGO on the coremark benchmark (#4345)
|
||||
- Update WABT downloads URL (#4357)
|
||||
- clean up incompatible running mode checks in test script and ci (#4342)
|
||||
- Follow #4268 to deprecate wamr_ide-related components (#4341)
|
||||
- Update type validation in load_table_import() and load_table() (#4296)
|
||||
- wasi_nn_openvino.c: remove the tensor layout adjustment logic (#4308)
|
||||
- add heap-type check for GC when ref.null (#4300)
|
||||
- wasi_nn_types.h: remove a seemingly stale comment (#4348)
|
||||
- wasi_socket_ext.c: avoid tls to make this library-friendly (#4338)
|
||||
- wasi-nn: do not assign wasi_nn_ctx->backend multiple times (#4329)
|
||||
- wasi_nn.h: make this compatible with wasi_ephemeral_nn (#4330)
|
||||
- remove temporary wasi-libc build steps from CI workflows (#4343)
|
||||
- wasi-nn: fix the size of tensor->type (#4333)
|
||||
- wasi-nn: move some host-only things out of wasi_nn_types.h (#4334)
|
||||
- Collective fix: fix some typos (#4337)
|
||||
- Update binary compression steps to follow symlinks for actual files (#4321)
|
||||
- Add wamrc compilation into Windows CI workflow (#4327)
|
||||
- wasi-nn: remove unused wasi_nn_dump_tensor_dimension prototype (#4325)
|
||||
- wasi_nn.h: add import_name attribute (#4328)
|
||||
- wasi-nn: protect the backend lookup table with a lock (#4319)
|
||||
- handle nullable heap reference types in import section (#4302)
|
||||
- wasi_nn_openvino.c: make this buildable (#4305)
|
||||
- wasi-nn: fix shared library filenames for macOS (#4306)
|
||||
- fix wasi-nn abi definitions (#4307)
|
||||
- wasi-nn: remove "backends" argument from detect_and_load_backend() (#4309)
|
||||
- wasi_nn_openvino.c: fix a few printf formats (#4310)
|
||||
- Bump uvwasi to latest commit #392e1f1 (#4312)
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Add readme for extended const (#4471)
|
||||
- Add security issue runbook (#4450)
|
||||
- docs: fix cmake variable typo (#4441)
|
||||
- CI: add wamr_wasi_extensions to the release assets (#4425)
|
||||
- CI: build wamr-wasi-extensions (#4394)
|
||||
- improve installation steps for wasi-sdk and wabt on Windows (#4359)
|
||||
- wamr-wasi-extensions: add a cmake package to provide our wasi extension (#4344)
|
||||
- Update Dockerfile for Zephyr SDK and Zephyr-project versioning (#4335)
|
||||
- add load_by_name in wasi-nn (#4298)
|
||||
|
||||
### Others
|
||||
|
||||
- build(deps): Bump ossf/scorecard-action from 2.4.1 to 2.4.2 (#4315)
|
||||
- build(deps): Bump github/codeql-action from 3.29.1 to 3.29.2 (#4459)
|
||||
- build(deps): Bump github/codeql-action from 3.29.0 to 3.29.1 (#4436)
|
||||
- build(deps): Bump github/codeql-action from 3.28.19 to 3.29.0 (#4371)
|
||||
- build(deps): Bump github/codeql-action from 3.28.18 to 3.28.19 (#4346)
|
||||
- build(deps): Bump requests from 2.32.3 to 2.32.4 in /build-scripts (#4349)
|
||||
|
||||
---
|
||||
|
||||
## WAMR-2.3.1
|
||||
|
||||
### Breaking Changes
|
||||
|
|
|
@ -7,8 +7,8 @@ if(NOT WAMR_ROOT_DIR)
|
|||
endif()
|
||||
|
||||
set(WAMR_VERSION_MAJOR 2)
|
||||
set(WAMR_VERSION_MINOR 3)
|
||||
set(WAMR_VERSION_PATCH 1)
|
||||
set(WAMR_VERSION_MINOR 4)
|
||||
set(WAMR_VERSION_PATCH 0)
|
||||
|
||||
message("-- WAMR version: ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}")
|
||||
|
||||
|
|
|
@ -3218,6 +3218,10 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
|
|||
bool ret = false;
|
||||
bh_assert(func_idx < aot_module->import_func_count);
|
||||
|
||||
#if __has_feature(memory_sanitizer)
|
||||
#include <sanitizer/msan_interface.h>
|
||||
__msan_unpoison(argv, (sizeof(uint32) * argc));
|
||||
#endif
|
||||
import_func = aot_module->import_funcs + func_idx;
|
||||
if (import_func->call_conv_wasm_c_api)
|
||||
func_ptr =
|
||||
|
|
|
@ -1654,14 +1654,70 @@ wasm_runtime_instantiate(WASMModuleCommon *module, uint32 stack_size,
|
|||
error_buf_size);
|
||||
}
|
||||
|
||||
static void
|
||||
instantiation_args_set_defaults(struct InstantiationArgs2 *args)
|
||||
{
|
||||
memset(args, 0, sizeof(*args));
|
||||
}
|
||||
|
||||
WASMModuleInstanceCommon *
|
||||
wasm_runtime_instantiate_ex(WASMModuleCommon *module,
|
||||
const InstantiationArgs *args, char *error_buf,
|
||||
uint32 error_buf_size)
|
||||
{
|
||||
struct InstantiationArgs2 v2;
|
||||
instantiation_args_set_defaults(&v2);
|
||||
v2.v1 = *args;
|
||||
return wasm_runtime_instantiate_ex2(module, &v2, error_buf, error_buf_size);
|
||||
}
|
||||
|
||||
bool
|
||||
wasm_runtime_instantiation_args_create(struct InstantiationArgs2 **p)
|
||||
{
|
||||
struct InstantiationArgs2 *args = wasm_runtime_malloc(sizeof(*args));
|
||||
if (args == NULL) {
|
||||
return false;
|
||||
}
|
||||
instantiation_args_set_defaults(args);
|
||||
*p = args;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
wasm_runtime_instantiation_args_destroy(struct InstantiationArgs2 *p)
|
||||
{
|
||||
wasm_runtime_free(p);
|
||||
}
|
||||
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_default_stack_size(
|
||||
struct InstantiationArgs2 *p, uint32 v)
|
||||
{
|
||||
p->v1.default_stack_size = v;
|
||||
}
|
||||
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_host_managed_heap_size(
|
||||
struct InstantiationArgs2 *p, uint32 v)
|
||||
{
|
||||
p->v1.host_managed_heap_size = v;
|
||||
}
|
||||
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_max_memory_pages(
|
||||
struct InstantiationArgs2 *p, uint32 v)
|
||||
{
|
||||
p->v1.max_memory_pages = v;
|
||||
}
|
||||
|
||||
WASMModuleInstanceCommon *
|
||||
wasm_runtime_instantiate_ex2(WASMModuleCommon *module,
|
||||
const struct InstantiationArgs2 *args,
|
||||
char *error_buf, uint32 error_buf_size)
|
||||
{
|
||||
return wasm_runtime_instantiate_internal(
|
||||
module, NULL, NULL, args->default_stack_size,
|
||||
args->host_managed_heap_size, args->max_memory_pages, error_buf,
|
||||
module, NULL, NULL, args->v1.default_stack_size,
|
||||
args->v1.host_managed_heap_size, args->v1.max_memory_pages, error_buf,
|
||||
error_buf_size);
|
||||
}
|
||||
|
||||
|
|
|
@ -612,6 +612,10 @@ WASMExecEnv *
|
|||
wasm_runtime_get_exec_env_tls(void);
|
||||
#endif
|
||||
|
||||
struct InstantiationArgs2 {
|
||||
InstantiationArgs v1;
|
||||
};
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_init(void);
|
||||
|
@ -700,6 +704,40 @@ wasm_runtime_instantiate_ex(WASMModuleCommon *module,
|
|||
const InstantiationArgs *args, char *error_buf,
|
||||
uint32 error_buf_size);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
bool
|
||||
wasm_runtime_instantiation_args_create(struct InstantiationArgs2 **p);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_destroy(struct InstantiationArgs2 *p);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_default_stack_size(
|
||||
struct InstantiationArgs2 *p, uint32 v);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_host_managed_heap_size(
|
||||
struct InstantiationArgs2 *p, uint32 v);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_max_memory_pages(
|
||||
struct InstantiationArgs2 *p, uint32 v);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon *
|
||||
wasm_runtime_instantiate_ex2(WASMModuleCommon *module,
|
||||
const struct InstantiationArgs2 *args,
|
||||
char *error_buf, uint32 error_buf_size);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_set_running_mode(wasm_module_inst_t module_inst,
|
||||
|
|
|
@ -289,6 +289,8 @@ typedef struct InstantiationArgs {
|
|||
} InstantiationArgs;
|
||||
#endif /* INSTANTIATION_ARGS_OPTION_DEFINED */
|
||||
|
||||
struct InstantiationArgs2;
|
||||
|
||||
#ifndef WASM_VALKIND_T_DEFINED
|
||||
#define WASM_VALKIND_T_DEFINED
|
||||
typedef uint8_t wasm_valkind_t;
|
||||
|
@ -733,6 +735,46 @@ wasm_runtime_instantiate_ex(const wasm_module_t module,
|
|||
const InstantiationArgs *args, char *error_buf,
|
||||
uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
* Create an InstantiationArgs2 object with default parameters.
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_instantiation_args_create(struct InstantiationArgs2 **p);
|
||||
|
||||
/**
|
||||
* Dispose an InstantiationArgs2 object.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_destroy(struct InstantiationArgs2 *p);
|
||||
|
||||
/**
|
||||
* Setter functions for the InstantiationArgs2 object.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_default_stack_size(
|
||||
struct InstantiationArgs2 *p, uint32_t v);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_host_managed_heap_size(
|
||||
struct InstantiationArgs2 *p, uint32_t v);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_instantiation_args_set_max_memory_pages(
|
||||
struct InstantiationArgs2 *p, uint32_t v);
|
||||
|
||||
/**
|
||||
* Instantiate a WASM module, with specified instantiation arguments
|
||||
*
|
||||
* Same as wasm_runtime_instantiate_ex, but this version takes
|
||||
* InstantiationArgs2, which can be extended without breaking the ABI.
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
|
||||
wasm_runtime_instantiate_ex2(const wasm_module_t module,
|
||||
const struct InstantiationArgs2 *args,
|
||||
char *error_buf, uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
* Set the running mode of a WASM module instance, override the
|
||||
* default running mode of the runtime. Note that it only makes sense when
|
||||
|
|
|
@ -400,7 +400,8 @@ check_array_type(const WASMModule *module, uint32 type_index, char *error_buf,
|
|||
error_buf_size)) {
|
||||
return false;
|
||||
}
|
||||
if (module->types[type_index]->type_flag != WASM_TYPE_ARRAY) {
|
||||
if (module->types[type_index] == NULL
|
||||
|| module->types[type_index]->type_flag != WASM_TYPE_ARRAY) {
|
||||
set_error_buf(error_buf, error_buf_size, "unknown array type");
|
||||
return false;
|
||||
}
|
||||
|
@ -423,7 +424,8 @@ check_function_type(const WASMModule *module, uint32 type_index,
|
|||
}
|
||||
|
||||
#if WASM_ENABLE_GC != 0
|
||||
if (module->types[type_index]->type_flag != WASM_TYPE_FUNC) {
|
||||
if (module->types[type_index] == NULL
|
||||
|| module->types[type_index]->type_flag != WASM_TYPE_FUNC) {
|
||||
set_error_buf(error_buf, error_buf_size, "unknown function type");
|
||||
return false;
|
||||
}
|
||||
|
@ -1255,8 +1257,9 @@ load_init_expr(WASMModule *module, const uint8 **p_buf, const uint8 *buf_end,
|
|||
error_buf_size)) {
|
||||
goto fail;
|
||||
}
|
||||
if (module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
if (module->types[type_idx] == NULL
|
||||
|| module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unknown struct type");
|
||||
goto fail;
|
||||
|
@ -2303,9 +2306,14 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
|
|||
total_size = new_total_size;
|
||||
}
|
||||
|
||||
LOG_VERBOSE("Processing rec group [%d-%d]",
|
||||
processed_type_count,
|
||||
processed_type_count + rec_count - 1);
|
||||
if (rec_count < 1) {
|
||||
LOG_VERBOSE("Processing 0-entry rec group");
|
||||
}
|
||||
else {
|
||||
LOG_VERBOSE("Processing rec group [%d-%d]",
|
||||
processed_type_count,
|
||||
processed_type_count + rec_count - 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
p--;
|
||||
|
@ -12677,7 +12685,9 @@ re_scan:
|
|||
error_buf, error_buf_size)) {
|
||||
goto fail;
|
||||
}
|
||||
if (module->types[type_idx1]->type_flag != WASM_TYPE_FUNC) {
|
||||
if (module->types[type_idx1] == NULL
|
||||
|| module->types[type_idx1]->type_flag
|
||||
!= WASM_TYPE_FUNC) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unknown function type");
|
||||
goto fail;
|
||||
|
@ -12694,7 +12704,9 @@ re_scan:
|
|||
error_buf, error_buf_size)) {
|
||||
goto fail;
|
||||
}
|
||||
if (module->types[type_idx]->type_flag != WASM_TYPE_FUNC) {
|
||||
if (module->types[type_idx] == NULL
|
||||
|| module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_FUNC) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unknown function type");
|
||||
goto fail;
|
||||
|
@ -14533,8 +14545,9 @@ re_scan:
|
|||
error_buf_size)) {
|
||||
goto fail;
|
||||
}
|
||||
if (module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
if (module->types[type_idx] == NULL
|
||||
|| module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unknown struct type");
|
||||
goto fail;
|
||||
|
@ -14620,8 +14633,9 @@ re_scan:
|
|||
error_buf_size)) {
|
||||
goto fail;
|
||||
}
|
||||
if (module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
if (module->types[type_idx] == NULL
|
||||
|| module->types[type_idx]->type_flag
|
||||
!= WASM_TYPE_STRUCT) {
|
||||
set_error_buf(error_buf, error_buf_size,
|
||||
"unknown struct type");
|
||||
goto fail;
|
||||
|
|
|
@ -541,10 +541,10 @@ getaddrinfo(const char *node, const char *service, const struct addrinfo *hints,
|
|||
}
|
||||
} while (max_info_size > addr_info_size);
|
||||
|
||||
addr_info_size = max_info_size;
|
||||
if (addr_info_size == 0) {
|
||||
free(addr_info);
|
||||
*res = NULL;
|
||||
return __WASI_ERRNO_SUCCESS;
|
||||
HANDLE_ERROR(__WASI_ERRNO_NOENT)
|
||||
}
|
||||
|
||||
aibuf_res =
|
||||
|
@ -556,10 +556,6 @@ getaddrinfo(const char *node, const char *service, const struct addrinfo *hints,
|
|||
|
||||
*res = &aibuf_res[0].ai;
|
||||
|
||||
if (addr_info_size) {
|
||||
addr_info_size = max_info_size;
|
||||
}
|
||||
|
||||
for (i = 0; i < addr_info_size; i++) {
|
||||
struct addrinfo *ai = &aibuf_res[i].ai;
|
||||
ai->ai_addr = (struct sockaddr *)&aibuf_res[i].sa;
|
||||
|
@ -610,6 +606,7 @@ get_sol_socket_option(int sockfd, int optname, void *__restrict optval,
|
|||
uint64_t timeout_us;
|
||||
bool is_linger_enabled;
|
||||
int linger_s;
|
||||
__wasi_fdstat_t sb;
|
||||
|
||||
switch (optname) {
|
||||
case SO_RCVTIMEO:
|
||||
|
@ -662,6 +659,22 @@ get_sol_socket_option(int sockfd, int optname, void *__restrict optval,
|
|||
error = __wasi_sock_get_broadcast(sockfd, (bool *)optval);
|
||||
HANDLE_ERROR(error);
|
||||
return error;
|
||||
case SO_TYPE:
|
||||
assert(*optlen == sizeof(int));
|
||||
error = __wasi_fd_fdstat_get(sockfd, &sb);
|
||||
HANDLE_ERROR(error);
|
||||
switch (sb.fs_filetype) {
|
||||
case __WASI_FILETYPE_SOCKET_DGRAM:
|
||||
*(int *)optval = SOCK_DGRAM;
|
||||
break;
|
||||
case __WASI_FILETYPE_SOCKET_STREAM:
|
||||
*(int *)optval = SOCK_STREAM;
|
||||
break;
|
||||
default:
|
||||
errno = __WASI_ERRNO_NOTSOCK;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
default:
|
||||
error = __WASI_ERRNO_NOTSUP;
|
||||
HANDLE_ERROR(error);
|
||||
|
|
|
@ -373,8 +373,8 @@ is_addrinfo_supported(struct addrinfo *info)
|
|||
(info->ai_family == AF_INET || info->ai_family == AF_INET6)
|
||||
// Allow only UDP and TCP
|
||||
&& (info->ai_socktype == SOCK_DGRAM || info->ai_socktype == SOCK_STREAM)
|
||||
&& (info->ai_protocol == IPPROTO_TCP
|
||||
|| info->ai_protocol == IPPROTO_UDP);
|
||||
&& (info->ai_protocol == IPPROTO_TCP || info->ai_protocol == IPPROTO_UDP
|
||||
|| info->ai_protocol == 0);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -59,7 +59,7 @@ b_memcpy_wa(void *s1, unsigned int s1max, const void *s2, unsigned int n)
|
|||
*dest++ = *p_byte_read++;
|
||||
}
|
||||
}
|
||||
/* read meaning word(s) */
|
||||
/* read remaining word(s) */
|
||||
else {
|
||||
if ((char *)p + 4 >= src + n) {
|
||||
for (ps = (char *)p; ps < src + n; ps++) {
|
||||
|
|
|
@ -170,7 +170,7 @@ bh_free_msg(bh_queue_node *msg)
|
|||
return;
|
||||
}
|
||||
|
||||
// note: sometime we just use the payload pointer for a integer value
|
||||
// note: sometimes we just use the payload pointer for an integer value
|
||||
// len!=0 is the only indicator about the body is an allocated buffer.
|
||||
if (msg->body && msg->len)
|
||||
bh_queue_free(msg->body);
|
||||
|
|
|
@ -44,22 +44,22 @@ bh_get_tick_ms()
|
|||
uint32
|
||||
bh_get_elpased_ms(uint32 *last_system_clock)
|
||||
{
|
||||
uint32 elpased_ms;
|
||||
/* attention: the bh_get_tick_ms() return 64 bits integer, but
|
||||
the bh_get_elpased_ms() is designed to use 32 bits clock count */
|
||||
uint32 elapsed_ms;
|
||||
/* attention: the bh_get_tick_ms() returns a 64-bit integer, but
|
||||
bh_get_elpased_ms() is designed to use a 32-bit clock count */
|
||||
uint32 now = (uint32)bh_get_tick_ms();
|
||||
|
||||
/* system clock overrun */
|
||||
if (now < *last_system_clock) {
|
||||
PRINT("system clock overrun!\n");
|
||||
elpased_ms = now + (UINT32_MAX - *last_system_clock) + 1;
|
||||
elapsed_ms = now + (UINT32_MAX - *last_system_clock) + 1;
|
||||
}
|
||||
else {
|
||||
elpased_ms = now - *last_system_clock;
|
||||
elapsed_ms = now - *last_system_clock;
|
||||
}
|
||||
|
||||
*last_system_clock = now;
|
||||
return elpased_ms;
|
||||
return elapsed_ms;
|
||||
}
|
||||
|
||||
static app_timer_t *
|
||||
|
@ -162,7 +162,7 @@ reschedule_timer(timer_ctx_t ctx, app_timer_t *timer)
|
|||
prev->id);
|
||||
}
|
||||
else {
|
||||
/* insert at the begin */
|
||||
/* insert at the beginning */
|
||||
bh_assert(ctx->app_timers == NULL);
|
||||
ctx->app_timers = timer;
|
||||
PRINT("rescheduled timer [%d] as first\n", timer->id);
|
||||
|
@ -213,7 +213,7 @@ release_timer_list(app_timer_t **p_list)
|
|||
|
||||
timer_ctx_t
|
||||
create_timer_ctx(timer_callback_f timer_handler,
|
||||
check_timer_expiry_f expiery_checker, int prealloc_num,
|
||||
check_timer_expiry_f expiry_checker, int prealloc_num,
|
||||
unsigned int owner)
|
||||
{
|
||||
timer_ctx_t ctx = (timer_ctx_t)BH_MALLOC(sizeof(struct _timer_ctx));
|
||||
|
@ -225,7 +225,7 @@ create_timer_ctx(timer_callback_f timer_handler,
|
|||
|
||||
ctx->timer_callback = timer_handler;
|
||||
ctx->pre_allocated = prealloc_num;
|
||||
ctx->refresh_checker = expiery_checker;
|
||||
ctx->refresh_checker = expiry_checker;
|
||||
ctx->owner = owner;
|
||||
|
||||
while (prealloc_num > 0) {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
/* clang-format off */
|
||||
#define WAMR_VERSION_MAJOR 2
|
||||
#define WAMR_VERSION_MINOR 3
|
||||
#define WAMR_VERSION_PATCH 1
|
||||
#define WAMR_VERSION_MINOR 4
|
||||
#define WAMR_VERSION_PATCH 0
|
||||
/* clang-format on */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -596,6 +596,7 @@ main(int argc, char *argv[])
|
|||
wasm_module_inst_t wasm_module_inst = NULL;
|
||||
RunningMode running_mode = 0;
|
||||
RuntimeInitArgs init_args;
|
||||
struct InstantiationArgs2 *inst_args;
|
||||
char error_buf[128] = { 0 };
|
||||
#if WASM_ENABLE_LOG != 0
|
||||
int log_verbose_level = 2;
|
||||
|
@ -949,10 +950,20 @@ main(int argc, char *argv[])
|
|||
libc_wasi_init(wasm_module, argc, argv, &wasi_parse_ctx);
|
||||
#endif
|
||||
|
||||
if (!wasm_runtime_instantiation_args_create(&inst_args)) {
|
||||
printf("failed to create instantiate args\n");
|
||||
goto fail3;
|
||||
}
|
||||
wasm_runtime_instantiation_args_set_default_stack_size(inst_args,
|
||||
stack_size);
|
||||
wasm_runtime_instantiation_args_set_host_managed_heap_size(inst_args,
|
||||
heap_size);
|
||||
|
||||
/* instantiate the module */
|
||||
if (!(wasm_module_inst =
|
||||
wasm_runtime_instantiate(wasm_module, stack_size, heap_size,
|
||||
error_buf, sizeof(error_buf)))) {
|
||||
wasm_module_inst = wasm_runtime_instantiate_ex2(
|
||||
wasm_module, inst_args, error_buf, sizeof(error_buf));
|
||||
wasm_runtime_instantiation_args_destroy(inst_args);
|
||||
if (!wasm_module_inst) {
|
||||
printf("%s\n", error_buf);
|
||||
goto fail3;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
"argument": "",
|
||||
"expected return": {
|
||||
"ret code": 255,
|
||||
"stdout content": "WASM module load failed: END opcode expected",
|
||||
"stdout content": "WASM module load failed: unexpected end opcodes from unbalanced control flow structures",
|
||||
"description": "no sanitizer 'Heap Buffer Overflow'"
|
||||
}
|
||||
},
|
||||
|
@ -979,7 +979,7 @@
|
|||
"argument": "",
|
||||
"expected return": {
|
||||
"ret code": 255,
|
||||
"stdout content": "WASM module load failed: unexpected end of section or function",
|
||||
"stdout content": "WASM module load failed: section size mismatch: function body END opcode expected",
|
||||
"description": "no 'Heap out of bound read of size 1 in wasm_loader_prepare_bytecode function'"
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user