3 ms·
Modern processors execute instructions speculatively, that is without knowing if the instructions should actually run. If it turns out they weren't supposed to
by cowboysauce 8y ago
Modern processors execute instructions speculatively, that is without knowing if the instructions should actually run. If it turns out they weren't supposed to be executed then the processor undoes effects of the instructions. However, not everything is undone. If the speculatively executed instructions access RAM, then they can move data in and out of the cache. By measuring how long it takes to read memory, you can tell what memory the speculatively instructions accessed.
Speculative execution is what allows Meltdown to work. You make the processor speculatively execute an access to kernel memory, then access a memory address based on the value of the data read from kernel memory. Intel processors preform the speculative execution without first checking if the memory access in allowed while AMD processors check before the speculative execution. This is why AMD processors aren't vulnerable to Meltdown.
SGX was thought not be vulnerable to a speculative execution attack because attempts to access SGX memory, without having the necessary access, just yield -1 for reads and writes are ignored, as opposed to causing an exception as with access to kernel memory. However, if the SGX memory is marked as not-present, then attempts to read the memory will trigger a page fault exception. The page fault circumvents the normal SGX protection and allows the memory to be read by speculatively executed instructions.