linux/tools/testing/selftests/kvm
Sean Christopherson 87c810160e KVM: selftests: Ensure gmem file sizes are multiple of host page size
When creating a guest_memfd file and associated memslot to validate shared
guest memory, size the file+memslot to the maximum of the host or guest
page size.  Attempting to allocate a single guest page will fail if the
host page size is greater than the guest page size, as KVM requires that
the size of memslots and guest_memfd files are a multiple of the host page
size.

For simplicity, verify the entire file can be shared between guest and host,
e.g. instead of trying to validate "partial" mappings.

Fixes: 42188667be ("KVM: selftests: Add guest_memfd testcase to fault-in on !mmap()'d memory")
Reported-by: Zenghui Yu <zenghui.yu@linux.dev>
Closes: https://lore.kernel.org/all/0064952b-048c-455d-ad89-e27e5cb82591@linux.dev
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20260512155634.772602-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
History 2026-05-12 22:26:10 +02:00
..
arm64 KVM selftests type renames for 7.1 2026-04-27 04:24:41 -04:00
include KVM: selftests: Replace "paddr" with "gpa" throughout 2026-04-20 14:54:17 -07:00
lib KVM: selftests: Replace "paddr" with "gpa" throughout 2026-04-20 14:54:17 -07:00
loongarch KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
riscv KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
s390 KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
x86 KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
.gitignore KVM: selftests: Provide empty 'all' and 'clean' targets for unsupported ARCHs 2024-12-18 14:15:03 -08:00
access_tracking_perf_test.c KVM: selftests: Replace "vaddr" with "gva" throughout 2026-04-20 14:54:17 -07:00
arch_timer.c KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
coalesced_io_test.c KVM: selftests: Use u8 instead of uint8_t 2026-04-20 14:54:17 -07:00
config KVM: selftests: Add CONFIG_EVENTFD for irqfd selftest 2025-07-10 06:20:20 -07:00
demand_paging_test.c KVM: selftests: Use u64 instead of uint64_t 2026-04-20 14:54:16 -07:00
dirty_log_perf_test.c KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
dirty_log_test.c KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
get-reg-list.c KVM: selftests: Use u8 instead of uint8_t 2026-04-20 14:54:17 -07:00
guest_memfd_test.c KVM: selftests: Ensure gmem file sizes are multiple of host page size 2026-05-12 22:26:10 +02:00
guest_print_test.c KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
hardware_disable_test.c KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
irqfd_test.c KVM: selftests: Fix irqfd_test for non-x86 architectures 2025-10-13 14:17:03 +01:00
kvm_binary_stats_test.c KVM: selftests: Define wrappers for common syscalls to assert success 2025-10-20 06:30:42 -07:00
kvm_create_max_vcpus.c KVM: selftests: Adjust number of files rlimit for all "standard" VMs 2025-02-14 07:02:12 -08:00
kvm_page_table_test.c KVM: selftests: Use u32 instead of uint32_t 2026-04-20 14:54:16 -07:00
Makefile KVM: selftests: Forcefully override ARCH from x86_64 to x86 2025-10-20 08:55:24 -07:00
Makefile.kvm - ESA nesting support 2026-04-13 19:01:15 +02:00
memslot_modification_stress_test.c KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
memslot_perf_test.c KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
mmu_stress_test.c KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
pre_fault_memory_test.c KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
rseq_test.c KVM: selftests: Add missing "break" in rseq_test's param parsing 2025-12-02 08:49:10 -08:00
set_memory_region_test.c KVM: selftests: Replace "u64 gpa" with "gpa_t" throughout 2026-04-20 14:54:17 -07:00
settings selftests: kvm: Raise the default timeout to 120 seconds 2021-02-09 08:17:08 -05:00
steal_time.c KVM: selftests: arm64: Fix steal_time test after UAPI refactoring 2026-05-06 17:09:03 +01:00
system_counter_offset_test.c KVM: selftests: Use u64 instead of uint64_t 2026-04-20 14:54:16 -07:00