From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A27D3346A5; Sat, 26 Sep 2026 00:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790383852; cv=none; b=oPKMn3L2VqiK24RHf5y3+klUj39H1kkB40ta3RLxYBS80lvRg5kEGIE1EkhZf3TUxnAYonuB36E3oyflveGvmApvrOTURaDPEyCQSA+NQYSIGzRhxbJ9sokVvESY9rSTMiuLuXSh5RLeJGA3WScXyvdhLEv3snERJr5dte3Flwk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790383852; c=relaxed/simple; bh=5/cQzYd8fqzTOg8mKWSvdV8HZjeJHOyZjj75J5Oa7hk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ShH1lOJRqsVR/CGR+diqLtAV9gho5DBw1efrDgPjkwNv4HKosGznU9UqImzC6AOfrKwV/J4HG2kW7IovrmQLTM6LTh3NmmP+sKkmfhs7YlPuEhxTnl2iW1eIfkeNo5q34SQRMCQoSdAq1MXkJm55v9SkGJzdQWG1BTwcfBPhXhw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U4E/LiUX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U4E/LiUX" Received: by smtp.kernel.org (Postfix) with ESMTPS id 576E8C32781; Sat, 26 Sep 2026 00:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1790383852; bh=5/cQzYd8fqzTOg8mKWSvdV8HZjeJHOyZjj75J5Oa7hk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=U4E/LiUXSVubNsZ0cfpAqoFV4syPvEb+WrEFI89clDttYWAycljBoK4g4ANa2dC3E muBC8h50A72YId3l81sRTycOfVRTyRYHD3NeCoQ67JlTRYx1fCqroHFDRiN+vhWBZG J4T5qwS0/kGVsP5nPZZ9U5PkUEAV7l/j/2iSx0F/lA0W+b6k3xze3h6A0sa3BGC3DY WgrDs31RBTxnrXmLsyvnloj6ehGKOj453q1I2llHzuBfzPr0UvHyPE7BfjISD8QV8H fqVi0tzpHH714e96bYZDdhrMxbLtqriN/ikDL1eZ2nBhT9vykEuKr6sUDmCMtrlM42 FSknee/AgKEfA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43991C9832A; Sat, 26 Sep 2026 00:50:52 +0000 (UTC) From: Ackerley Tng via B4 Relay Date: Fri, 25 Sep 2026 17:51:02 -0700 Subject: [PATCH RFC 15/17] KVM: selftests: Test that shared tmpfs resource pool size limit is respected Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260925-gmem-tmpfs-backend-v1-15-d36159822d18@google.com> References: <20260925-gmem-tmpfs-backend-v1-0-d36159822d18@google.com> In-Reply-To: <20260925-gmem-tmpfs-backend-v1-0-d36159822d18@google.com> To: Hugh Dickins , Baolin Wang , Andrew Morton , Sean Christopherson , Paolo Bonzini , David Hildenbrand , Jonathan Corbet , Shuah Khan , Randy Dunlap , Shuah Khan , vannapurve@google.com, erdemaktas@google.com, jxgao@google.com, rientjes@google.com, fvdl@google.com, jthoughton@google.com, tarunsahu@google.com, pratyush@kernel.org, fuad.tabba@linux.dev, Gregory Price , David Woodhouse , yan.y.zhao@intel.com, michael.roth@amd.com, suzuki.poulose@arm.com, Christian Brauner , Jason Gunthorpe , Nicolin Chen , Xu Yilun , aik@amd.com, aneesh.kumar@kernel.org, Vlastimil Babka Cc: kernel-team@android.com, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Ackerley Tng X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1790383850; l=1071; i=ackerleytng@google.com; s=20260225; h=from:subject:message-id; bh=LYaWdpJzCkqMc0cwd4SOwmT9cG2Uo3iISC2Ej6mccuI=; b=v+92DC6DUz9lNIvijcxuMoxkfc5r4UqB10ZU3FgF47IUvXWKQgYCrNJ0XKHWwuTdC3dPvdnG6 4hdrV4A7wTyCiqSPEQCx+DYbg1gp+gVq9h06KzPVPQuzQCx/iv6FIN1 X-Developer-Key: i=ackerleytng@google.com; a=ed25519; pk=sAZDYXdm6Iz8FHitpHeFlCMXwabodTm7p8/3/8xUxuU= X-Endpoint-Received: by B4 Relay for ackerleytng@google.com/20260225 with auth_id=649 X-Original-From: Ackerley Tng Reply-To: ackerleytng@google.com 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 4610eeab39be6..345b41c912a18 100644 --- a/tools/testing/selftests/kvm/guest_memfd_test.c +++ b/tools/testing/selftests/kvm/guest_memfd_test.c @@ -587,6 +587,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.rc1.315.gc6ed9934b7-goog