-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
It should be unsafe to cast an extern function to a function pointer #55226
Comments
How is this unsound? Linker errors aren't great, but how do they jeopardize memory safety in any way? |
|
That issue has nothing to do with linker errors. The only common factor is that it involves an |
Ok so apparently we agree it's a different issue from #46188, which means my original question still stands: how is this a soundness issue? |
This seems like a linker problem to me; Rust has no way to fix this without something like a non-executable/null pointer check, which would have performance impacts on casting. For all edit: on systems where NX is supported, tbh this really isn't a soundness issue. |
@matthewjasper any thoughts on #55226 (comment)? |
To my knowledge this is essentially unfixable without implementing a linker ourselves or somehow catching the linker errors and re-displaying them in a nicer way, both of which seem impossible or out of scope, so I'm going to close this. I agree with folks that this is not a soundness issue. |
The following code gives a linker error, which arguably shouldn't happen in safe code.
Playground
The text was updated successfully, but these errors were encountered: