mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinu Kim <kimjw04271234@gmail.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] KVM: x86/mmu: fix cross-address-space MMU metadata checks
Date: Tue, 21 Jul 2026 19:35:10 +0900	[thread overview]
Message-ID: <20260721103512.2136240-1-kimjw04271234@gmail.com> (raw)

The x86 shadow MMU keeps write-tracking and hugepage metadata per address
space, but shares the shadow-page hash across all address spaces.  With SMM,
checking only the supplied memslot can therefore miss metadata for the same
GFN in the other address space.

For write tracking, this can allow an upper-level shadow page to become
unsync.  Synchronizing the page later can treat a non-leaf SPTE as a leaf and
reach the BUG in pte_list_remove().  The observed nested-VMX failure was:

  WARNING: mmu_try_to_unsync_pages
  WARNING: ept_sync_spte
  kernel BUG at arch/x86/kvm/mmu/mmu.c:1104
  RIP: pte_list_remove.isra.0

Patch 1 makes kvm_gfn_is_write_tracked() check both x86 address spaces so
that all callers honor write tracking regardless of the active address
space.

Patch 2 makes the hugepage fast path in mmu_try_to_unsync_pages() check both
address spaces before skipping the shadow-page lookup.  It is kept separate
because the hugepage optimization was added much more recently than the
write-tracking bug.

The series is based on commit
6bc96b971766fbbbbdd9fb2642cedacaf02da957.

Testing on Intel VMX:

- Patch 1 alone completed the reproducer without a KVM warning or fault;
  vmx_pf_exception_test passed all 75 checks.
- Patch 2 alone built and loaded successfully; vmx_pse_test passed all 92
  checks.
- The full series completed the reproducer without a KVM warning or fault;
  vmx_pse_test passed all 92 checks with EPT enabled and all 92 checks with
  EPT disabled.
- bzImage, kvm.ko, kvm-intel.ko, and irqbypass.ko built successfully with
  CONFIG_KVM_WERROR=y.

Changes from v1:

- Split the write-tracking and hugepage fixes for independent backporting.
- Move the cross-address-space write-tracking check into
  kvm_gfn_is_write_tracked() so that all callers are covered.
- Check the supplied memslot before consulting the other address space.

Jinu Kim (2):
  KVM: x86/mmu: Check write tracking in all address spaces
  KVM: x86/mmu: Check all address spaces before skipping unsync

 arch/x86/kvm/mmu/mmu.c        | 21 ++++++++++++++++++++-
 arch/x86/kvm/mmu/page_track.c | 26 +++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 4 deletions(-)

--
2.43.0

             reply	other threads:[~2026-07-21 10:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 10:35 Jinu Kim [this message]
2026-07-21 10:35 ` [PATCH v2 1/2] KVM: x86/mmu: Check write tracking in all address spaces Jinu Kim
2026-07-21 10:35 ` [PATCH v2 2/2] KVM: x86/mmu: Check all address spaces before skipping unsync Jinu Kim
2026-07-28 16:18   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260721103512.2136240-1-kimjw04271234@gmail.com \
    --to=kimjw04271234@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®