[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 02/10] KVM: selftests: Test that ftruncate to non-page-aligne
From: |
Ackerley Tng |
Subject: |
[RFC PATCH 02/10] KVM: selftests: Test that ftruncate to non-page-aligned size on a restrictedmem fd should fail |
Date: |
Thu, 16 Mar 2023 00:30:55 +0000 |
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
---
tools/testing/selftests/vm/memfd_restricted.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/vm/memfd_restricted.c
b/tools/testing/selftests/vm/memfd_restricted.c
index 43a512f273f7..9c4e6a0becbc 100644
--- a/tools/testing/selftests/vm/memfd_restricted.c
+++ b/tools/testing/selftests/vm/memfd_restricted.c
@@ -38,6 +38,11 @@ static void test_file_size(int fd)
{
struct stat sb;
+ if (!ftruncate(fd, page_size + 1)) {
+ fail("ftruncate to non page-aligned sizes should fail\n");
+ return;
+ }
+
if (ftruncate(fd, page_size)) {
fail("ftruncate failed\n");
return;
--
2.40.0.rc2.332.ga46443480c-goog
- [RFC PATCH 00/10] Additional selftests for restrictedmem, Ackerley Tng, 2023/03/15
- [RFC PATCH 01/10] KVM: selftests: Test error message fixes for memfd_restricted selftests, Ackerley Tng, 2023/03/15
- [RFC PATCH 02/10] KVM: selftests: Test that ftruncate to non-page-aligned size on a restrictedmem fd should fail,
Ackerley Tng <=
- [RFC PATCH 03/10] KVM: selftests: Test that VM private memory should not be readable from host, Ackerley Tng, 2023/03/15
- [RFC PATCH 04/10] KVM: selftests: Exercise restrictedmem allocation and truncation code after KVM invalidation code has been unbound, Ackerley Tng, 2023/03/15
- [RFC PATCH 05/10] KVM: selftests: Generalize private_mem_conversions_test for parallel execution, Ackerley Tng, 2023/03/15
- [RFC PATCH 06/10] KVM: selftests: Default private_mem_conversions_test to use 1 memslot for test data, Ackerley Tng, 2023/03/15
- [RFC PATCH 07/10] KVM: selftests: Add vm_userspace_mem_region_add_with_restrictedmem, Ackerley Tng, 2023/03/15
- [RFC PATCH 08/10] KVM: selftests: Default private_mem_conversions_test to use 1 restrictedmem file for test data, Ackerley Tng, 2023/03/15
- [RFC PATCH 09/10] KVM: selftests: Add tests around sharing a restrictedmem fd, Ackerley Tng, 2023/03/15
- [RFC PATCH 10/10] KVM: selftests: Test KVM exit behavior for private memory/access, Ackerley Tng, 2023/03/15