1From c77e5f1b6503ac157abd9a19f021b47fd44ddd37 Mon Sep 17 00:00:00 2001
2From: Edward Liaw <[email protected]>
3Date: Wed, 11 May 2022 00:54:45 +0000
4Subject: [PATCH 19/20] userfaultfd: pagemap not supported < 5.14
5
6Disable uffd tests with pagemap until Android kernel catches up
7
8Bug: 232026677
9Signed-off-by: Edward Liaw <[email protected]>
10---
11 tools/testing/selftests/vm/userfaultfd.c | 12 ++++++++++++
12 1 file changed, 12 insertions(+)
13
14diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c
15index 28230a57fedd..e905bb502667 100644
16--- a/tools/testing/selftests/vm/userfaultfd.c
17+++ b/tools/testing/selftests/vm/userfaultfd.c
18@@ -1444,6 +1444,11 @@ static int userfaultfd_minor_test(void)
19 #define PM_SWAP                       BIT_ULL(62)
20 #define PM_PRESENT                    BIT_ULL(63)
21
22+/*
23+ * b/232026677
24+ * pagemap not compatible with < 5.14
25+ */
26+#ifndef __ANDROID__
27 static int pagemap_open(void)
28 {
29 	int fd = open("/proc/self/pagemap", O_RDONLY);
30@@ -1569,6 +1574,7 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize)
31 	close(pagemap_fd);
32 	printf("done\n");
33 }
34+#endif
35
36 static int userfaultfd_stress(void)
37 {
38@@ -1702,6 +1708,11 @@ static int userfaultfd_stress(void)
39 		uffd_stats_report(uffd_stats, nr_cpus);
40 	}
41
42+/*
43+ * b/232026677
44+ * pagemap not compatible with < 5.14
45+ */
46+#ifndef __ANDROID__
47 	if (test_type == TEST_ANON) {
48 		/*
49 		 * shmem/hugetlb won't be able to run since they have different
50@@ -1716,6 +1727,7 @@ static int userfaultfd_stress(void)
51 		 */
52 		userfaultfd_pagemap_test(page_size * 512);
53 	}
54+#endif
55
56 	pthread_key_delete(long_jmp_key);
57
58--
592.42.0.609.gbb76f46606-goog
60
61