]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/kvm: Set IBRS on VMEXIT if guest disabled it.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 8 Jan 2018 01:22:26 +0000 (20:22 -0500)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Fri, 12 Jan 2018 18:20:13 +0000 (10:20 -0800)
commit17265ab05f527667c674f9cc4b62ff18375f7b42
tree411f0fd329fd2424dbb183ae937215ac6d91ee8b
parent360a97a0255cf630b93d90dd2792ace2ec57b8e6
x86/kvm: Set IBRS on VMEXIT if guest disabled it.

If the guest writes does not write FEATURE_ENABLE_IBRS to
MSR_IA32_SPEC_CTRL, then KVM will not issue such write after
(Indirect Branch Prediction Injection).

Right before VMENTER we set the MSR to zero (if the guest
had it set to zero), or leave it at 1 (if the guest
had it set to 1).

But on the VMEXIT if the guest decided to set it to _zero_
before an VMEXIT, then we will leave it at zero and _not_
set the wrmsl to 1!

That is wrong.

And also if the guest did set to 1, then we write 1 to it again.

This fix turns the check around so that the MSR will always
be at MSR 1 - with the optimization that if the guest had
set it, we just keep it at 1.

Orabug: 27364900

Reported-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
arch/x86/kvm/vmx.c