4 ms·
Conventional wisdom such as: // it is impossible to read past the end // of the array in this code: if (i >= 0 && i < array.size()) x = array[i];
by syncsynchalt 9y ago
Conventional wisdom such as:
// it is impossible to read past the end
// of the array in this code:
if (i >= 0 && i < array.size())
x = array[i];
- inimino 9y agoThe conventional wisdom has always been that it is impossible if and only if your hardware is not broken. If the hardware is broken, all bets are off. Nothing in the conventional wisdom has been challenged, except perhaps the complacent assumption that "Intel hardware is unlikely to be broken in ways that invalidate our security".
- cesarb 9y agoSpectre is not just Intel. That "array bounds" example is Spectre variant 1, which affects everyone except in-order processors (older Atom and slower ARM). So far, I haven't read of any hardware mitigation for it (unlike variant 2 or Meltdown aka "variant 3"). The mitigations for variant 1 I've seen are either introducing a speculation barrier on array bounds checks, or faster masking tricks which convert speculated out-of-bounds values into safe values. It won't surprise me at all if conventional wisdom changes to include speculation effects, much like it has changed to include cache effects once memory got slower than the CPU.