Re: [PATCH] cpu/bugs: Disable CPU mitigations at compilation time

From: Breno Leitao
Date: Mon Jun 12 2023 - 09:46:26 EST


On Mon, Jun 12, 2023 at 03:32:30PM +0200, Borislav Petkov wrote:
> On Mon, Jun 12, 2023 at 05:54:56AM -0700, Breno Leitao wrote:
> > 1) We keep consistency with other CONFIG options. Linux already has a
> > CONFIG option to enable/disable mitigations for speculations
> > (CONFIG_SPECULATION_MITIGATIONS), so, this will be a similar one.
>
> So you can get what you want by disabling all those options there,
> right?

This patch proposes creating CONFIG_CPU_MITIGATIONS_DEFAULT_OFF that
will turn all the mitigations off in a binary, which is the same as
passing mitigations=off in the command line when the kernel boots.

Setting CONFIG_SPECULATION_MITIGATIONS=n does *not* disable all the
mitigations, as, there are some mitigations that are *not* disabled when
you pass CONFIG_SPECULATION_MITIGATIONS=n. As an example (from my
memory - need to double check in 6.4), MDS and TAA mitigations are not
disabled when CONFIG_SPECULATION_MITIGATIONS=n. MDS and TAA mitigations
are disabled when `mitigations=off` parameter is passed, tho.