Re: [PATCH v2 12/13] KVM: selftests: Verify that faulting in private guest_memfd memory fails

Ackerley Tng
2025-10-06T18:26:33Z

Sean Christopherson <seanjc@google.com> writes:

> Add a guest_memfd testcase to verify that faulting in private memory gets
> a SIGBUS. For now, test only the case where memory is private by default
> since KVM doesn't yet support in-place conversion.
>
> Deliberately run the CoW test with and without INIT_SHARED set as KVM
> should disallow MAP_PRIVATE regardless of whether the memory itself is
> private from a CoCo perspective.
>
> Cc: Ackerley Tng <ackerleytng@google.com>

Thanks Sean!

Tested-by: Ackerley Tng <ackerleytng@google.com>

> Reviewed-by: Fuad Tabba <tabba@google.com>
> Tested-by: Fuad Tabba <tabba@google.com>
> Reviewed-by: David Hildenbrand <david@redhat.com>
> Reviewed-by: Ackerley Tng <ackerleytng@google.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> .../testing/selftests/kvm/guest_memfd_test.c | 26 +++++++++++++++----
> 1 file changed, 21 insertions(+), 5 deletions(-)
>
>
> [...snip...]
>