Re: [PATCH] x86/srso: Disable the mitigation on unaffected configurations

From: Borislav Petkov
Date: Mon Aug 14 2023 - 16:26:40 EST


On Mon, Aug 14, 2023 at 01:08:13PM -0700, Josh Poimboeuf wrote:
> Tangentially, the 'cpu_smt_control == CPU_SMT_DISABLED' check is wrong,
> as SMT could still get enabled at runtime and SRSO would be exposed.

Well, even if it gets exposed, I don't think we can safely enable the
mitigation at runtime as alternatives have run already.

I guess I could use CPU_SMT_FORCE_DISABLED here.

> Also is there a reason to re-use the hardware SRSO_NO bit

Not a hardware bit - this is set by software - it is only allocated in
the CPUID leaf for easier interaction with guests.

> rather than clear the bug bit?

We don't clear the X86_BUGs. Ever. The logic is that if the CPU matches
an affected CPU, that flag remains to show that it is potentially
affected.

/sys/devices/system/cpu/vulnerabilities/ tells you what the actual state
is.

> That seems cleaner, then you wouldn't need this hack:

Not a hack. This is just like the other "not affected" feature flags.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette