-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
x64: Segfaulting rip-relative load due to misalignment #4812
Comments
When I run the test case I get the following output:
|
Oh you know it was probably something to do with In that case yeah it looks like this is fixed locally so I'll close. |
According to oss-fuzz the original test case here still crashes and trying again locally I'm able to reproduce:
with testcase42.wasm.gz as an input. This is probably related to the |
Oh and to log, the reproduction for me locally is on 1a59b3e which should be |
It's definitely coming from the
|
Add a function_alignment function to the TargetIsa trait, and use it to align functions when generating objects. Additionally, collect the maximum alignment required for pc-relative constants in functions and pass that value out. Use the max of these two values when padding functions for alignment. This fixes a bug on x86_64 where rip-relative loads to sse registers could cause a segfault, as functions weren't always guaranteed to be aligned to 16-byte addresses. Fixes #4812
Local bisection points to #4730 for this issue but that seems like it may also be just as likely to expose a preexisting issue. Reproducing this is somewhat nontrivial and
wasm-tools shrink
was pretty unsuccessful on this test case.Using this input test case on an x86_64 machine this crash can be reproduced with:
Note that this reproduction is quite specific to layout of code and the various options enabled here are all required with the input wasm above.
cc @elliottt
The text was updated successfully, but these errors were encountered: