History

Merge tag 'kvm-x86-fixes-6.18-rc2' of https://github.com/kvm-x86/linux into HEAD

KVM x86 fixes for 6.18: - Expand the KVM_PRE_FAULT_MEMORY selftest to add a regression test for the bug fixed by commit 3ccbf6f47098 ("KVM: x86/mmu: Return -EAGAIN if userspace deletes/moves memslot during prefault") - Don't try to get PMU capabbilities from perf when running a CPU with hybrid CPUs/PMUs, as perf will rightly WARN. - Rework KVM_CAP_GUEST_MEMFD_MMAP (newly introduced in 6.18) into a more generic KVM_CAP_GUEST_MEMFD_FLAGS - Add a guest_memfd INIT_SHARED flag and require userspace to explicitly set said flag to initialize memory as SHARED, irrespective of MMAP. The behavior merged in 6.18 is that enabling mmap() implicitly initializes memory as SHARED, which would result in an ABI collision for x86 CoCo VMs as their memory is currently always initialized PRIVATE. - Allow mmap() on guest_memfd for x86 CoCo VMs, i.e. on VMs with private memory, to enable testing such setups, i.e. to hopefully flush out any other lurking ABI issues before 6.18 is officially released. - Add testcases to the guest_memfd selftest to cover guest_memfd without MMAP, and host userspace accesses to mmap()'d private memory.

Paolo Bonzini committed 1 year ago

Commit 4361f5a2 parents 5d26eaa 505f52217 files · +375 −185Browse files

Showing the changes to include/linux (1 of 17 files). Show all

Unified · Split

include/linux/kvm_host.h+11−1
@@ -729,7 +729,17 @@ static inline bool kvm_arch_has_private_mem(struct kvm *kvm) · 728 unmodified lines
729729 #endif
730730
731731 #ifdef CONFIG_KVM_GUEST_MEMFD
732−bool kvm_arch_supports_gmem_mmap(struct kvm *kvm);
732+bool kvm_arch_supports_gmem_init_shared(struct kvm *kvm);
733+
734+static inline u64 kvm_gmem_get_supported_flags(struct kvm *kvm)
735+{
736+ u64 flags = GUEST_MEMFD_FLAG_MMAP;
737+
738+ if (!kvm || kvm_arch_supports_gmem_init_shared(kvm))
739+ flags |= GUEST_MEMFD_FLAG_INIT_SHARED;
740+
741+ return flags;
742+}
733743 #endif
734744
735745 #ifndef kvm_arch_has_readonly_mem

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t