[LTP] [PATCH] syscalls/userfaultfd04: Require CONFIG_USERFAULTFD=y

Wake Liu wakel@google.com
Wed Apr 29 12:12:44 CEST 2026


The test fails with TBROK on systems where CONFIG_USERFAULTFD is not
enabled because SAFE_USERFAULTFD calls tst_syscall(__NR_userfaultfd)
which fails (e.g., returning ENOSYS or EOPNOTSUPP), and SAFE_USERFAULTFD
calls tst_brk(TBROK) for errors other than EPERM.

Fix this by adding CONFIG_USERFAULTFD=y to .needs_kconfigs, so that
the test is skipped with TCONF on kernels without userfaultfd support.

Signed-off-by: Wake Liu <wakel@google.com>
---
 testcases/kernel/syscalls/userfaultfd/userfaultfd04.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c
index 4eb811e45..a84117964 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd04.c
@@ -98,4 +98,8 @@ static void run(void)
 
 static struct tst_test test = {
 	.test_all = run,
+	.needs_kconfigs = (const char *[]) {
+		"CONFIG_USERFAULTFD=y",
+		NULL
+	}
 };
-- 
2.54.0.545.g6539524ca2-goog



More information about the ltp mailing list