]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: Harden and prepare for modifying existing guest_memfd memslots
authorSean Christopherson <seanjc@google.com>
Tue, 2 Dec 2025 02:03:34 +0000 (18:03 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 2 Dec 2025 16:49:37 +0000 (08:49 -0800)
commitaf62fe2494da84eb01752282c8228c9bb3fe9f67
treeb3e0e2442baad42485af1f35df4033a209e48584
parent9935df5333aa503a18de5071f53762b65c783c4c
KVM: Harden and prepare for modifying existing guest_memfd memslots

Unbind guest_memfd memslots if KVM commits a MOVE or FLAGS_ONLY memslot
change to harden against use-after-free, and to prepare for eventually
supporting dirty logging on guest_memfd memslots, at which point
FLAGS_ONLY changes will be expected/supported.

Add two separate WARNs, once to yell if a guest_memfd memslot is moved
(which KVM is never expected to allow/support), and again if the unbind()
is triggered, to help detect uAPI goofs prior to deliberately allowing
FLAGS_ONLY changes.

Link: https://patch.msgid.link/20251202020334.1171351-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
virt/kvm/kvm_main.c