• Sean Christopherson's avatar
    KVM: x86: Bug the VM if the emulator accesses a non-existent GPR · 1cca2f8c
    Sean Christopherson authored
    Bug the VM, i.e. kill it, if the emulator accesses a non-existent GPR,
    i.e. generates an out-of-bounds GPR index.  Continuing on all but
    gaurantees some form of data corruption in the guest, e.g. even if KVM
    were to redirect to a dummy register, KVM would be incorrectly read zeros
    and drop writes.
    
    Note, bugging the VM doesn't completely prevent data corruption, e.g. the
    current round of emulation will complete before the vCPU bails out to
    userspace.  But, the very act of killing the guest can also cause data
    corruption, e.g. due to lack of file writeback before termination, so
    taking on additional complexity to cleanly bail out of the emulator isn't
    justified, the goal is purely to stem the bleeding and alert userspace
    that something has gone horribly wrong, i.e. to avoid _silent_ data
    corruption.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Reviewed-by: default avatarKees Cook <keescook@chromium.org>
    Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Message-Id: <20220526210817.3428868-7-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    1cca2f8c
emulate.c 149 KB