Re: [PATCH -v2] x86/CPU/AMD: Improve the erratum 1386 workaround

From: Maciej S. Szmigiero
Date: Mon Mar 25 2024 - 11:26:03 EST


On 24.03.2024 21:05, Borislav Petkov wrote:
On Thu, Mar 21, 2024 at 04:21:39PM +0100, Maciej S. Szmigiero wrote:
On 21.03.2024 13:05, Borislav Petkov wrote:
From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>

Disable XSAVES only on machines which haven't loaded the microcode
revision containing the erratum fix.

This will come in handy when running archaic OSes as guests. OSes whose
brilliant programmers thought that CPUID is overrated and one should not
query it but use features directly, ala shoot first, ask questions
later... but only if you're alive after the shooting.

Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: "Maciej S. Szmigiero" <maciej.szmigiero@xxxxxxxxxx>
---

Tested-by: Maciej S. Szmigiero <maciej.szmigiero@xxxxxxxxxx>

Yeah, thanks but still not good enough. Turns out we already have the
min microcode revision testing functionality so there's no need for me
to reinvent the wheel.

No harm no foul, tho, the stuff in those two previous patches I will use
in the microcode loader soon for simplifying the loading.

Here's one *final* variant, I promise! :-)

Sorry about that.

No problem, it happens :)

---
From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>
Date: Sun, 24 Mar 2024 20:51:35 +0100
Subject: [PATCH -v2] x86/CPU/AMD: Improve the erratum 1386 workaround

Disable XSAVES only on machines which haven't loaded the microcode
revision containing the erratum fix.

This will come in handy when running archaic OSes as guests. OSes whose
brilliant programmers thought that CPUID is overrated and one should not
query it but use features directly, ala shoot first, ask questions
later... but only if you're alive after the shooting.

Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: "Maciej S. Szmigiero" <maciej.szmigiero@xxxxxxxxxx>
---

I have tested the updated patch now, including negative test by
increasing the required microcode version by 10, and can confirm that
this version works properly too.

Thanks,
Maciej