* [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* Re: [LTP] listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
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 ` linuxtestproject.agent
2026-05-04 11:11 ` [LTP] [PATCH] " Andrea Cervesato via ltp
1 sibling, 0 replies; 3+ messages in thread
From: linuxtestproject.agent @ 2026-04-30 11:37 UTC (permalink / raw)
To: Wake Liu; +Cc: ltp
Hi Wake,
On 2026-04-30, Wake Liu wrote:
> listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
> Change-Id: If5b138e64b7c3d8434eea180dd6adc845db44f42
Please drop the Change-Id tag before sending to the mailing list; it is a
Gerrit internal tracker and does not belong in upstream LTP patches.
---
Note:
Our agent completed the review of the patch.
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
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 ` Andrea Cervesato via ltp
1 sibling, 0 replies; 3+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-04 11:11 UTC (permalink / raw)
To: Wake Liu via ltp; +Cc: Wake Liu, ltp
Hi Wake,
> 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.
Actually that commit is included from 6.18, which make it non-available
also in 6.17.9. The `BEFORE_6_17_9` variable excludes 6.17.9 (equivalent
to < operation).
This means the patch is not resolving the issue for that specific kernel,
but only for the kernels before that commit. Is that correct?
For instance, the patch fails with `v6.18-rc1-118-ga3f8f8662771`:
tst_test.c:2042: TINFO: Tested kernel: 6.18.0-rc1-virtme #9 SMP PREEMPT_DYNAMIC Mon May 4 13:01:41 CEST 2026 x86_64
tst_kconfig.c:90: TINFO: Parsing kernel config '/lib/modules/6.18.0-rc1-virtme/build/.config'
tst_test.c:1867: TINFO: Overall timeout per run is 0h 00m 30s
listmount04.c:161: TPASS: request points to unaccessible memory : EFAULT (14)
listmount04.c:161: TPASS: mnt_ids points to unaccessible memory : EFAULT (14)
listmount04.c:161: TPASS: invalid flags : EINVAL (22)
listmount04.c:161: TPASS: insufficient mnt_id_req.size : EINVAL (22)
listmount04.c:141: TCONF: Test not suitable for current kernel version
listmount04.c:161: TFAIL: invalid mnt_id_req.mnt_ns_fd expected EBADF: EINVAL (22)
listmount04.c:161: TPASS: invalid mnt_id_req.param : EINVAL (22)
listmount04.c:161: TPASS: invalid mnt_id_req.mnt_id : EINVAL (22)
listmount04.c:161: TPASS: non-existant mnt_id : ENOENT (2)
Summary:
passed 7
failed 1
broken 0
skipped 1
warnings 0
I guess the choice is to use EINVAL when >= 6.18. EBADF otherwise.
Kind regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [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