#[link_section] is unsound on Harvard architectures #76507
Labels
A-linkage
Area: linking into static, shared libraries and binaries
C-bug
Category: This is a bug.
E-needs-mcve
Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
P-low
Low priority
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
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: