• Sean Christopherson's avatar
    KVM: nVMX: Clear IDT vectoring on nested VM-Exit for double/triple fault · 9bd1f0ef
    Sean Christopherson authored
    Clear the IDT vectoring field in vmcs12 on next VM-Exit due to a double
    or triple fault.  Per the SDM, a VM-Exit isn't considered to occur during
    event delivery if the exit is due to an intercepted double fault or a
    triple fault.  Opportunistically move the default clearing (no event
    "pending") into the helper so that it's more obvious that KVM does indeed
    handle this case.
    
    Note, the double fault case is worded rather wierdly in the SDM:
    
      The original event results in a double-fault exception that causes the
      VM exit directly.
    
    Temporarily ignoring injected events, double faults can _only_ occur if
    an exception occurs while attempting to deliver a different exception,
    i.e. there's _always_ an original event.  And for injected double fault,
    while there's no original event, injected events are never subject to
    interception.
    
    Presumably the SDM is calling out that a the vectoring info will be valid
    if a different exit occurs after a double fault, e.g. if a #PF occurs and
    is intercepted while vectoring #DF, then the vectoring info will show the
    double fault.  In other words, the clause can simply be read as:
    
      The VM exit is caused by a double-fault exception.
    
    Fixes: 4704d0be ("KVM: nVMX: Exiting from L2 to L1")
    Cc: Chenyi Qiang <chenyi.qiang@intel.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20220407002315.78092-4-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    9bd1f0ef
nested.c 210 KB