Linux Test Project
 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>
Subject: [LTP] [PATCH] listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
Date: Thu, 30 Apr 2026 19:23:46 +0800	[thread overview]
Message-ID: <20260430112346.4054436-1-wakel@google.com> (raw)

On some LTS kernels (like 6.12.y or 6.6.y), the bug fix
commit 78f0e33cd6c9 ("fs/namespace: correctly handle errors returned
by grab_requested_mnt_ns") was backported.

The backport changes the behavior of listmount() for kernels
before 6.17.9, returning EBADF instead of EINVAL when invalid
mnt_id_req.spare is provided.

Update the run() function to accept both EINVAL and EBADF when the
expected errno is EINVAL on a kernel version before 6.17.9.

Change-Id: If5b138e64b7c3d8434eea180dd6adc845db44f42
Signed-off-by: Wake Liu <wakel@google.com>
---
 testcases/kernel/syscalls/listmount/listmount04.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/listmount/listmount04.c b/testcases/kernel/syscalls/listmount/listmount04.c
index 919f4c854..ee15ff99c 100644
--- a/testcases/kernel/syscalls/listmount/listmount04.c
+++ b/testcases/kernel/syscalls/listmount/listmount04.c
@@ -152,9 +152,16 @@ static void run(unsigned int n)
 		req->mnt_ns_fd = tc->spare;
 	}
 
-	TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids,
-		tc->nr_mnt_ids, tc->flags), tc->exp_errno,
-		"%s", tc->msg);
+	if (tc->exp_errno == EINVAL && tc->kver == BEFORE_6_17_9) {
+		int exp_errs[] = {EINVAL, EBADF};
+		TST_EXP_FAIL_ARR(tst_syscall(__NR_listmount, req, tc->mnt_ids,
+			tc->nr_mnt_ids, tc->flags), exp_errs, 2,
+			"%s", tc->msg);
+	} else {
+		TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids,
+			tc->nr_mnt_ids, tc->flags), tc->exp_errno,
+			"%s", tc->msg);
+	}
 }
 
 static void setup(void)
-- 
2.54.0.545.g6539524ca2-goog


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

             reply	other threads:[~2026-04-30 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 11:23 Wake Liu via ltp [this message]
2026-04-30 11:37 ` [LTP] listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case linuxtestproject.agent
2026-05-04 11:11 ` [LTP] [PATCH] " Andrea Cervesato via ltp

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=20260430112346.4054436-1-wakel@google.com \
    --to=ltp@lists.linux.it \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox