diff mbox series

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

Message ID 20230222115005.223063-1-david@redhat.com
State Accepted
Headers show
Series [v1] security/dirtyc0w_shmem: Fix test with host pagesize != 4k | expand

Commit Message

David Hildenbrand Feb. 22, 2023, 11:50 a.m. UTC
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.

Reported-by: Juri Lelli <juri.lelli@redhat.com>
Reported-by: Bruno Goncalves <bgoncalv@redhat.com>
Tested-by: Chunyu Hu <chuhu@redhat.com>
Cc: Petr Vorel <pvorel@suse.cz>
Cc: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis Feb. 22, 2023, 11:54 a.m. UTC | #1
Hi!
Applied, thanks.
diff mbox series

Patch

diff --git a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
index 9c2b03994..2a982347c 100644
--- a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
+++ b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
@@ -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);
 			}
 		}