]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/speculation: Keep enhanced IBRS on when spec_store_bypass_disable=on is used
authorAlejandro Jimenez <alejandro.j.jimenez@oracle.com>
Wed, 20 Mar 2019 16:49:58 +0000 (12:49 -0400)
committerBrian Maly <brian.maly@oracle.com>
Tue, 21 May 2019 21:10:08 +0000 (17:10 -0400)
commit0d57530467243281b7decd099a017a0659653705
treea7e19ce164086e8926958dfd45a177e146d7f876
parentb2b3addc53412023565cf92ab09ce5e5248354c5
x86/speculation: Keep enhanced IBRS on when spec_store_bypass_disable=on is used

When SSBD is unconditionally enabled using the kernel parameter
"spec_store_bypass_disable=on", enhanced IBRS is inadvertently turned
off. This happens because the SSBD initialization runs after the code
which selects enhanced IBRS as the spectre V2 mitigation and sets the
IBRS bit on the SPEC_CTRL MSR.

When "spec_store_bypass_disable=on" is used, ssb_init() calls
x86_spec_ctrl_set(SPEC_CTRL_INITIAL), which writes to the SPEC_CTRL
MSR to set the SSBD bit. The value written does not have the IBRS bit
set, since if basic IBRS is in use it will be set during the next
userspace to kernel transition. However, this is not the case for
enhanced IBRS where setting the bit once is sufficient. As a result,
enhanced IBRS remains disabled in this scenario unless manually
enabled afterwards using the sysfs knobs.

Fix the issue by using the correct value with the IBRS bit set when
the enhanced IBRS mitigation is in use.

Orabug: 29423804

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
arch/x86/kernel/cpu/bugs_64.c