Hardware Security: Advanced Topics and Trends
Which correctly pairs the descriptions of retpoline and IBRS, countermeasures against the Spectre variant that abuses indirect branch prediction (branch target injection)?
- ARetpoline rebuilds the CPU circuits to remove the predictor, and IBRS is a countermeasure in which the compiler rewrites indirect branch instructions into another sequence of instructions
- BRetpoline is a software countermeasure that replaces indirect branches with instruction sequences that do not rely on the predictor, and IBRS is a CPU feature that restricts indirect branch prediction
- CBoth retpoline and IBRS stop the CPU's speculative execution itself, so with either of them the performance gained from speculative execution is lost
Show answer and explanation
Answer: B. Retpoline is a software countermeasure that replaces indirect branches with instruction sequences that do not rely on the predictor, and IBRS is a CPU feature that restricts indirect branch prediction
With retpoline, the compiler replaces indirect branch instructions with a sequence combining call and ret, making the CPU use return prediction instead of the abusable indirect branch predictor and letting speculative execution spin harmlessly in a loop. IBRS is a CPU control feature added through microcode updates and the like that restricts, for example, indirect branch prediction in the kernel so that it does not follow what user programs have trained. On older CPUs, toggling IBRS took a lot of time, so retpoline was widely used, while newer CPUs provide an improved version that can be left on permanently (eIBRS). However, some CPUs also rely on another predictor for return prediction, and Retbleed, published in 2022, among others, showed cases where retpoline alone is insufficient.
- A. It is the other way round. Retpoline is a software countermeasure applied by the compiler and IBRS is a CPU feature.
- B. Correct. One avoids the predictor in software, the other restricts prediction with a CPU feature.
- C. Neither removes speculative execution itself; they avoid or restrict the predictions that could be abused.
Continue: 9 more Hardware Security: Advanced Topics and Trends questions