lkml.org 
[lkml]   [2017]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC Part2 PATCH v3 25/26] KVM: SVM: Do not install #UD intercept when SEV is enabled
    Date
    On #UD, x86_emulate_instruction() fetches the data from guest memory and
    decodes the instruction bytes to assist further. When SEV is enabled, the
    instruction bytes will be encrypted using the guest-specific key, hypervisor
    will no longer able to fetch the instruction bytes to assist UD handling.
    By not installing intercept we let the guest receive and handle #UD.

    Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
    ---
    arch/x86/kvm/svm.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
    index 64b9f60..4581d03 100644
    --- a/arch/x86/kvm/svm.c
    +++ b/arch/x86/kvm/svm.c
    @@ -1432,8 +1432,10 @@ static void init_vmcb(struct vcpu_svm *svm)
    svm->vmcb->control.virt_ext |= VIRTUAL_VMLOAD_VMSAVE_ENABLE_MASK;
    }

    - if (sev_guest(svm->vcpu.kvm))
    + if (sev_guest(svm->vcpu.kvm)) {
    svm->vmcb->control.nested_ctl |= SVM_NESTED_CTL_SEV_ENABLE;
    + clr_exception_intercept(svm, UD_VECTOR);
    + }

    mark_all_dirty(svm->vmcb);

    --
    2.9.4
    \
     
     \ /
      Last update: 2017-07-24 22:13    [W:2.787 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site