-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Extern statics can be accessed in safe Rust #35112
Comments
I believe the solution is to require |
|
It's pretty horrifying that
and the C side can contain arbitrary bytes under the name |
nominating due to unsoundness |
@petrochenkov technically, the Rust side can also contain arbitrary bytes under the name |
I'd be okay with extern statics requiring unsafe to access. Would probably need a very long deprecation/warning period however. |
@retep998 it's unsound, therefore, it doesn't need that long of a deprecation period, in my opinion. Maybe two cycles. |
Since this would presumably go through a forward compatibility lint, it could be made |
@rkruppe makes sense. |
Probably one Rust release warn by default, and then at least one deny by default and keeping it deny by default for a while until crater says it is mostly okay. |
Agreed, it seems very clear that accessing an extern static should be unsafe -- just as calling an extern fn is unsafe. Just a plain oversight. There are many ways for this to go wrong:
So we should add a forwards-compatibility lint and make it unsafe to access an extern static. I agree we'll want to have a (very) long deprecation period. |
Fix extern static warning See rust-lang/rust#35112
Fix extern static warning See rust-lang/rust#35112
Since last commit, Rust changed the behavior of `extern static`; see rust-lang/rust#35112 In the future, this should be change to an unsafe block, but now it suffices to turn off the error by the `#[allow(...)]` switch.
This code crashes:
@ubsan wrote this code on irc.
https://botbot.me/mozilla/rust-internals/2016-07-28/?msg=70411962&page=5
The text was updated successfully, but these errors were encountered: