public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: Do not reset dirty GFNs in a memslot not enabling dirty tracking
@ 2024-12-20  8:20 Yan Zhao
  2024-12-20  8:22 ` [PATCH 1/2] " Yan Zhao
  2024-12-20  8:23 ` [PATCH 2/2] KVM: selftests: TDX: Test dirty ring on a gmemfd slot Yan Zhao
  0 siblings, 2 replies; 5+ messages in thread
From: Yan Zhao @ 2024-12-20  8:20 UTC (permalink / raw)
  To: pbonzini, seanjc; +Cc: peterx, rick.p.edgecombe, linux-kernel, kvm, Yan Zhao

Hi
This series is for a bug where userspace can request KVM to reset dirty
GFNs belonging to a memslot that does not enable dirty tracking.

Patch 1 provides the fix, which can be applied to Linux 6.13-rc3. Although
the fix is a generic one, its primary motivation is to prevent userspace
from triggering write permission reduction or accessed bit clearing in
mirror SPTEs within TDX VMs. This could otherwise cause mismatches between
mirror SPTEs and the corresponding external SPTEs, and in the worst case,
lead to the removal of the external SPTEs.

Patch 2 introduces a selftest for TDX VMs to demonstrate how userspace
could trigger this bug. If necessary, this test can be ported to the
generic KVM selftest (e.g., dirty_log_test).

Thanks
Yan

Yan Zhao (2):
  KVM: Do not reset dirty GFNs in a memslot not enabling dirty tracking
  KVM: selftests: TDX: Test dirty ring on a gmemfd slot

 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/x86_64/tdx_dirty_ring.c     | 231 ++++++++++++++++++
 virt/kvm/dirty_ring.c                         |   3 +-
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/tdx_dirty_ring.c

-- 
2.43.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-23  6:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20  8:20 [PATCH 0/2] KVM: Do not reset dirty GFNs in a memslot not enabling dirty tracking Yan Zhao
2024-12-20  8:22 ` [PATCH 1/2] " Yan Zhao
2024-12-20 17:31   ` Sean Christopherson
2024-12-23  5:37     ` Yan Zhao
2024-12-20  8:23 ` [PATCH 2/2] KVM: selftests: TDX: Test dirty ring on a gmemfd slot Yan Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox