[LTP] [PATCH] userfaultfd: Do not use min_kver as gate for test
Ricardo Branco
rbranco@suse.de
Wed Jan 28 12:54:28 CET 2026
Do not use .min_kver to decide whether the test should run and instead
check for the presence of /dev/userfaultfd at runtime.
Signed-off-by: Ricardo Branco <rbranco@suse.de>
---
.../kernel/syscalls/userfaultfd/userfaultfd03.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c b/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c
index ba87bf6e4..d6e1897db 100644
--- a/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c
+++ b/testcases/kernel/syscalls/userfaultfd/userfaultfd03.c
@@ -13,6 +13,7 @@
#include "config.h"
#include <poll.h>
+#include <unistd.h>
#include "tst_test.h"
#include "tst_safe_macros.h"
#include "tst_safe_pthread.h"
@@ -23,6 +24,17 @@ static char *page;
static void *copy_page;
static int uffd;
+static void setup(void)
+{
+ if (access("/dev/userfaultfd", F_OK) == 0)
+ return;
+
+ if (tst_kvercmp(6, 1, 0) < 0)
+ tst_brk(TCONF, "/dev/userfaultfd is missing (kernel < 6.1)");
+
+ tst_brk(TBROK, "/dev/userfaultfd is missing (kernel >= 6.1)");
+}
+
static int open_userfaultfd(int flags)
{
int fd, fd2;
@@ -117,6 +129,6 @@ static void run(void)
static struct tst_test test = {
.needs_root = 1,
+ .setup = setup,
.test_all = run,
- .min_kver = "5.11",
};
--
2.52.0
More information about the ltp
mailing list