linux-stable/tools
Paolo Bonzini 17d44a96f0 KVM: SEV: Prohibit migration of a VM that has mirrors
VMs that mirror an encryption context rely on the owner to keep the
ASID allocated.  Performing a KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM
would cause a dangling ASID:

1. copy context from A to B (gets ref to A)
2. move context from A to L (moves ASID from A to L)
3. close L (releases ASID from L, B still references it)

The right way to do the handoff instead is to create a fresh mirror VM
on the destination first:

1. copy context from A to B (gets ref to A)
[later] 2. close B (releases ref to A)
3. move context from A to L (moves ASID from A to L)
4. copy context from L to M

So, catch the situation by adding a count of how many VMs are
mirroring this one's encryption context.

Fixes: 0b020f5af0 ("KVM: SEV: Add support for SEV-ES intra host migration")
Message-Id: <20211123005036.2954379-11-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-30 03:54:14 -05:00
..
accounting
arch tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources 2021-11-18 10:08:07 -03:00
bootconfig bootconfig: Cleanup dummy headers in tools/bootconfig 2021-10-10 22:16:02 -04:00
bpf tools/runqslower: Fix cross-build 2021-11-12 17:23:16 -08:00
build tools build: Fix removal of feature-sync-compare-and-swap feature detection 2021-11-18 10:08:07 -03:00
cgroup
counter tools/counter: Create Counter tools 2021-10-17 10:54:16 +01:00
debugging
edid
firewire
firmware
gpio
hv
iio
include tools headers UAPI: Sync linux/kvm.h with the kernel sources 2021-11-18 10:08:07 -03:00
io_uring
kvm/kvm_stat KVM: kvm_stat: do not show halt_wait_ns 2021-10-18 14:07:18 -04:00
laptop
leds
lib Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2021-11-16 16:53:48 -08:00
memory-model
objtool static_call,x86: Robustify trampoline patching 2021-11-11 13:09:31 +01:00
pci
pcmcia
perf perf evsel: Fix memory leaks relating to unit 2021-11-18 10:19:14 -03:00
power
rcu
scripts tools, build: Add RISC-V to HOSTARCH parsing 2021-11-01 17:08:21 +01:00
spi
testing KVM: SEV: Prohibit migration of a VM that has mirrors 2021-11-30 03:54:14 -05:00
thermal/tmon
time
tracing tools/latency-collector: Use correct size when writing queue_full_warning 2021-10-25 22:27:19 -04:00
usb
virtio
vm tools/vm/page-types.c: print file offset in hexadecimal 2021-11-06 13:30:40 -07:00
wmi
Makefile tools/lib/lockdep: drop liblockdep 2021-11-12 11:07:17 -08:00