SLAP and FLOP
Virtually all modern CPUs use a performance optimization where they predict the
control flow the CPU should take (such as branches and returns), should the
outcome not be readily available. Once a prediction is made, the CPU will execute instructions along
the prediction, a process called speculative execution. If the CPU realizes it had
mispredicted, it must revert all changes in the state it performed after the
prediction. Nearly all desktop and mobile CPUs exhibit this behavior, regardless of
manufacturer (such as Apple, AMD, or Intel).
Spectre is a hardware vulnerability in
virtually all modern CPUs that occurs when speculative execution backfires.
While the CPU should ideally revert all changes in state, speculative execution leaves
traces in the CPU’s microarchitectural state and especially the cache. A Spectre
attack coerces the CPU into speculatively executing the wrong flow of
instructions. If this wrong flow has instructions depending on sensitive data, their value can
be inferred through a side channel even after the CPU realizes the mistake and
reverts its changes. An adversary can abuse this behavior to read data that they cannot
normally access through program semantics. Because speculative execution is an
important part of CPU performance that is infeasible to simply remove as a
countermeasure, Spectre continues to be dangerous to software even years after
its discovery.
In SLAP and FLOP, we demonstrate that recent Apple CPUs go beyond this, not only
predicting the control flow the CPU should take, but also the data flow the CPU
should operate on if data are not readily available from the memory subsystem.
Unlike Spectre, mispredictions on data flow do not directly result in the CPU
speculatively executing the wrong instructions. Instead, they result in the CPU
executing arbitrary instructions on the wrong data. However, we show this can be combined with
indirection techniques to execute wrong instructions.

