• Sean Christopherson's avatar
    KVM: x86/mmu: Get root level from walkers when retrieving MMIO SPTE · 39b4d43e
    Sean Christopherson authored
    Get the so called "root" level from the low level shadow page table
    walkers instead of manually attempting to calculate it higher up the
    stack, e.g. in get_mmio_spte().  When KVM is using PAE shadow paging,
    the starting level of the walk, from the callers perspective, is not
    the CR3 root but rather the PDPTR "root".  Checking for reserved bits
    from the CR3 root causes get_mmio_spte() to consume uninitialized stack
    data due to indexing into sptes[] for a level that was not filled by
    get_walk().  This can result in false positives and/or negatives
    depending on what garbage happens to be on the stack.
    
    Opportunistically nuke a few extra newlines.
    
    Fixes: 95fb5b02 ("kvm: x86/mmu: Support MMIO in the TDP MMU")
    Reported-by: default avatarRichard Herbert <rherbert@sympatico.ca>
    Cc: Ben Gardon <bgardon@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20201218003139.2167891-3-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    39b4d43e
tdp_mmu.c 31.5 KB