All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wake Liu via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: Wake Liu <wakel@google.com>, camann@suse.com, rbranco@suse.com
Subject: [LTP] [PATCH] lapi/userfaultfd: Handle ENOSYS in SAFE_USERFAULTFD
Date: Wed, 29 Apr 2026 14:40:10 +0800	[thread overview]
Message-ID: <20260429064011.3200745-1-wakel@google.com> (raw)

When CONFIG_USERFAULTFD is not enabled in the kernel, the userfaultfd
syscall returns ENOSYS. Currently, SAFE_USERFAULTFD calls tst_brk(TBROK)
for any error other than EPERM, causing tests to fail when they should
be skipped.

Add a check for ENOSYS to return TCONF, so that tests using
SAFE_USERFAULTFD are skipped appropriately on kernels without
userfaultfd support.

Signed-off-by: Wake Liu <wakel@google.com>
---
 include/lapi/userfaultfd.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/lapi/userfaultfd.h b/include/lapi/userfaultfd.h
index 0c9e34c84..09126d856 100644
--- a/include/lapi/userfaultfd.h
+++ b/include/lapi/userfaultfd.h
@@ -244,6 +244,10 @@ static inline int safe_userfaultfd(const char *file, const int lineno, int
 retry:
 	ret = tst_syscall(__NR_userfaultfd, flags);
 	if (ret == -1) {
+		if (errno == ENOSYS) {
+			tst_brk_(file, lineno, TCONF | TERRNO,
+				"userfaultfd() is not supported by this kernel");
+		}
 		if (errno == EPERM) {
 			if (retry && !(flags & UFFD_USER_MODE_ONLY)) {
 				flags |= UFFD_USER_MODE_ONLY;
-- 
2.54.0.545.g6539524ca2-goog


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

             reply	other threads:[~2026-04-29  6:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29  6:40 Wake Liu via ltp [this message]
2026-04-29  6:52 ` [LTP] [PATCH] lapi/userfaultfd: Handle ENOSYS in SAFE_USERFAULTFD Andrea Cervesato via ltp
2026-04-29  8:51   ` Wake Liu via ltp
2026-04-29  9:22     ` Andrea Cervesato via ltp
2026-04-29  9:48       ` Wake Liu via ltp
2026-04-29 10:02         ` Andrea Cervesato via ltp
2026-04-29 10:12           ` [LTP] [PATCH] syscalls/userfaultfd04: Require CONFIG_USERFAULTFD=y Wake Liu via ltp
2026-04-29 12:22             ` [LTP] " linuxtestproject.agent
2026-05-06 15:52             ` [LTP] [PATCH] " Andrea Cervesato via ltp
2026-05-06 15:57             ` Andrea Cervesato via ltp
2026-04-29  7:31 ` [LTP] lapi/userfaultfd: Handle ENOSYS in SAFE_USERFAULTFD linuxtestproject.agent
2026-04-29  7:36   ` Andrea Cervesato via ltp
2026-04-29 11:07 ` [LTP] [PATCH] " Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260429064011.3200745-1-wakel@google.com \
    --to=ltp@lists.linux.it \
    --cc=camann@suse.com \
    --cc=rbranco@suse.com \
    --cc=wakel@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.