• Sean Christopherson's avatar
    KVM: selftests: Reload "good" vCPU state if vCPU hits shutdown · 5002b112
    Sean Christopherson authored
    Reload known good vCPU state if the vCPU triple faults in any of the
    race_sync_regs() subtests, e.g. if KVM successfully injects an exception
    (the vCPU isn't configured to handle exceptions).  On Intel, the VMCS
    is preserved even after shutdown, but AMD's APM states that the VMCB is
    undefined after a shutdown and so KVM synthesizes an INIT to sanitize
    vCPU/VMCB state, e.g. to guard against running with a garbage VMCB.
    
    The synthetic INIT results in the vCPU never exiting to userspace, as it
    gets put into Real Mode at the reset vector, which is full of zeros (as is
    GPA 0 and beyond), and so executes ADD for a very, very long time.
    
    Fixes: 60c4063b ("KVM: selftests: Extend x86's sync_regs_test to check for event vector races")
    Cc: Michal Luczaj <mhal@rbox.co>
    Link: https://lore.kernel.org/r/20230817233430.1416463-2-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
    5002b112
sync_regs_test.c 9.7 KB