[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aafe6087-bf26-4ab6-8ed7-823c366c9650@amd.com>
Date: Thu, 7 Aug 2025 13:42:50 +0530
From: Shivank Garg <shivankg@....com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>
Cc: kvm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev, linux-kernel@...r.kernel.org,
Ira Weiny <ira.weiny@...el.com>, Gavin Shan <gshan@...hat.com>,
Vlastimil Babka <vbabka@...e.cz>, Xiaoyao Li <xiaoyao.li@...el.com>,
David Hildenbrand <david@...hat.com>, Fuad Tabba <tabba@...gle.com>,
Ackerley Tng <ackerleytng@...gle.com>, Tao Chan <chentao@...inos.cn>,
James Houghton <jthoughton@...gle.com>
Subject: Re: [PATCH v17 23/24] KVM: selftests: guest_memfd mmap() test when
mmap is supported
On 7/30/2025 4:24 AM, Sean Christopherson wrote:
> From: Fuad Tabba <tabba@...gle.com>
>
> Expand the guest_memfd selftests to comprehensively test host userspace
> mmap functionality for guest_memfd-backed memory when supported by the
> VM type.
>
> Introduce new test cases to verify the following:
>
> * Successful mmap operations: Ensure that MAP_SHARED mappings succeed
> when guest_memfd mmap is enabled.
>
> * Data integrity: Validate that data written to the mmap'd region is
> correctly persistent and readable.
>
> * fallocate interaction: Test that fallocate(FALLOC_FL_PUNCH_HOLE)
> correctly zeros out mapped pages.
>
> * Out-of-bounds access: Verify that accessing memory beyond the
> guest_memfd's size correctly triggers a SIGBUS signal.
>
> * Unsupported mmap: Confirm that mmap attempts fail as expected when
> guest_memfd mmap support is not enabled for the specific guest_memfd
> instance or VM type.
>
> * Flag validity: Introduce test_vm_type_gmem_flag_validity() to
> systematically test that only allowed guest_memfd creation flags are
> accepted for different VM types (e.g., GUEST_MEMFD_FLAG_MMAP for
> default VMs, no flags for CoCo VMs).
>
> The existing tests for guest_memfd creation (multiple instances, invalid
> sizes), file read/write, file size, and invalid punch hole operations
> are integrated into the new test_with_type() framework to allow testing
> across different VM types.
>
> Cc: James Houghton <jthoughton@...gle.com>
> Cc: Gavin Shan <gshan@...hat.com>
> Cc: Shivank Garg <shivankg@....com>
> Co-developed-by: Ackerley Tng <ackerleytng@...gle.com>
> Signed-off-by: Ackerley Tng <ackerleytng@...gle.com>
> Signed-off-by: Fuad Tabba <tabba@...gle.com>
> Co-developed-by: Sean Christopherson <seanjc@...gle.com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> .../testing/selftests/kvm/guest_memfd_test.c | 161 +++++++++++++++---
> 1 file changed, 139 insertions(+), 22 deletions(-)
>
Reviewed-by: Shivank Garg <shivankg@....com>
Powered by blists - more mailing lists