Skip to content

Merge main branch into dev/shared_heap#4355

Closed
lum1n0us wants to merge 207 commits intodev/shared_heapfrom
main
Closed

Merge main branch into dev/shared_heap#4355
lum1n0us wants to merge 207 commits intodev/shared_heapfrom
main

Conversation

@lum1n0us
Copy link
Copy Markdown
Contributor

No description provided.

Georgii Rylov and others added 30 commits January 17, 2025 16:16
Rust compiler previously deprecated, and now removed the wasm32-wasi target and replaced it with wasm32-wasip1. This
change updates all the occurrences of wasm32-wasi in the context of Rust compilation.

covers the wasi-nn/test.
- Add AOT module validation to ensure memory constraints are met
- Enable AOT validator in build configuration and update related source files
- add default build configuration options and enhance message output for WAMR features
- Add Wasm proposal status printing functionality
- Enhance wasm mutator fuzz tests by adding export function execution and random value generation
- Use --fuel to limit  loop size
- Use predefined values and enhance argument logging in execution
…es (#4064)

fix enlarge 65536 pages conversion overflow in wasm32
lum1n0us and others added 26 commits May 30, 2025 07:42
> **Fix a release-blocking issue**

---

Like:
```
vmlib.lib(blocking_op.obj) : error LNK2019: unresolved external symbol
__imp_wasm_runtime_begin_blocking_op referenced in function
blocking_op_close
[D:\a\wasm-micro-runtime\wasm-micro-runtime\wamr-compiler\build\wamrc.vcxproj]
vmlib.lib(blocking_op.obj) : error LNK2019: unresolved external symbol
__imp_wasm_runtime_end_blocking_op referenced in function
blocking_op_close
[D:\a\wasm-micro-runtime\wasm-micro-runtime\wamr-compiler\build\wamrc.vcxproj]
```
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](ossf/scorecard-action@f49aabe...05b42c6)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4309)

it seems meaningless and quite confusing to access a table with
two aliases ("lookup" and "backends") within a function.

no functional changes are intended.
sync with a more appropriate version of the definitions.

as we use the "wasi_ephemeral_nn", which is p1-based, it seems
more appropriate to use definitions from witx, not wit.

it's a bit unfortunate p2-based wasi-nn made gratuitous changes
like this from p1.

note: this is an ABI change.
this would avoid potential issues when multiple instances happen to
make an attempt to load a backend at the same time.

Fixes: #4314
…4321)

By default, zip follows symbolic links and includes the actual files
or directories they point to in the archive.
Use a minimum manifest to reduce time consumption
* this enum is (@WitX tag u8) in witx
* it seems that some wasm modules actually use non-zero padding
  and cause errors
* it's a bad practice to use C enum for ABI description anyway
- wasi_nn.h: make this compatible with wasi_ephemeral_nn
cf. #4323

- fix WASM_ENABLE_WASI_EPHEMERAL_NN build
this structure is used by host logic as well.
ideally definitions for wasm and host should be separated.
until it happens, check __wasm__ to avoid the breakage.
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.18 to 3.28.19.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](github/codeql-action@v3.28.18...v3.28.19)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@github-advanced-security
Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

* but if GC is enabled, we need to check the type flag
*/
static bool
check_function_type(const WASMModule *module, uint32 type_index,

Check notice

Code scanning / CodeQL

Unused static function Note

Static function check_function_type is unreachable (
wasm_loader_prepare_bytecode
must be removed at the same time)
Static function check_function_type is unreachable (
load_import_section
must be removed at the same time)
Static function check_function_type is unreachable (
load_function_section
must be removed at the same time)
Static function check_function_type is unreachable (
load_function_import
must be removed at the same time)
Static function check_function_type is unreachable (
load
must be removed at the same time)
Static function check_function_type is unreachable (
load_from_sections
must be removed at the same time)

Copilot Autofix

AI 10 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

}

static int
cmp_v128_const(const void *p_v128_const1, const void *p_v128_const2)

Check notice

Code scanning / CodeQL

Unused static function Note

Static function cmp_v128_const is unreachable (
wasm_loader_prepare_bytecode
must be removed at the same time)
Static function cmp_v128_const is unreachable (
wasm_loader_get_const_offset
must be removed at the same time)
Static function cmp_v128_const is unreachable (
load
must be removed at the same time)
Static function cmp_v128_const is unreachable (
load_from_sections
must be removed at the same time)

Copilot Autofix

AI 10 months ago

To fix the issue, the unused static function cmp_v128_const should be removed from the file. Additionally, the alert indicates that wasm_loader_prepare_bytecode must also be removed, as it is similarly unused. Care should be taken to ensure that no dependencies or references to these functions exist elsewhere in the file or project.

Steps to implement the fix:

  1. Remove the definition of cmp_v128_const (lines 9644–9651).
  2. Remove the definition of wasm_loader_prepare_bytecode (lines 11262–11281).
  3. Verify that no other code in the file or project depends on these functions.

Suggested changeset 1
core/iwasm/interpreter/wasm_loader.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c
--- a/core/iwasm/interpreter/wasm_loader.c
+++ b/core/iwasm/interpreter/wasm_loader.c
@@ -9643,10 +9643,3 @@
 
-static int
-cmp_v128_const(const void *p_v128_const1, const void *p_v128_const2)
-{
-    V128 v128_const1 = *(V128 *)p_v128_const1;
-    V128 v128_const2 = *(V128 *)p_v128_const2;
 
-    return memcmp(&v128_const1, &v128_const2, sizeof(V128));
-}
 
@@ -11261,22 +11254,3 @@
 
-static bool
-wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
-                             uint32 cur_func_idx, char *error_buf,
-                             uint32 error_buf_size)
-{
-    uint8 *p = func->code, *p_end = func->code + func->code_size, *p_org;
-    uint32 param_count, local_count, global_count;
-    uint8 *param_types, *local_types, local_type, global_type, mem_offset_type,
-        table_elem_idx_type;
-    BlockType func_block_type;
-    uint16 *local_offsets, local_offset;
-    uint32 type_idx, func_idx, local_idx, global_idx, table_idx;
-    uint32 table_seg_idx, data_seg_idx, count, align, i;
-    mem_offset_t mem_offset;
-    int32 i32_const = 0;
-    int64 i64_const;
-    uint8 opcode;
-    bool return_value = false;
-    WASMLoaderContext *loader_ctx;
-    BranchBlock *frame_csp_tmp;
+
 #if WASM_ENABLE_GC != 0
EOF
@@ -9643,10 +9643,3 @@

static int
cmp_v128_const(const void *p_v128_const1, const void *p_v128_const2)
{
V128 v128_const1 = *(V128 *)p_v128_const1;
V128 v128_const2 = *(V128 *)p_v128_const2;

return memcmp(&v128_const1, &v128_const2, sizeof(V128));
}

@@ -11261,22 +11254,3 @@

static bool
wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
uint32 cur_func_idx, char *error_buf,
uint32 error_buf_size)
{
uint8 *p = func->code, *p_end = func->code + func->code_size, *p_org;
uint32 param_count, local_count, global_count;
uint8 *param_types, *local_types, local_type, global_type, mem_offset_type,
table_elem_idx_type;
BlockType func_block_type;
uint16 *local_offsets, local_offset;
uint32 type_idx, func_idx, local_idx, global_idx, table_idx;
uint32 table_seg_idx, data_seg_idx, count, align, i;
mem_offset_t mem_offset;
int32 i32_const = 0;
int64 i64_const;
uint8 opcode;
bool return_value = false;
WASMLoaderContext *loader_ctx;
BranchBlock *frame_csp_tmp;

#if WASM_ENABLE_GC != 0
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
#include "../common/libc_wasi.c"
#endif

#include "../common/wasm_proposal.c"

Check notice

Code scanning / CodeQL

Include header files only Note

The #include pre-processor directive should only be used to include header files.

Copilot Autofix

AI 8 months ago

To fix this problem, the code should not include the .c source file directly. Instead, the declarations (function prototypes, types, etc.) from wasm_proposal.c should be moved to a new header file, for example, wasm_proposal.h. The source file wasm_proposal.c should then be compiled separately and linked as part of the build process. In main.c, replace #include "../common/wasm_proposal.c" with #include "../common/wasm_proposal.h". This change should be made only in the code shown (i.e., in main.c), and assumes that the build system will be updated to compile wasm_proposal.c as a separate compilation unit.


Suggested changeset 1
product-mini/platforms/posix/main.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/product-mini/platforms/posix/main.c b/product-mini/platforms/posix/main.c
--- a/product-mini/platforms/posix/main.c
+++ b/product-mini/platforms/posix/main.c
@@ -18,7 +18,7 @@
 #include "../common/libc_wasi.c"
 #endif
 
-#include "../common/wasm_proposal.c"
+#include "../common/wasm_proposal.h"
 
 #if BH_HAS_DLFCN
 #include <dlfcn.h>
EOF
@@ -18,7 +18,7 @@
#include "../common/libc_wasi.c"
#endif

#include "../common/wasm_proposal.c"
#include "../common/wasm_proposal.h"

#if BH_HAS_DLFCN
#include <dlfcn.h>
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.28.8
uses: github/codeql-action/init@v3.28.19

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.28.8
uses: github/codeql-action/analyze@v3.28.19

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help

- name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v3.28.8
uses: github/codeql-action/upload-sarif@v3.28.19

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}
steps:
- name: checkout
uses: actions/checkout@v4

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
# it is hard to use `format` to assemble the cache key
- name: Get LLVM libraries
id: retrieve_llvm_libs
uses: actions/cache@v4

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: GitHub-owned GitHubAction not pinned by hash
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help

# hadolint ignore=DL3013
RUN pip3 install --no-cache-dir west && west init -m https://github.com/zephyrproject-rtos/zephyr --mr v3.5.0 /root/zephyrproject
RUN pip3 install --no-cache-dir west

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: pipCommand not pinned by hash
Click Remediation section below to solve this issue
WORKDIR /root
RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime.git
WORKDIR /root/zephyrproject/modules/zephyr
RUN west zephyr-export && pip install --no-cache-dir -r ./scripts/requirements.txt

Check warning

Code scanning / Scorecard

Pinned-Dependencies Medium

score is 0: pipCommand not pinned by hash
Click Remediation section below to solve this issue
@lum1n0us lum1n0us closed this Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.