-
Notifications
You must be signed in to change notification settings - Fork 258
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
Be compatible with -Zmiri-strict-provenance #477
Conversation
e3d98d8
to
7ad0ec4
Compare
No idea what's going on with the CI at the moment. My best guess is that something with the windows runners is broken. I'll try again tomorrow. |
7ad0ec4
to
8ae2d3a
Compare
Is it possible to perhaps disable this in miri? I'd rather not lose the ability to have debugging assertions and otherwise it seems like larger refactorings would be necessary in this crate to truly support the strict-provenance changes. |
The problem with the existing code is that the backtrace-rs CI runs Miri with What backtrace-rs wants is a way to convert pointers to integers and back but with no expectation that the pointer will be dereferenced. Personally reading the code it is very strange to me that these pointers are ever used as Very pragmatically, since this repo sees relatively little attention and the whole strict provenance checking in Miri is unstable and the APIs to work in the model are still unstable, I think the best thing to do here is just remove the |
What is the problem with these debug assertions? I think they can be kept. If the strict provenance API was stable, we could use |
We could also add a dependency on |
tests/skip_inner_frames.rs
Outdated
@@ -23,7 +23,6 @@ fn backtrace_new_unresolved_should_start_with_call_site_trace() { | |||
assert!(!b.frames().is_empty()); | |||
|
|||
let this_ip = backtrace_new_unresolved_should_start_with_call_site_trace as usize; | |||
println!("this_ip: {:?}", this_ip as *const usize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why did you remove these assertions?
If this is because :p
internally calls expose_addr
, then we should probably start the discussion of using addr
there instead -- and in the mean time either gate these prints by cfg(not(miri))
or just remove the -Zmiri-strict-provenance
from the CI flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is because :p
internally calls expose_addr
.
If everyone else is comfortable with it, I think the most appropriate approach is to remove -Zmiri-strict-provenance
, because as i said above, this codebase plays a bit fast and loose with types, and it wouldn't hurt to address that... but not here.
8ae2d3a
to
93ef978
Compare
I believe CI still won't pass because of the problem with the 32-bit Windows check, but 🤷 this will get it farther than before |
Ok I think this is reasonable enough to land for now. If it becomes more necessary though to enable strict provenance in the standard library and CI I think it would probably be a good time to revisit all of the API details here to figure out an API that better suits that world. |
CI for #476 is currently failing, because CI asserts that we are compatible with strict provenance but we aren't.
For a crate like this I don't know if the right choice is to disable the checks or not. The use of pointers here is a bit unconventional. (decision: remove the strict provenance check)