From: Ackerley Tng Verify that allocating memory across guest_memfd instances sharing a tmpfs resource pool fails with ENOSPC when the total allocation exceeds the pool capacity. Signed-off-by: Ackerley Tng --- tools/testing/selftests/kvm/guest_memfd_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c index 639b1b0c204ed..20de24ad535f1 100644 --- a/tools/testing/selftests/kvm/guest_memfd_test.c +++ b/tools/testing/selftests/kvm/guest_memfd_test.c @@ -604,6 +604,10 @@ static void test_resource_fd_tmpfs_shared_pool(struct kvm_vm *vm) TEST_ASSERT(!fstatvfs(pool_fd, &svfs), "fstatvfs on pool_fd should succeed"); TEST_ASSERT_EQ(svfs.f_blocks - svfs.f_bfree, 2); + ret = fallocate(fd2, FALLOC_FL_KEEP_SIZE, page_size, page_size); + TEST_ASSERT(ret < 0, "fallocate exceeding pool capacity should fail"); + TEST_ASSERT_EQ(errno, ENOSPC); + close(fd2); close(fd1); close(pool_fd); -- 2.56.0.257.gf7497c7d27-goog