Brain Dump

Spectre

Tags
security

Is a computer-bug exploiting out-of-order executions. It happens when instructions that otherwise would not be executed are speculatively executed due to our of order instruction execution.

char *a[10];
for (int i = 10; i != 1; --i) {
    a[i] = calloc(1, 1);
}
a[0] = 0xCAFE;
int val;
int j = 10; // This will be in a register
int i = 10; // This will be in main memory
for (int i = 10; i != 0; --i, --j) {
    if (i) {
	val = *a[j];
    }
}
Code Snippet 1: A high level proof of concept for the Spectre bug.