Skip to contentSkip to conversation

security/dirtyc0w_shmem: Fix test with host pagesize != 4k

PATCH In review David Hildenbrand 2 participants 2 messages Feb 22, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security/dirtyc0w_shmem: Fix test with host pagesize != 4k

The test can currently fail if the host page size is not 4k, because we forgot to replace a hard-coded 4k by the actual page size. So if we end up having to trigger a UFFDIO_WAKE, that ioctl will fail because it's not aligned to the host page size.

---
 testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c +1 -1
index 9c2b03994..2a982347c 100644
@@ -115,7 +115,7 @@ static void *uffd_thread_fn(void *arg)
 		if (ioctl(uffd, UFFDIO_CONTINUE, &uffdio) < 0) {
 			if (errno == EEXIST) {
 				uffdio_wake.start = (unsigned long) map;
-				uffdio_wake.len = 4096;
+				uffdio_wake.len = page_size;
 				SAFE_IOCTL(uffd, UFFDIO_WAKE, &uffdio_wake);
 			}
 		}
Signature · 5 lines
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp