KVM: SVM: Inject #UD on attempted emulation for SEV guest w/o insn buffer
authorSean Christopherson <seanjc@google.com>
Thu, 20 Jan 2022 01:07:17 +0000 (01:07 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 26 Jan 2022 17:15:01 +0000 (12:15 -0500)
commit04c40f344defdbd842d8a64fcfb47ef74b39ef4e
treec46030181a7656c76e9c9e46f28b84188914a49c
parent132627c64d94b1561ba5a444824e46c9f84c3d5b
KVM: SVM: Inject #UD on attempted emulation for SEV guest w/o insn buffer

Inject #UD if KVM attempts emulation for an SEV guests without an insn
buffer and instruction decoding is required.  The previous behavior of
allowing emulation if there is no insn buffer is undesirable as doing so
means KVM is reading guest private memory and thus decoding cyphertext,
i.e. is emulating garbage.  The check was previously necessary as the
emulation type was not provided, i.e. SVM needed to allow emulation to
handle completion of emulation after exiting to userspace to handle I/O.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Message-Id: <20220120010719.711476-8-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c