public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: Fix a guest_memfd memslot UAF
@ 2025-12-02  2:03 Sean Christopherson
  2025-12-02  2:03 ` [PATCH 1/2] KVM: Disallow toggling KVM_MEM_GUEST_MEMFD on an existing memslot Sean Christopherson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sean Christopherson @ 2025-12-02  2:03 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Alexander Potapenko, Sean Christopherson

Fix a UAF due to leaving a dangling guest_memfd memslot binding by
disallowing clearing KVM_MEM_GUEST_MEMFD on a memslot.  The intent was
that guest_memfd memslots would be immutable (could only be deleted),
but somewhat ironically we missed the case where KVM_MEM_GUEST_MEMFD
itself is the only flag that's toggled.

This is an ABI change, but I can't imagine anyone was relying on
disappearing a guest_memfd memslot.

Patch 2 hardens against the UAF, and prepares for allowing FLAGS_ONLY
changes on guest_memfd memslots.  Sooner or later, we're going to allow
dirty logging on guest_memfd, so I think it makes sense to guard against
that so that whoever adds dirty logging support doesn't forget to unbind
on a FLAGS_ONLY change.

I'll respond with the syzkaller reproducer (it's comically simple).

Sean Christopherson (2):
  KVM: Disallow toggling KVM_MEM_GUEST_MEMFD on an existing memslot
  KVM: Harden and prepare for modifying existing guest_memfd memslots

 virt/kvm/kvm_main.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)


base-commit: 115d5de2eef32ac5cd488404b44b38789362dbe6
-- 
2.52.0.107.ga0afd4fd5b-goog


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

end of thread, other threads:[~2025-12-05 17:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02  2:03 [PATCH 0/2] KVM: Fix a guest_memfd memslot UAF Sean Christopherson
2025-12-02  2:03 ` [PATCH 1/2] KVM: Disallow toggling KVM_MEM_GUEST_MEMFD on an existing memslot Sean Christopherson
2025-12-02  2:03 ` [PATCH 2/2] KVM: Harden and prepare for modifying existing guest_memfd memslots Sean Christopherson
2025-12-02 15:27 ` [PATCH 0/2] KVM: Fix a guest_memfd memslot UAF Sean Christopherson
2025-12-05 16:59 ` Sean Christopherson

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