-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
#[link_section] is unsound on Harvard architectures #76507
Comments
Assigning |
I’m pretty sure |
Now that we have #123757, the 2024 edition will require writing |
Ideally this concern is documented somewhere with that attribute basically in the safety docs for the attribute.
|
Ah, but that's not an I-unsound issue, so maybe let's track adding documentation in #123757 instead. |
As pointed out in this thread on URLO, it is possible to read arbitrary memory without
unsafe
using thelink_section
attribute on architectures with separate address spaces for code and data.To cite OP's code:
I expected to see this happen: the code should not compile, as it reads OOB memory.
Instead, this happened: The code compiles and outputs incorrect values, indicating UB.
The text was updated successfully, but these errors were encountered: