Theme 1 – Speculative instruction fetch and its interaction with memory attributes
Many commenters focus on how CPUs speculatively fetch instructions from addresses the program never intended to execute, especially when those addresses are marked as Device memory.
- “Speculative instruction fetches fetch code from 'a location that you never asked it to execute code at' by design.” – repiret
- “CPU predicts what hypervisor will do, speculatively loads instructions from mispredicted branch target, that wrong instruction reads memory … against the 'no data prefetch' settings … CPU blows up/halts/whatever.” – MBCook
- “Speculative instruction fetch to device memory crashes device … is in my list of favorite bugs ever found.” – repiret
Theme 2 – The NX bit’s original purpose versus its reuse for Spectre‑type mitigations
The discussion contrasts the NX bit’s early role in blocking buffer‑overflow exploits with its later repurposing to curb speculative execution after Spectre/Meltdown.
- “NX precedes Spectre by a long shot. It was originally intended so an attacker couldn't use a buffer overflow to change the PC and execute directly out of the attacker‑controlled buffer.” – jnwatson
- “Arm did not add another means to disable this kind of speculative execution, after Spectre was discovered, but they just reused the existing NX flag, expanding its functionality.” – adrian_b
Theme 3 – Self‑modifying code / JIT performance trade‑offs
Several participants debate whether disabling self‑modifying code (SMC) is a worthwhile performance/power win or an unnecessary restriction for JIT compilers and similar techniques.
- “Disallowing smc is a significant perf/power win. For CPUs that run a large variety of large code … having to have the icache snoop data writes … would be a huge penalty.” – neerajsi
- “Hot take: NX bit is shit W^X is shit. Proper JIT is having objects written as needed… we need self‑modifying code as a first‑class citizen.” – Nail2680
- “WebKit/JavaScriptCore … trend has been towards less‑frequent code modification; whole‑function reoptimization is still worth the overhead … but at smaller granularities not so much.” – achierius