Currently the SPEC_CTRL_IBRS_FIRMWARE flag always gets set as long as
IBRS is supported by the hardware. However, as best as can be determined
by the documention, if IBRS has been disabled (e.g., spectre_v2=off) then
SPEC_CTRL_IBRS_FIRMWARE should not be set:
nospectre_v2 [X86] Disable all mitigations for the Spectre variant 2
(indirect branch prediction) vulnerability. System may
allow data leaks with this option, which is equivalent
to spectre_v2=off.
and:
spectre_v2= [X86] Control mitigation of Spectre variant 2
(indirect branch speculation) vulnerability.
off - unconditionally disable
Add a check in set_ibrs_firmware() to only set SPEC_CTRL_IBRS_FIRMWARE if
ibrs_disabled is not also set.
Orabug:
28274907
Signed-off-by: Patrick Colp <patrick.colp@oracle.com>
Reviewed-by: Kanth Ghatraju <kanth.ghatraju@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
static inline void set_ibrs_firmware(void)
{
- if (ibrs_supported)
+ if (ibrs_supported && !ibrs_disabled)
use_ibrs |= SPEC_CTRL_IBRS_FIRMWARE;
}