]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Ensure local memslot copies operate on up-to-date arch-specific data
authorSean Christopherson <seanjc@google.com>
Thu, 4 Nov 2021 00:25:02 +0000 (00:25 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 Nov 2021 07:15:19 +0000 (02:15 -0500)
commitb5c7ae17b4103580e559915998a50c2f0db182f1
tree07ad02921f801906d9ff13c5d9e53a91d88231ff
parent45c314e537fb87b9ec6b23a801e70faa81b1a3c3
KVM: Ensure local memslot copies operate on up-to-date arch-specific data

When modifying memslots, snapshot the "old" memslot and copy it to the
"new" memslot's arch data after (re)acquiring slots_arch_lock.  x86 can
change a memslot's arch data while memslot updates are in-progress so
long as it holds slots_arch_lock, thus snapshotting a memslot without
holding the lock can result in the consumption of stale data.

Fixes: 2448be32c93a ("KVM: mmu: Add slots_arch_lock for memslot arch fields")
Cc: stable@vger.kernel.org
Cc: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211104002531.1176691-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c