Skip to content
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

winch: Ensure correct handling of libcalls #7949

Merged

Conversation

saulecabrera
Copy link
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
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
Copy link

Subscribe to Label Action

cc @saulecabrera

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
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
19 checks passed
@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.

None yet

2 participants