[LTP] [PATCH v1 1/2] security/dirtyc0w_shmem: Fix runtime absence of UFFD_FEATURE_MINOR_SHMEM

David Hildenbrand david@redhat.com
Fri Nov 25 13:31:28 CET 2022


We have to test if UFFD_FEATURE_MINOR_SHMEM is really returned by the
UFFD_API ioctl: if the kernel knows about the feature but doesn't support
it, it will be masked off.

Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 .../kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
index cb2e9df0c..45cc0ee76 100644
--- a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
+++ b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
@@ -162,6 +162,10 @@ retry:
 			"Could not create userfault file descriptor");
 	}
 
+	if (!(uffdio_api.features & UFFD_FEATURE_MINOR_SHMEM))
+		tst_brk(TCONF,
+			"System does not have userfaultfd minor fault support for shmem");
+
 	uffdio_register.range.start = (unsigned long) map;
 	uffdio_register.range.len = page_size;
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MINOR;
-- 
2.38.1



More information about the ltp mailing list