From: linuxtestproject.agent@gmail.com
To: Darren Chang <chihsheng@google.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] syscalls/listmount04: Detect backported commit 78f0e33cd6c9 dynamically
Date: Wed, 3 Jun 2026 09:35:50 +0000 [thread overview]
Message-ID: <20260603093550.4066-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260603051401.658906-1-chihsheng@google.com>
Hi Darren,
Thank you for the patch. The overall approach — probing the kernel at runtime
instead of relying solely on tst_kvercmp() — is the right fix for backport
scenarios. Two issues need to be addressed before this can be accepted.
---
[PATCH] syscalls/listmount04: Detect backported commit 78f0e33cd6c9 dynamically
> + /* 2. Runtime probe for older kernels:
> + * Check if commit 78f0e33cd6c9 was backported by manually issuing
> + * a syscall with an invalid mnt_ns_fd (-1).
> + */
> + mnt_id_req probe_req = {
> + .size = MNT_ID_REQ_SIZE_VER0,
> + .mnt_id = LSMT_ROOT,
> + .mnt_ns_fd = -1,
> + .param = 0
> + };
> +
> + tst_syscall(__NR_listmount, &probe_req, mnt_ids, MNT_SIZE, 0);
> +
> + /* 3. Set global behavior flag based on actual kernel response */
> + if (errno == EBADF) {
> + tst_res(TINFO, "Detected backported commit 78f0e33cd6c9 (returns EBADF)");
> + current_fd_err_behavior = INVALID_FD_RET_EBADF;
> + } else {
> + current_fd_err_behavior = INVALID_FD_RET_EINVAL;
> + }
>>> The `else` branch silently maps *any* unexpected errno to
>>> INVALID_FD_RET_EINVAL. If the probe returns something other than EBADF
>>> or EINVAL (e.g. EPERM, ENOMEM, or a hypothetical kernel bug), the test
>>> will silently classify the kernel as "pre-backport" and run the EINVAL
>>> test case against wrong expectations, yielding a false FAIL or a false
>>> PASS.
>>>
>>> tst_syscall() already handles ENOSYS (it calls tst_brk()), but all other
>>> unexpected errnos fall through to this else branch unchecked.
>>>
>>> Please make the check explicit and abort on unexpected values:
>>>
>>> if (errno == EBADF) {
>>> tst_res(TINFO, "Detected backported commit 78f0e33cd6c9 (returns EBADF)");
>>> current_fd_err_behavior = INVALID_FD_RET_EBADF;
>>> } else if (errno == EINVAL) {
>>> current_fd_err_behavior = INVALID_FD_RET_EINVAL;
>>> } else {
>>> tst_brk(TBROK, "Unexpected errno %d from mnt_ns_fd probe", errno);
>>> }
---
> +/*
> * For commit 78f0e33cd6c9 ("fs/namespace: correctly handle errors returned
> * by grab_requested_mnt_ns") from v6.18-rc7 backported to v6.17.9.
> + * Defines the expected error code behavior when an invalid file descriptor
> + * is passed to mnt_ns_fd (previously known as spare).
> */
>>> "previously known as spare" is inaccurate. The field in both the kernel's
>>> struct mnt_id_req and LTP's mnt_id_req_fallback has always been named
>>> mnt_ns_fd. The local helper struct tcase still has a field named `spare`
>>> in this very patch — it was not renamed — so "previously" is wrong in
>>> both directions.
>>>
>>> If the intent is to connect the tcase.spare field to the kernel's
>>> mnt_ns_fd field, say so directly:
>>>
>>> * is passed to mnt_ns_fd (mapped from struct tcase's spare field).
>>>
>>> Or simply drop the parenthetical — the sentence is clear without it.
---
Commit message:
> Commit 78f0e33cd6c9 ("fs/namespace: correctly handle errors returned
> by grab_requested_mnt_ns") changed the expected errno for an invalid
> mnt_ns_fd from EINVAL to EBADF. This was introduced in v6.17.9.
Minor nit (not a blocker): "This was introduced in v6.17.9" only tells
half the story. The change landed in mainline at v6.18 (via v6.18-rc7) and
was concurrently backported to stable v6.17.9. The sentence could read:
This landed in mainline v6.18 and was backported to stable v6.17.9.
The code in setup() is correct regardless (tst_kvercmp(6, 17, 9) >= 0
is true for all v6.17.9+, v6.18+, and later), but the commit message
description of the timeline is incomplete.
---
Verdict: Needs revision
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2026-06-03 9:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 5:14 [LTP] [PATCH] syscalls/listmount04: Detect backported commit 78f0e33cd6c9 dynamically Darren Chang via ltp
2026-06-03 9:27 ` Cyril Hrubis
2026-06-03 9:35 ` linuxtestproject.agent [this message]
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=20260603093550.4066-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=chihsheng@google.com \
--cc=ltp@lists.linux.it \
/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