• David Matlack's avatar
    KVM: x86/mmu: Check SPTE writable invariants when setting leaf SPTEs · 115111ef
    David Matlack authored
    Check SPTE writable invariants when setting SPTEs rather than in
    spte_can_locklessly_be_made_writable(). By the time KVM checks
    spte_can_locklessly_be_made_writable(), the SPTE has long been since
    corrupted.
    
    Note that these invariants only apply to shadow-present leaf SPTEs (i.e.
    not to MMIO SPTEs, non-leaf SPTEs, etc.). Add a comment explaining the
    restriction and only instrument the code paths that set shadow-present
    leaf SPTEs.
    
    To account for access tracking, also check the SPTE writable invariants
    when marking an SPTE as an access track SPTE. This also lets us remove
    a redundant WARN from mark_spte_for_access_track().
    Suggested-by: default avatarSean Christopherson <seanjc@google.com>
    Signed-off-by: default avatarDavid Matlack <dmatlack@google.com>
    Message-Id: <20220125230518.1697048-3-dmatlack@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    115111ef
tdp_mmu.c 44.7 KB