-
Notifications
You must be signed in to change notification settings - Fork 346
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
Unaligned error with async generator field #1919
Comments
Thanks to @jorgecarleitao for reporting the UB error to the security response team! We decided that this didn't need to be kept under embargo. |
Originally appeared when running MIRI checks over this PR: jorgecarleitao/arrow2#620. |
Thanks for the report! The span looks indeed strange, but that might be cause by the underlying MIR (produced by the
That agrees with what Miri sees -- the alignment must be 2. But Miri says the actual alignment of the pointer used here is just 1, and hence it raises an error. The first thing to figure out would be which exact MIR operation is causing the failure -- from the span it is not clear which data is insufficiently aligned and where the pointer to that data comes from. This will require running Miri locally with |
This is the MIR operation that causes the failure:
So it looks like the field I am not sure what is the best way to figure out the generator type that rustc created here and check if its alignment information makes sense. Cc @tmandry @wesleywiser |
#1925 found the same bug in non-async code, which finally put me on the right track to figure out what is going on. It is indeed a Miri bug, sorry for that! rust-lang/rust#91303 should fix it. |
The following code in the playground reports a Miri error:
error notes
I believe Miri is wrong here, but I don't really know how it represents async code.
When I look at the LLVM IR, I see a
memset(i8* align 2 ...)
for thismarker
within the generatorSuspend0
state. That alignment comes fromPlaceRef::project_field
'seffective_field_align
, because the struct has alignment 8 and the field is at offset 42, so the field will always be at alignment 2.You can also bump this around in the example by changing the
data
length. At 2,marker
moves to offset 43 and alignment 1, and miri is happy. At 3 we get offset 44 and alignment 4, and at 7 we get offset 48 and alignment 8, both miri errors.So it seems Miri is seeing the projection alignment, but from the error span it looks like it may be applying that requirement to the initialization value?
The text was updated successfully, but these errors were encountered: