Fix swapped arguments in ThreadNewIndirect trampoline#13054
Open
shumbo wants to merge 2 commits intobytecodealliance:mainfrom
Open
Fix swapped arguments in ThreadNewIndirect trampoline#13054shumbo wants to merge 2 commits intobytecodealliance:mainfrom
shumbo wants to merge 2 commits intobytecodealliance:mainfrom
Conversation
4dedf58 to
6162737
Compare
This file contains hidden or 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
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.
Summary
ThreadNewIndirecttrampoline incrates/cranelift/src/compiler/component.rswherestart_func_table_idxandstart_func_ty_idxwere passed to the hostthread_new_indirectlibcall in the wrong orderfunc_ty_idbeforefunc_table_idx, but the trampoline pushed them in the opposite order, causing the runtime to resolve functions from the wrong table when multiple tables are in usethread.new-indirecttargeting an empty tableDetails
The bug was invisible in the common single-table case where both indices are 0. With multiple tables, the swapped indices cause the runtime to look up a function in the wrong table instead of trapping.
The fix swaps the two
params.pushcalls to match the expected parameter order in thethread_new_indirecthost function signature defined incrates/environ/src/component.rs.