Re: [PATCH 3/3] KVM: nVMX: Clear IDT vectoring on nested VM-Exit for double/triple fault

From: Xiaoyao Li
Date: Thu Apr 07 2022 - 04:42:20 EST


On 4/7/2022 4:02 PM, Xiaoyao Li wrote:
On 4/7/2022 8:23 AM, Sean Christopherson wrote:
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.

Wouldn't it be a tripe fault exit in this case?

It won't since #PF is intercepted by exception bitmap in your case.

In other words, the clause can simply be read as:

   The VM exit is caused by a double-fault exception.