3 ms·
I may have misunderstood this, but from what I read it seems the reason Meltdown did not affect AMD is that when code running in user mode is speculatively exec
by tzs 9y ago
I may have misunderstood this, but from what I read it seems the reason Meltdown did not affect AMD is that when code running in user mode is speculatively executed it is not allowed to access kernel memory.
This doesn't save AMD from Spectre because Spectre is not about bypassing hardware memory protection. It's about getting code that is allowed by the hardware to freely access certain memory but that was designed to not try to do so, to do so.
So what if we added hardware memory protection that could be used by an application to protect its own memory space from itself? An application that wants to run sandboxed code could then use this to protect itself from that sandboxed code.
I think we already even have a mechanism that does most of this (or at least we did up until x86 went 64-bit...I'm not sure how much of this still works in 64-bit mode): protection rings. x86 has 4 protection rings. Most operating systems only use two of them: ring 0 for the kernel, ring 3 for applications. Why not use ring 2 for applications, and ring 3 for sandboxed code running inside applications?
Combine this with the x86 segmentation mechanism, which can be used to provide separate virtual address ranges within the application's virtual address space for each of the sandboxes. Even if speculation isn't fixed to respect memory protection, this could go a long way, because an instruction cannot generate an address outside of the currently mapped segments, except by first loading a new selector into the segment register, and that does a check to make sure the selector you are trying to load is for a segment that the current ring is allowed to use.
I may be misremembering a lot of the details on how the rings and the segment system works, because I haven't really looked at this stuff in a very long time [1].
[1] Probably last around 1986 or so, when I was on the team at Interactive Systems that ported System V Release 3 from the 3B2 to the 386 for AT&T. I had to deal with a lot of the segment stuff back then, especially since I was half the team on the subproject to write the thing that allowed running 286 Unix and Xenix binaries on 386 Unix.
- DannyBee 9y agoYes, something like this would work. Your solution is basically #1/#2 - Declaring this mostly a software problem, and giving a cooperative mechanism where software effectively marks the areas it wishes to protect. Rely on everyone to isolate everything they like, then continue speculating everything in sight and declare everyone who didn't isolate well enough to be "bad programmers" :)