]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: x86/mmu: Check all address spaces before skipping unsync
authorJinu Kim <kimjw04271234@gmail.com>
Tue, 21 Jul 2026 10:35:12 +0000 (19:35 +0900)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 28 Jul 2026 16:07:18 +0000 (18:07 +0200)
commit2e8a2c1b03068d76782343446f1b2114ae2ee0bd
treed1e0c427ec19ad134582690b37d77dbb7d3bcb9a
parent0f38453cdb2e17566ccb7c0f3dabd5bd21caca26
KVM: x86/mmu: Check all address spaces before skipping unsync

mmu_try_to_unsync_pages() skips the shadow-page lookup when the
supplied memslot allows a hugepage, because a shadow page would disallow
hugepages.  But hugepage metadata is per-address-space while shadow pages
are shared across all address spaces.  With SMM, the other address space
can therefore have a shadow page even when the supplied memslot allows a
hugepage.

Check the corresponding memslot in the other address space before
taking the fast path.  Skip the shadow-page lookup only when all address
spaces allow a hugepage.

Fixes: b3ae3ceb5569 ("KVM: x86/mmu: KVM: x86/mmu: Skip unsync when large pages are allowed")
Assisted-by: Codex:GPT-5
Signed-off-by: Jinu Kim <kimjw04271234@gmail.com>
[invert direction of the conditional. - Paolo]
Message-ID: <20260721103512.2136240-3-kimjw04271234@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c