Re: [PATCH] KVM: x86: Extend Spectre-v1 mitigation
From: Sean Christopherson
Date: Fri Nov 22 2019 - 17:20:17 EST
On Sat, Nov 23, 2019 at 12:03:27AM +0200, Liran Alon wrote:
>
> > On 22 Nov 2019, at 20:40, Marios Pomonis <pomonis@xxxxxxxxxx> wrote:
> > @@ -5828,6 +5836,8 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
> > {
> > struct vcpu_vmx *vmx = to_vmx(vcpu);
> > u32 exit_reason = vmx->exit_reason;
> > + u32 bounded_exit_reason = array_index_nospec(exit_reason,
> > + kvm_vmx_max_exit_handlers);
>
> Unlike the rest of this patch changes, exit_reason is not attacker-controllable.
> Therefore, I donât think we need this change to vmx_handle_exit().
I waffled on this one too. Theoretically, if an attacker finds a way to
trigger a VM-Exit that isn't yet known to KVM, and coordinates across
userspace and guest to keep rerunning the attack in the guest instead of
killing the VM (on the unexpected VM-Exit), then exit_reason is sort of
under attacker control.
Of course the above scenario would require a bug in KVM, e.g. enable an
unknown enabling/exiting control, or in a CPU, e.g. generate a new VM-Exit
without software opt-in or generate a completely bogus VM-Exit. The
whole thing is pretty far fetched...