One bug, slowly. Then thirty of them, quickly.
2026-11-30
A core at 1 GHz can start an instruction every nanosecond. That is the clock the whole pipeline is built around.
About one instruction in five is a branch, and resolving one takes 10–20 cycles. A core that waited for the answer would idle most of the time.
So it does not wait. It predicts — and then it executes the prediction before it is confirmed.
This is not an optimisation bolted onto the pipeline. It is how the pipeline is fed.
When the prediction turns out to be wrong, the core rolls back.
That is what precise exceptions means: when control returns to the program, it is as if the wrong path never ran. Exactly.
But the wrong path did run. It fetched, it decoded, it computed addresses, it loaded — for however many cycles it took the core to notice.
Architecturally, none of it happened.
The rollback is architectural. The hardware is still holding the results.
Any program can time its own memory accesses — rdtsc on x86, rdcycle on RISC-V where the platform exposes it. So the state of the cache is readable by anyone who can run code on the machine.
A wrong guess that touched memory has therefore left something observable behind.
The ISA defines the left column and says nothing about the right. So the right column is where every one of these bugs lives.
A wrong guess is rolled back in the registers, and not in the caches.
Everything else in this deck is an instance of that sentence. A different guess, a different structure, a different fix — the same shape.
Speculation is not the bug. The residue of speculation is the bug.
There is nothing wrong with this function. It is correct C. The bounds check is present, it is in the right place, and it works.
It is also a gadget.
if (x < array1_size) is a compare and a conditional branch.
On a pipelined core, the branch is resolved in a stage — EX, the execute stage — and predicted in the fetch stage.
The prediction happens in cycle 1. The comparison happens in cycle 3.
The core decides whether the check passes before it knows the answer. It has to; that is what prediction is for.
And a predictor that decides before it knows is a predictor that can be wrong on purpose.
Three tables, three jobs. Every core that speculates has some version of these:
| Structure | Full name | Job |
|---|---|---|
| BHT | branch history table | direction — taken, or not taken? |
| BTB | branch target buffer | target — where does this branch go? |
| RSB | return stack buffer | returns — where did this call come from? |
The tables are indexed by PC, so the answer is available in the same cycle as the fetch — that is why a correct prediction costs zero cycles.
(Some manuals call the RSB the RAS, for return address stack. Same structure — this deck uses RSB throughout.)
Two properties matter here, and neither is a defect:
A structure that learns from what it sees, and is not reset, can be taught.
The attacker calls victim(0) thirty times.
| call | x |
check | predicted | actual |
|---|---|---|---|---|
| 1 | 0 | passes | — | taken |
| 2 | 0 | passes | taken | taken |
| … | 0 | passes | taken | taken |
| 30 | 0 | passes | taken | taken |
| 31 | 5000 | fails | taken | not taken |
At call 31 the predictor is confident and wrong. The core fetches the wrong path — and then executes it.
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| IF | bge | ld a1[x] | ld probe | |||
| ID | bge | ld a1[x] | ld probe | |||
| EX | bge | ld a1[x] | ld probe | |||
| MEM | ld a1[x] | ld probe | ||||
| WB | ld a1[x] |
IF fetch · ID decode · EX execute · MEM memory · WB write back
bge reaches EX in cycle 3 and discovers the check failed. By then two loads are already in flight behind it.
The orange cell is the whole attack: ld probe reaches the memory unit in cycle 5, before the squash reaches it, and fills a cache line on its way.
array1[x] Actually ReadsThe out-of-bounds read is not a fault. array1[5000] is a perfectly valid address — it is just the wrong data. Nothing traps. Nothing is logged.
The secret is one byte: 256 possible values. We need to turn a value into a time difference.
probe[v * 4096] puts byte value v on page v, and on cache line v.
The branch resolves. The core does exactly what it promised:
bge |
ld a1[x] |
ld probe |
|
|---|---|---|---|
| Architectural | resolved | discarded | discarded |
| Microarchitectural | predictor updated | L1 filled | L1 filled — survives |
The rightmost column is the leak. It is not a bug in the squash. The squash did its job perfectly — it discarded the results.
After the transient window, exactly one line of probe is in L1.
The attacker does not need to know which line until they measure. That is the trick: the secret chose the address, so measuring the address reveals the secret.
This is a covert channel — 256 symbols, one per byte value, transmitted through the cache. The channel is the vulnerability’s delivery mechanism, not the vulnerability itself.
Every stage is a performance feature doing its job. Not one of them is a memory-safety bug.
The original work measured on the order of 10–500 kB/s depending on setup.
That is not a file-copy channel. It is also far more than enough:
KASLR — kernel address space layout randomisation. The kernel is placed at a random offset at each boot, so an attacker cannot hard-code the address of a kernel gadget. That offset is the slide. Leak it, and every kernel address is known.
Bandwidth is the wrong metric. A single correct byte is often decisive.
Everything so far needed a mistake in the victim’s code: a bounds check that could be bypassed.
Meltdown needs no bug in your code at all.
Nobody’s check was wrong. On one design the check resolved late; on the other it gated the issue. That is the entire difference.
A core that executes out of order finishes instructions in whatever order they become ready. It still has to report faults in program order.
So it needs a reorder buffer: a structure that tracks every in-flight instruction and commits them in program order, no matter what order they finished in.
Precise means: when a fault is reported, everything before it has committed and everything after it has not. That requires holding the fault until the instruction is ready to retire.
The hold is the window. The machinery that gives you precise exceptions gives the attacker a delay between detecting a fault and delivering it — and in that delay, the data is already in a register.
If user mode cannot address kernel memory, there is nothing to read.
KPTI — kernel page table isolation: separate page tables. While in user mode, kernel memory is not mapped at all.
Cost: two page tables, and a write to CR3 — the register holding the base of the current page table — on every trap and every return.
This is a real fix. It removes the ability to name the address, which removes the attack. It is not a mitigation you can train programmers to defeat.
Because the check was in a different place, and had been since the design was drawn.
This is worth sitting with. The bug was not “speculation is dangerous”. It was “one microarchitecture put a check on the wrong side of a queue, and another did not”.
A security property that depends on which side of a queue a check sits on is not a security property you can reason about from the ISA.
For Spectre v1, the obvious fix: if the check fails, make the index safe.
Linux’s version is array_index_nospec().
This works, and it works for the right reason: the speculative path now computes an address that is in bounds, so there is nothing out of bounds to leak.
BCBS — Bounds Check Bypass Store (CVE-2018-3693).
The same misprediction can make a store transiently out of bounds, not just a load. And a transient store can overwrite a security-critical value — a permission flag, a function pointer, a return address — that a later, correctly speculated instruction then reads.
So the fix for “reading the wrong thing” had a hole where the answer was “writing the wrong thing”.
The blunt instrument: a speculation barrier after the check.
Correct. Also expensive, and — more importantly — it has to be everywhere.
The audit problem: every load whose address depends on untrusted input needs one, in every program, forever. Miss one and the class is back.
v1 mistrains a direction. The next attack poisons a target.
Spectre v2 — Branch Target Injection (CVE-2017-5715).
The attacker trains the BTB so that the victim’s indirect branch — call *%rax, a virtual dispatch, a switch table — speculatively goes to an address the attacker chose.
Now the attacker does not need a gadget in the victim’s code. They need a gadget anywhere in the address space that the victim will speculatively execute.
gadget reads a secret and encodes it into the cache — the same encoder from Part I. The only thing that changed is how control got there.
Replace indirect branches with a ret that the predictor cannot follow usefully.
The ret uses the RSB — the return stack buffer — which is harder to poison than the BTB, the branch target buffer. The speculative path loops harmlessly instead of going where the attacker wants.
A software fix, deployed by recompiling everything. It worked. For four years.
| v1 | v2 | |
|---|---|---|
| Steers | a direction | a target |
| Needs a gadget in | the victim’s code | any mapped code |
| Fixed by | index masking, barriers | retpoline, IBRS, eIBRS |
| Fix status | permanent software tax | bypassed, re-fixed, bypassed |
IBRS — indirect branch restricted speculation, a microcoded switch that isolates predictor entries by privilege. eIBRS is the hardware version, much cheaper.
Two variants, two fixes, and already the pattern is: the fix is shaped like the attack, so the next attack is shaped like the fix.
A load can take its value from an older store that has not yet reached memory. That is a feature — it is how a core avoids stalling on every store followed by a load.
Spectre v4 — Speculative Store Bypass (CVE-2018-3639).
If the load forwards from a store that the core has speculated will not conflict, it can read a stale value — bypassing a newer store that would have made the access safe.
Same shape as v1, different mechanism: the bounds check is enforced by a store, and the forwarding lets the load read the old, permissive value.
Foreshadow / L1TF — L1 terminal fault (CVE-2018-3615, -3620, -3646).
When a page walk hits a non-present entry, the CPU may speculatively continue and use the physical address in that entry to index L1.
The attacker writes a PTE (page-table entry) with a chosen physical address and the not-present bit set. Then a speculative load reads L1 data from that physical address — memory the process was never allowed to map.
The fix is beautiful: PTE inversion. Non-present entries have their address bits inverted, so a speculative walk lands somewhere harmless. No measurable cost.
MDS — microarchitectural data sampling (CVE-2018-12126, -12127, -12130, CVE-2019-11091), published under four names: MDS, RIDL, ZombieLoad, Fallout.
Fill buffers, load ports, and store buffers hold data in flight. A speculative load can sample them.
| Variant | Full name | Buffer |
|---|---|---|
| MFBDS | microarchitectural fill buffer data sampling | fill buffers |
| MLPDS | microarchitectural load port data sampling | load ports |
| MSBDS | microarchitectural store buffer data sampling | store buffers |
| MDSUM | data sampling of uncacheable memory | uncacheable memory |
Here the leak is not the cache at all. It is the staging hardware — the buffers that exist to keep the memory system busy.
TAA — TSX asynchronous abort (CVE-2019-11135) — the same buffers, reached through TSX, Intel’s transactional synchronisation extensions. A transaction that aborts gives you a new way to create a transient window.
SWAPGS (CVE-2019-1125) — the kernel’s swapgs instruction can execute speculatively with the wrong GS base. swapgs swaps the GS segment base between user and kernel; get it wrong and a kernel entry gadget reads kernel memory using a userspace base.
Both are the same lesson: every new mechanism is a new way to open a window. TSX was a feature nobody used. It still had to be disabled.
The RSB — the return stack buffer, the third table from Part I — is a predictor too. So it has the same problem.
ret speculatively returns to the attacker’s gadget.XOR look like a recursive call, overflow the RSB with an attacker-chosen target.SpectreRSB → Retbleed → Inception is one continuous line: the fix for v2 became the target.
Branch History Injection / Spectre-BHB (CVE-2022-0001, -0002).
eIBRS (Intel) and CSV2 — ARM’s cache speculation variant 2 — were hardware fixes for v2: tag predictor entries by privilege so userland cannot train kernel targets.
BHI: the attacker cannot inject a target, but they can poison the BHB — the branch history buffer, the global record of recent branch outcomes. The BHB selects which predictor entry the kernel uses. Steer it, and you steer the kernel to a kernel gadget.
The hardware fix constrained the target. It did not constrain the index.
gather instruction — one load from many scattered addresses — leaks the vector register file. Intel 6th–11th Gen Core and 1st–4th Gen Xeon. Roughly nine years of silicon. Mitigation: GDS_CTRL — a gather-data-sampling control bit — at up to ~50% on gather-heavy code.Two new surfaces: injected data and the register file. Neither was on anybody’s list in 2018.
vzeroupper is supposed to zero the upper bits of the YMM registers (the 256-bit vector registers) and on Zen 2 did not always. Stale data leaks across contexts. This is the CPU in this room. Fixed by microcode.prefetch timing reveals whether a kernel address is mapped, breaking KASLR under KPTI.Note what EntryBleed does: it breaks KPTI, the fix from Part II. Not the protection it gave — the assumption that KPTI made addresses unguessable.
| Variant | Window opens by | Fix | Status |
|---|---|---|---|
| Spectre v1 | mispredicted direction | index masking, barriers | permanent |
| BCBS | mispredicted direction | barriers around stores | permanent |
| Spectre v2 | poisoned BTB target | retpoline, IBRS, eIBRS | bypassed |
| Meltdown | permission-check race | KPTI + PCID | fixed |
| Spectre v4 | store-to-load forwarding | SSBD | feature off |
| L1TF | terminal page fault | PTE inversion | fixed |
| MDS | speculative buffer sample | VERW + no SMT | feature off |
| Retbleed / Inception | return prediction | safe RET, SRSO | bypassed |
| BHI | branch history | clear BHB on entry | bypassed |
| Downfall | gather sampling | GDS_CTRL | fixed |
SSBD speculative store bypass disable · VERW the instruction microcode extends to clear the buffers · SRSO speculative return stack overflow · SMT simultaneous multithreading
Read the last column, not the third. Four of the ten have a fix you can call finished.
The count depends on how you count. That is not a dodge — it is the finding.
The useful question is not “how many are there”. It is “how many shapes are there”. The answer is a grid with four cells.
| Fix | Deployed | Broken by |
|---|---|---|
| retpoline | 2018 | Retbleed, 2022 |
| KPTI | 2018 | EntryBleed (assumption), 2022 |
| eIBRS (hardware) | 2019 | BHI, 2022 |
| CSV2 (ARM hardware) | 2019 | BHI, 2022 |
| retpoline + RSB stuffing | 2018 | Inception, 2023 |
| index masking | 2018 | BCBS (the store shape) |
Six fixes. Six follow-ups. The mean time to a bypass is about three years.
Three reasons the count grew rather than shrank:
Reason 3 is the one that should worry you. Defence is generating offence.
“The industry can’t fix these” is too strong, and it is the claim a smart student will attack. The honest version has four categories.
| Category | Meaning | |
|---|---|---|
| 1 | Fixed in silicon | a real bug, a real fix, finished |
| 2 | Fixed by giving up the feature | the leak is the sharing |
| 3 | Provisionally fixed | deployed, then bypassed |
| 4 | Permanently unfixable | no hardware can know your intent |
fixed
RDCL_NO (“rogue data cache load: not affected”) in the IA32_ARCH_CAPABILITIES MSR (model-specific register); later designs do not have the race. AMD never did.GDS_CTRL microcode.These are the existence proof. The class is not uniformly unfixable, and anyone who says otherwise is over-claiming.
feature off
VERW on every context switch, and SMT off.The leak is not a side effect of the feature. The leak is the sharing. If two threads share a fill buffer, a speculative load can read across the boundary; there is no version of the buffer that is both shared and safe.
So the “fix” is a decision that the feature is not worth its price — which is a business decision, not an engineering one.
bypassed
Anything gated on predictor isolation:
The fix is always “constrain the predictor”. The predictor is finite, shared, and indexed by hashed addresses and history — so there is always another input.
A fix that works by constraining a finite shared structure is a fix with a search problem attached.
permanent
Spectre v1. No hardware can know that your bounds check is a security boundary.
These are the same instruction. The CPU cannot tell them apart, and it must not stall for either — stalling on every conditional branch would cost more than the whole pipeline is worth.
So the fix is a permanent, universal software contract: every load whose address depends on untrusted input must be masked or fenced. Enforced by every programmer, forever, with no way to test compliance.
Simultaneous multithreading puts two threads on one core. They share:
| Shared | Consequence |
|---|---|
| L1 data cache | Prime+Probe becomes practical |
| Fill / load / store buffers | MDS reads across threads |
| Branch predictors | Training crosses threads |
| Execution ports | Port contention leaks |
SMT does not create these bugs. It converts a local bug into a cross-tenant one — and cross-tenant is where the money is.
We spent twenty years building machines whose performance depends on shared, persistent, observable state — and then connected them to each other.
Every mitigation in this deck is one of three things:
There is no fourth option, because the fourth option would be to stop speculating — and nobody is going to do that.
zoologist — the machine this deck is presented on.
| CPU | AMD Ryzen 5 PRO 4650U — Zen 2 “Renoir”, family 23 model 96 |
| Cores | 6C / 12T, SMT on |
| L1 | 32 KB 8-way data, 32 KB 8-way instruction |
| L2 | 512 KB 8-way, per core |
| L3 | 4 MB 16-way, per CCX (core complex) — there are two |
| Line | 64 bytes |
| ISA | AVX2 (256-bit vectors), no AVX-512; clflush, rdtscp |
Four of these numbers are load-bearing for the rest of the deck:
$ for f in /sys/devices/system/cpu/vulnerabilities/*; do
printf '%-26s %s\n' "$(basename $f)" "$(cat $f)"; done
gather_data_sampling Not affected
indirect_target_selection Not affected
l1tf Not affected
mds Not affected
meltdown Not affected
retbleed Mitigation: untrained return thunk; SMT enabled with STIBP protection
spec_rstack_overflow Mitigation: Safe RET
spec_store_bypass Mitigation: Speculative Store Bypass disabled via prctl
spectre_v1 Mitigation: usercopy/swapgs barriers and __user pointer sanitization
spectre_v2 Mitigation: Retpolines; IBPB: conditional; STIBP: always-on; RSB filling
srbds Not affected
tsx_async_abort Not affected
(abridged — 17 rows in total)
| Row | Says | Category |
|---|---|---|
meltdown |
Not affected | 1 — never had the race |
l1tf, mds, srbds |
Not affected | 1 — Intel-only families |
gather_data_sampling |
Not affected | 1 — no AVX-512, by luck |
spec_store_bypass |
disabled via prctl | 2 — opt-in feature off |
retbleed |
untrained return thunk | 3 — a patch to the patch |
spectre_v1 |
usercopy/swapgs barriers | 4 — code discipline |
retbleed’s mitigation is literally the replacement for retpoline, itself patched. That is category 3 in one line of kernel output.
“Not affected” is a claim about this silicon, made by the vendor, and it is not the same as “safe”.
Three different reasons produce the same three words:
meltdown),l1tf, mds),gather_data_sampling).Only the first is a security property. The second is a different product. The third is luck, and luck does not survive the next generation.
spectre_v2 on this machine:
Mitigation: Retpolines; IBPB: conditional; STIBP: always-on; RSB filling
Four mechanisms, and the qualifiers matter more than the mechanisms:
“Mitigated” is not a boolean. It is a configuration, and the configuration is a performance decision someone made.
spec_store_bypass: Mitigation: Speculative Store Bypass disabled via prctl
prctl. Not “enabled”. Not “always”. The protection is off unless a program asks for it.
Because turning it on costs performance, and most programs do not need it — and “most programs” is not a security boundary, it is a guess about who is running what.
This is the most honest slide in the deck. You are running with some of these mitigations off, and nobody told you.
CVE-2023-20593 — AMD Zen 2. vzeroupper fails to zero the upper bits of the YMM registers; stale data leaks across contexts.
This is the CPU in the room. Not an ancestor, not a sibling — this die.
And it was fixed. By microcode. vzeroupper now does what the manual always said it did.
So hold both facts at once: this machine shipped with a register-file leak, and this machine got a real fix. That is the strongest argument against the word “unfixable” — and it is the right frame for the next slide.
We tried the naive Spectre v1 PoC on this machine. At -O2 it failed:
fastest-reload histogram: <100:0 100-200:0 200-300:300 300-400:0 ...
best byte was 84 ('T') in 0/300 tries
Every probe line missed. The probe array was never touched transiently — the compiler had inlined the victim and the window was not what the paper assumed.
This is the mitigation working, seen from the attacker’s side. A modern compiler and a modern core make the naive attack not work, and that is a real result.
The SG2000’s big core: an in-order RISC-V C906 with a real predictor — 8–16 Kb GSHARE BHT (indexed by the branch’s PC and recent branch history), 16-entry fully associative BTB, 4-level RSB.
Prediction, not measurement. We did not test this board, and I will not pretend we did.
What the architecture predicts:
Every structure you were taught as a performance mechanism is on the attack surface list. That is not a coincidence. It is the same list.
spec_store_bypass is off by default on this machine. Should it be on? Who decides, and what do they need to know?Every one is answerable from this deck. None has a single right answer.
Core papers
Hardware and OS
lscpu, /sys/devices/system/cpu/vulnerabilities on zoologist. Every number in Part VI is from this machine.Documentation/admin-guide/hw-vuln/ — one file per family, and the source for every mitigation string in Part VI.CS 4250 · Speculation and the Microarchitectural Leak