KVM: x86/mmu: Check write tracking in all address spaces
authorJinu Kim <kimjw04271234@gmail.com>
Tue, 21 Jul 2026 10:35:11 +0000 (19:35 +0900)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 28 Jul 2026 16:07:14 +0000 (18:07 +0200)
commit0f38453cdb2e17566ccb7c0f3dabd5bd21caca26
tree7a440936926a11aa8b70ea54da7c59bf98926590
parent9910e835580fef3bef53b70241dd00c4bffad693
KVM: x86/mmu: Check write tracking in all address spaces

kvm_gfn_is_write_tracked() checks only the supplied memslot, but page
tracking is per-address-space and shadow pages are shared across all
address spaces.  With SMM, a GFN can therefore be write-tracked in one
address space and appear untracked through the other.

Check the supplied slot first, then the slot for the other address space.
This ensures all callers honor write tracking regardless of the active
address space.  In particular, it prevents mmu_try_to_unsync_pages() from
marking an upper-level shadow page unsync and eventually triggering the
BUG in pte_list_remove().

Fixes: 699023e23965 ("KVM: x86: add SMM to the MMU role, support SMRAM address space")
Assisted-by: Codex:GPT-5
Signed-off-by: Jinu Kim <kimjw04271234@gmail.com>
Message-ID: <20260721103512.2136240-2-kimjw04271234@gmail.com>
[invert direction of the conditional. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/page_track.c