Skip to content

winch: Ensure correct handling of libcalls#7949

Merged
saulecabrera merged 1 commit into
bytecodealliance:mainfrom
saulecabrera:fix-fuzz-bug-libcalls
Feb 16, 2024
Merged

winch: Ensure correct handling of libcalls#7949
saulecabrera merged 1 commit into
bytecodealliance:mainfrom
saulecabrera:fix-fuzz-bug-libcalls

Conversation

@saulecabrera
Copy link
Copy Markdown
Member

This commit fixes a fuzz bug where modules involving known libcalls would fail to compile given that they were unconditionally treated as colocated libcalls.

This bug is only reproducible in non sse41 environments, given that some operations like floor default to libcalls in this case. The use_colocated_libcalls setting is not configurable within Wasmtime and as such, they should be loaded into a register prior to emitting the call. This will also ensure that the right 8-byte absolute relocation is used.

@saulecabrera saulecabrera requested a review from a team as a code owner February 15, 2024 21:08
@saulecabrera saulecabrera requested review from elliottt and removed request for a team February 15, 2024 21:08
@saulecabrera
Copy link
Copy Markdown
Member Author

I'm unsure if there's an additional way to test this one aside from the filetests.

@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator winch Winch issues or pull requests labels Feb 15, 2024
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @saulecabrera

Details This issue or pull request has been labeled: "cranelift", "winch"

Thus the following users have been cc'd because of the following labels:

  • saulecabrera: winch

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

This commit fixes a fuzz bug where modules involving known libcalls
would fail to compile given that they were unconditionally treated as
colocated libcalls.

This bug is only reproducible in non sse41 environments, given that some
operations like `floor` default to libcalls in this case. The
`use_colocated_libcalls` setting is not configurable within Wasmtime and
as such, they should be loaded into a register prior to emitting the
call. This will also ensure that the right 8-byte absolute relocation is
used.
Copy link
Copy Markdown
Member

@elliottt elliottt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! As far as testing goes, this was caught by fuzzing so I think we're good. We could always look into running some of the spec tests with different codegen configurations, but that probably still won't catch as much as fuzzing will.

@saulecabrera saulecabrera added this pull request to the merge queue Feb 16, 2024
Merged via the queue into bytecodealliance:main with commit d65f002 Feb 16, 2024
@saulecabrera saulecabrera deleted the fix-fuzz-bug-libcalls branch February 16, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift Issues related to the Cranelift code generator winch Winch issues or pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants