Skip to content

Commit 2e2f1e8

Browse files
vittyvkbonzini
authored andcommitted
KVM: x86: hyper-v: Check access to hypercall before reading XMM registers
In case guest doesn't have access to the particular hypercall we can avoid reading XMM registers. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Reviewed-by: Siddharth Chandrasekaran <sidcha@amazon.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210730122625.112848-2-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent fa7a549 commit 2e2f1e8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/x86/kvm/hyperv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,9 +2173,6 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
21732173
hc.rep_idx = (hc.param >> HV_HYPERCALL_REP_START_OFFSET) & 0xfff;
21742174
hc.rep = !!(hc.rep_cnt || hc.rep_idx);
21752175

2176-
if (hc.fast && is_xmm_fast_hypercall(&hc))
2177-
kvm_hv_hypercall_read_xmm(&hc);
2178-
21792176
trace_kvm_hv_hypercall(hc.code, hc.fast, hc.rep_cnt, hc.rep_idx,
21802177
hc.ingpa, hc.outgpa);
21812178

@@ -2184,6 +2181,9 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
21842181
goto hypercall_complete;
21852182
}
21862183

2184+
if (hc.fast && is_xmm_fast_hypercall(&hc))
2185+
kvm_hv_hypercall_read_xmm(&hc);
2186+
21872187
switch (hc.code) {
21882188
case HVCALL_NOTIFY_LONG_SPIN_WAIT:
21892189
if (unlikely(hc.rep)) {

0 commit comments

Comments
 (0)