listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
PATCH 1/1 listmount04: Allow both EINVAL and EBADF for BEFORE_6_17_9 case
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.
--- testcases/kernel/syscalls/listmount/listmount04.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/listmount/listmount04.c +10 -3
@@ -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 )
Signature · 5 lines
2.54.0.545.g6539524ca2-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wake,
Quoted 3 lines · Wake Liu
listmount04: Allow both EINVAL and EBADF for
BEFORE_6_17_9caseChange-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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wake,
Quoted 3 lines
On some LTS kernels (like 6.12.y or 6.6.y), the bug fix commit
78f0e33cd6c9("fs/namespace: correctly handle errors returned bygrab_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
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp