Improve retpoline for Skylake
From: Andi Kleen
Date: Fri Jan 12 2018 - 13:46:32 EST
[This is an alternative to David's earlier patch to only
handle context switch. It handles more cases.]
Skylake needs some additional protections over plain RETPOLINE
The CPU can fall back to the potentially poisioned indirect branch
predictor when the return buffer underflows.
This patch kit extends RETPOLINE to guard against many (but not
all) of such cases by filling the return buffer.
- Context switch when switching from shallow to deeper call chain
- Idle which clears the return buffer
- Interrupts which cause deep call chains
This is done with a new SPECTRE_V2 defense mode and feature flag.
The mitigations are only enabled on Skylake, patched out
on other CPUs.
Git tree at
Against current tip/x86/pti
v1: Initial post, but containing some patches posted earlier, but