[LTP] [PATCH] userfaultfd05: allow TCONF when UFFD-WP is unsupported
Li Wang
liwang@redhat.com
Thu Jan 22 11:22:10 CET 2026
On system without enable CONFIG_HAVE_ARCH_USERFAULTFD_WP kernel option,
test will fail like below:
userfaultfd05.c:95: TBROK: ioctl(3,((((2U|1U) << (((0+8)+8)+14)) |
(((0xAA)) << (0+8)) | ((((0x3F))) << 0) |
((((sizeof(struct uffdio_api)))) << ((0+8)+8)))),...)
failed: EINVAL (22)
The original test uses SAFE_IOCTL macro, which prematurely triggers
TBROK and prevents the test from verifying UFFD_FEATURE_PAGEFAULT_FLAG_WP.
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Christian Amann <camann@suse.com>
Cc: Ricardo Branco <rbranco@suse.com>
---
testcases/kernel/syscalls/userfaultfd/userfaultfd05.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
index c4edc2529..9cb0bb08f 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd05.c
@@ -92,11 +92,11 @@ static void run(void)
uffdio_api.api = UFFD_API;
uffdio_api.features = UFFD_FEATURE_PAGEFAULT_FLAG_WP;
- SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
+ if (ioctl(uffd, UFFDIO_API, &uffdio_api) < 0) {
+ if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
+ tst_brk(TCONF, "UFFD write-protect unsupported");
- if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP)) {
- tst_brk(TCONF, "UFFD write-protect unsupported");
- return;
+ tst_brk(TBROK | TERRNO, "ioctl_userfaultfd failed");
}
uffdio_register.range.start = (unsigned long) page;
--
2.52.0
More information about the ltp
mailing list