[SRU][Xenial][PATCH] UBUNTU: SAUCE: Restore the IBRS host state on VMEXIT

Juerg Haefliger juerg.haefliger at canonical.com
Tue Jan 15 08:33:15 UTC 2019


BugLink: https://bugs.launchpad.net/bugs/1764956

IBRS in Ubuntu can be controlled dynamically from userspace. Make sure
the correct state is restored on VMEXIT.

Suggested-by: Gavin Guo <gavin.guo at canonical.com>
Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
 arch/x86/kernel/cpu/bugs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 15867c20ed1c..63d5b84e680b 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -189,6 +189,10 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
 		if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD))
 			hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
 
+		/* IBRS dynamically controlled in MSR_SPEC_CTRL */
+		if (ibrs_enabled)
+			hostval |= SPEC_CTRL_IBRS;
+
 		if (hostval != guestval) {
 			msrval = setguest ? guestval : hostval;
 			wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
-- 
2.19.1




More information about the kernel-team mailing list