Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
@ 2026-04-30 11:23 Wake Liu via ltp
  2026-04-30 11:37 ` [LTP] " linuxtestproject.agent
  2026-05-04 11:11 ` [LTP] [PATCH] " Andrea Cervesato via ltp
  0 siblings, 2 replies; 3+ messages in thread
From: Wake Liu via ltp @ 2026-04-30 11:23 UTC (permalink / raw)
  To: ltp; +Cc: Wake Liu

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-04 11:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 11:23 [LTP] [PATCH] listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case Wake Liu via ltp
2026-04-30 11:37 ` [LTP] " linuxtestproject.agent
2026-05-04 11:11 ` [LTP] [PATCH] " Andrea Cervesato via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox