userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP
PATCH v2 1/1 userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP
Kernels built without arch UFFD-WP support (CONFIG_HAVE_ARCH_USERFAULTFD_WP) can report "WP unsupported" in different ways (e.g. UFFDIO_API returns -1/EINVAL on some newer kernels, while others succeed but do not advertise UFFD_FEATURE_PAGEFAULT_FLAG_WP in the returned features mask).
Rather than relying on runtime probing that varies across kernels, require CONFIG_HAVE_ARCH_USERFAULTFD_WP=y via .needs_kconfigs and use SAFE_IOCTL() for UFFDIO_API again.
Follow-up: 485a4cd2ba3 ("userfaultfd05: allow TCONF when UFFD-WP is unsupported")
--- testcases/kernel/syscalls/userfaultfd/userfaultfd05.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/userfaultfd/userfaultfd05.c +5 -5
@@ -92,12 +92,8 @@ static void run(void) uffdio_api.api =UFFD_API ; uffdio_api.features =UFFD_FEATURE_PAGEFAULT_FLAG_WP ; -if (ioctl (uffd,UFFDIO_API , &uffdio_api) <0 ) { -if (!(uffdio_api.features &UFFD_FEATURE_PAGEFAULT_FLAG_WP )) -tst_brk (TCONF ,"UFFD write-protect unsupported" ); -tst_brk (TBROK |TERRNO ,"ioctl() on userfaultfd failed" ); - } +SAFE_IOCTL (uffd,UFFDIO_API , &uffdio_api); uffdio_register.range.start = (unsigned long ) page; uffdio_register.range.len = page_size;
@@ -128,4 +124,8 @@ static void run(void)static struct tst_test test = { .test_all = run, .min_kver ="5.7" , + .needs_kconfigs = (const char *[]) { +"CONFIG_HAVE_ARCH_USERFAULTFD_WP=y" , +NULL + } };
Signature · 5 lines
2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
This one works as well. Feel free to push the version you like with my reviewed-by.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 3 lines
This one works as well. Feel free to push the version you like with my reviewed-by.
Thanks, I merged this one since it makes things easier.
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp