x86/bugs/IBRS: Disable SSB (RDS) if IBRS is sslected for spectre_v2.
If =userspace is selected we want frob the SPEC_CTRL MSR on every
userspace entrace (disable memory disambigation), and also on every
kernel entrace (enable memory disambiguation). However we have
to be careful as having MSR frobbed and retpoline being enabled
slows the machine even further.
Therefore if possible swap over to using SPEC_CTRL MSR (IBRS) on
every kernel entrace instead of using retpoline.
Naturally this heuristic is controlled by various knobs.
To summarize, if "spectre_v2=retpoline spec_store_bypass_disable=userspace"
is set then we will switch the spectre_v2 to IBRS.
This table may explain this better:
effect | spectre_v2 | spec_store_bypass_disable | remark
==========+=============+===========================+======
IBRS | ibrs | userspace |
IBRS | auto | userspace | *1 *2
IBRS | retpoline | userspace | *1
IBRS | ibrs | boot |
retpoline | auto | boot |
retpoline | retpoline | boot |
retpoline | auto | boot |
retpoline | auto | auto |
*1: If spectre_v2_heuristic=off or spectre_v2_heuristic=rds=off
is selected then the spec_store_bypass_disable=userspace parameter
is not followed and the effect is both retpoline and IBRS enabled
in the kernel.
*2: If we run under Skylake+ the 'spec_store_bypass_disable=auto'
will disable retpoline and enable IBRS. If not on Skylake+, then
retpoline and IBRS are both enabled.
OraBug:
28041771
CVE: CVE-2018-3639
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>