-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix global initialization #3905
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sjamesr
requested review from
loganek,
lum1n0us,
no1wudi,
wenyongh,
xujuntwt95329 and
yamt
as code owners
November 12, 2024 06:27
While resolving linked globals in multi-module mode, WAMR tries to copy the linked global's initial value into the destination global in the current module. However, a bug in the implementation causes the copy to be done from the InitializerExpression struct, not from its WASMValue field. This did not come up in WAMR's spec test runner because those are built with WASM_ENABLE_SPEC_TEST, which means these globals are resolved as builtins, not linked globals, which goes through a different (presumably not faulty) path.
sjamesr
force-pushed
the
fix_incorrect_memcpy
branch
from
November 12, 2024 06:33
a665c57
to
a83adfe
Compare
lum1n0us
approved these changes
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice catch.
Thank you! I won't lie, it took a good day of debugging to figure this one out. 😄 |
xujuntwt95329
approved these changes
Nov 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
no1wudi
approved these changes
Nov 13, 2024
lum1n0us
added a commit
that referenced
this pull request
Nov 20, 2024
* Exclude fuzz test python and npm packages in scoreboard scan (#3871) * Fix out of bounds issues after memory.grow on non-aot non-threads builds (#3872) * fix(ios): Remove `float-abi` flag (#3889) * build(deps): bump github/codeql-action from 3.26.13 to 3.27.0 (#3888) * Refine looking up aot function with index (#3882) * Bump AOT_CURRENT_VERSION for WAMR 2.x (gc, memory64) (#3880) * Fix mmap flags for AOT loader on non-Linux SGX platforms (#3890) * Fix out of bounds issue in is_native_addr_in_shared_heap function (#3886) * Refactor AOT loader to support compatible versions (#3891) * Wasm loader enhancement: check code size in code entry (#3892) * Fix linked global initialization in multimodule (#3905) * build(deps): bump github/codeql-action from 3.27.0 to 3.27.1 (#3902) * GlobalValueSet was moved to IRPartitionLayer recently, but we have a local definition anyway (#3899) * Fix a leak in wasm_loader_emit_br_info (#3900) * Correct the table index calculation in aot_instantiation (#3903) * build(deps): bump github/codeql-action from 3.27.1 to 3.27.4 (#3912) * Support external toolchain on Windows for aot compiler (#3911) * Fix CI wamr-ide error (#3913) Co-authored-by: TianlongLiang <[email protected]> Co-authored-by: Maks Litskevich <[email protected]> Co-authored-by: Deniz Sokmen <[email protected]> Co-authored-by: edoardo <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: YAMAMOTO Takashi <[email protected]> Co-authored-by: liang.he <[email protected]> Co-authored-by: Fadumina Barre <[email protected]> Co-authored-by: Marcin Kolny <[email protected]> Co-authored-by: James Ring <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While resolving linked globals, WAMR tries to copy the linked global's initial value into the destination global in the current module. However, a bug in the implementation causes the copy to be done from the InitializerExpression struct, not from its WASMValue field.
This did not come up in WAMR's spec test runner because those are built with WASM_ENABLE_SPEC_TEST, which means these globals are resolved as builtins, not linked globals, which goes through a different (presumably not faulty) path.