All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP
@ 2026-01-23 11:54 Li Wang via ltp
  2026-01-27 12:50 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang via ltp @ 2026-01-23 11:54 UTC (permalink / raw)
  To: ltp; +Cc: Ricardo Branco

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")
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Ricardo Branco <rbranco@suse.com>
---
 testcases/kernel/syscalls/userfaultfd/userfaultfd05.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
index 6cae45f20..e25a227cf 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
@@ -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
+	}
 };
-- 
2.52.0


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP
  2026-01-23 11:54 [LTP] [PATCH v2] userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP Li Wang via ltp
@ 2026-01-27 12:50 ` Cyril Hrubis
  2026-01-27 12:57   ` Li Wang via ltp
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2026-01-27 12:50 UTC (permalink / raw)
  To: Li Wang; +Cc: Ricardo Branco, ltp

Hi!
This one works as well. Feel free to push the version you like with my
reviewed-by.

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP
  2026-01-27 12:50 ` Cyril Hrubis
@ 2026-01-27 12:57   ` Li Wang via ltp
  0 siblings, 0 replies; 3+ messages in thread
From: Li Wang via ltp @ 2026-01-27 12:57 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Ricardo Branco, ltp

> 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.


-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-27 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 11:54 [LTP] [PATCH v2] userfaultfd05: require CONFIG_HAVE_ARCH_USERFAULTFD_WP Li Wang via ltp
2026-01-27 12:50 ` Cyril Hrubis
2026-01-27 12:57   ` Li Wang via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.