Re: Retbleed, Zen2 and STIBP

From: Andrew Cooper
Date: Mon Jul 18 2022 - 17:47:24 EST


On 18/07/2022 09:19, Ken Moffat wrote:
> Probably like most people, I find the detail of the available
> retbleed mitigations obscure. In particular, for zen2 the options
> *might* include ibpb or unret.

That's because retbleed is two totally different bugs between Intel and
AMD, and on AMD, it's only a subcase.

In this case for AMD, the root bug is called Branch Type Confusion, with
Retbleed (and Straight Line Speculation from previous disclosures) being
two sub-cases of BTC.

> While ibpb might be available (and slow), on my Renoir with
> microcode level (0860106h) there were no newer microcode versions
> available when I last looked (a few weeks ago) but note 7 at the
> bottom of
> https://www.amd.com/system/files/documents/technical-guidance-for-mitigating-branch-type-confusion_v
> 7_20220712.pdf
> implies that the relevant bit is only set on Renoir in 0860109h and
> later.
>
> Some of the text in that pdf implies that at least one of the
> options could be set if not already set from the microcode, but the
> amount of detail leaves me totally lost.
>
> Assuming, for the moment, that I might want to try this full
> mitigation, is there any way to set this in the absence of newer
> microcode ?

The microcode doesn't matter.  All it does is automatically activate the
same bit we set in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d7caac991feeef1b871ee6988fd2c9725df09039

> Or should I just accept that the best I can get is 'unret', whatever
> that means ?

"unret" fixes half the problem; the Retbleed subcase specifically.  You
want IBPB if you want the full fix for Branch Type Confusion.

~Andrew