linux/tools/testing/selftests/kvm
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
..
aarch64 Merge branch kvm-arm64/selftest/timer into kvmarm-master/next 2021-10-17 11:19:42 +01:00
include Merge branch 'kvm-selftest' into kvm-master 2021-11-16 13:21:13 -05:00
lib Merge branch 'kvm-selftest' into kvm-master 2021-11-16 13:21:13 -05:00
s390x KVM: selftests: sync_regs test for diag318 2020-12-10 13:36:05 +01:00
x86_64 KVM: SEV: Prohibit migration of a VM that has mirrors 2021-11-30 03:54:14 -05:00
.gitignore selftests: KVM: Add /x86_64/sev_migrate_tests to .gitignore 2021-11-18 02:12:13 -05:00
access_tracking_perf_test.c KVM: selftests: Move vCPU thread creation and joining to common helpers 2021-11-16 07:43:28 -05:00
config selftests: kvm: Adding config fragments 2019-08-09 16:52:38 +02:00
demand_paging_test.c KVM: selftests: Move vCPU thread creation and joining to common helpers 2021-11-16 07:43:28 -05:00
dirty_log_perf_test.c KVM: selftests: Move vCPU thread creation and joining to common helpers 2021-11-16 07:43:28 -05:00
dirty_log_test.c KVM: selftests: Expose align() helpers to tests 2021-11-16 07:43:24 -05:00
hardware_disable_test.c KVM: selftests: Unconditionally use memslot 0 when loading elf binary 2021-06-24 04:31:17 -04:00
kvm_binary_stats_test.c KVM: selftests: Add checks for histogram stats bucket_size field 2021-08-20 16:06:32 -04:00
kvm_create_max_vcpus.c KVM: selftests: Make sure kvm_create_max_vcpus test won't hit RLIMIT_NOFILE 2021-11-26 08:14:20 -05:00
kvm_page_table_test.c KVM: selftests: page_table_test: fix calculation of guest_test_phys_mem 2021-11-30 03:12:13 -05:00
Makefile selftest: KVM: Add intra host migration tests 2021-11-11 10:36:17 -05:00
memslot_modification_stress_test.c KVM: selftests: Use perf_test_destroy_vm in memslot_modification_stress_test 2021-11-16 07:43:28 -05:00
memslot_perf_test.c KVM: selftests: Make memslot_perf_test arch independent 2021-10-21 11:36:34 +01:00
rseq_test.c KVM: selftests: Ensure all migrations are performed when test is affined 2021-09-30 04:25:57 -04:00
set_memory_region_test.c Merge tag 'kvm-s390-master-5.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD 2021-07-14 12:14:27 -04:00
settings selftests: kvm: Raise the default timeout to 120 seconds 2021-02-09 08:17:08 -05:00
steal_time.c x86: 2021-09-27 13:58:23 -07:00
system_counter_offset_test.c selftests: KVM: Introduce system counter offset test 2021-10-18 14:43:46 -04:00