Skip to content

Commit 485a4cd

Browse files
committed
userfaultfd05: allow TCONF when UFFD-WP is unsupported
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. Fixes: efd8e51 ("userfaultfd: Add test using UFFDIO_WRITEPROTECT") Signed-off-by: Li Wang <liwang@redhat.com> Cc: Christian Amann <camann@suse.com> Cc: Ricardo Branco <rbranco@suse.com>
1 parent 088c484 commit 485a4cd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

testcases/kernel/syscalls/userfaultfd/userfaultfd05.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ static void run(void)
9292

9393
uffdio_api.api = UFFD_API;
9494
uffdio_api.features = UFFD_FEATURE_PAGEFAULT_FLAG_WP;
95-
SAFE_IOCTL(uffd, UFFDIO_API, &uffdio_api);
95+
if (ioctl(uffd, UFFDIO_API, &uffdio_api) < 0) {
96+
if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
97+
tst_brk(TCONF, "UFFD write-protect unsupported");
9698

97-
if (!(uffdio_api.features & UFFD_FEATURE_PAGEFAULT_FLAG_WP)) {
98-
tst_brk(TCONF, "UFFD write-protect unsupported");
99-
return;
99+
tst_brk(TBROK | TERRNO, "ioctl() on userfaultfd failed");
100100
}
101101

102102
uffdio_register.range.start = (unsigned long) page;

0 commit comments

Comments
 (0)