-
Notifications
You must be signed in to change notification settings - Fork 372
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
better diagnostics for Tree Borrows + int2ptr casts #3766
Conversation
@bors r+ |
better diagnostics for Tree Borrows + int2ptr casts - Entirely reject `-Zmiri-permissive-provenance -Zmiri-tree-borrows` since that combination just doesn't work - In the int2ptr cast warning, when Tree Borrows is enabled, do not recommend `-Zmiri-permissive-provenance`, instead note that Tree Borrows does not support int2ptr casts Fixes #3764
💔 Test failed - checks-actions |
4cee511
to
8bbd757
Compare
8bbd757
to
6f8dc27
Compare
@bors r+ |
☀️ Test successful - checks-actions |
Also, is there a way to suppress the |
Not really -- since Tree Borrows doesn't support int2ptr casts, not showing the warning seems hazardous. Now that I understand that your original issue was unrelated, we could possibly partially revert this PR -- but it is still the case that Tree Borrows + int2ptr will miss a lot of UB (even more so than usual for int2ptr), and I am not sure how to best communicate that to users. The warning should be shown only once. Is it so bad that it needs to be hidden? |
@RalfJung I see, and it makes complete sense. Actually, I've been hunting a bunch of bugs down and the int-to-ptr cast warnings filled the logs making it hard to find the actual error (which in one case was an unaligned read)...because we use them excessively for storing extra pointer metadata using alignment hacks; that's why I was wondering if there was a way around it. Also, since we use |
FWIW this can be done without int2ptr casts using strict provenance APIs, but that currently requires either nightly or using the sptr crate. |
-Zmiri-permissive-provenance -Zmiri-tree-borrows
since that combination just doesn't work-Zmiri-permissive-provenance
, instead note that Tree Borrows does not support int2ptr castsFixes #3764