All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Andrei Vagin <avagin@google.com>,
	ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd
Date: Mon, 8 Dec 2025 12:51:32 +0100	[thread overview]
Message-ID: <20251208115132.GB683201@pevik> (raw)
In-Reply-To: <aSlRR21MVU1tq-6T@autotest-wegao.qe.prg2.suse.org>

Hi all,

first, we have a different patch increasing value to 6.11.
https://lore.kernel.org/ltp/20251203081226.1148236-1-masahiro.yamada@canonical.com/

> On Fri, Nov 28, 2025 at 11:26:07AM +0800, Li Wang wrote:
> > Hi Wei,


> > On Thu, Nov 27, 2025 at 9:41 AM Wei Gao via ltp <ltp@lists.linux.it> wrote:

> > > New kernel commit lead test case failure with following error message:
> > > listmount04.c:128: TFAIL: invalid mnt_id_req.spare expected EINVAL: EBADF
> > > (9)

> > > Detail of new kernel commit:
> > > commit: 78f0e33cd6c939a555aa80dbed2fec6b333a7660
> > > fs/namespace: correctly handle errors returned by grab_requested_mnt_ns

> > > Signed-off-by: Wei Gao <wegao@suse.com>
> > > ---
> > >  configure.ac                                   |  1 +
> > >  .../kernel/syscalls/listmount/listmount04.c    | 18 ++++++++++++------
> > >  2 files changed, 13 insertions(+), 6 deletions(-)

> > > diff --git a/configure.ac b/configure.ac
> > > index 0480f46ca..fcff90799 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -263,6 +263,7 @@ AC_CHECK_TYPES([struct cachestat],,,[#include
> > > <sys/mman.h>])

> > >  # Defined in <linux/mount.h>, but include/lapi/mount.h includes
> > > <sys/mount.h> */
> > >  AC_CHECK_TYPES([struct mnt_id_req],,,[#include <sys/mount.h>])
> > > +AC_CHECK_MEMBERS([struct mnt_id_req.mnt_ns_fd],,,[#include <sys/mount.h>])
> > >  AC_CHECK_TYPES([struct statmount],,,[#include <sys/mount.h>])
> > >  AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include <unistd.h>
> > >  #include <linux/mount.h>])
> > > diff --git a/testcases/kernel/syscalls/listmount/listmount04.c
> > > b/testcases/kernel/syscalls/listmount/listmount04.c
> > > index a52bad064..3be3be4f2 100644
> > > --- a/testcases/kernel/syscalls/listmount/listmount04.c
> > > +++ b/testcases/kernel/syscalls/listmount/listmount04.c
> > > @@ -18,6 +18,7 @@
> > >  #include "lapi/mount.h"
> > >  #include "lapi/syscalls.h"

> > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD
> > >  #define MNT_SIZE 32

> > >  static struct mnt_id_req *request;
> > > @@ -26,7 +27,7 @@ static uint64_t mnt_ids[MNT_SIZE];
> > >  static struct tcase {
> > >         int req_usage;
> > >         uint32_t size;
> > > -       uint32_t spare;
> > > +       uint32_t mnt_ns_fd;
> > >         uint64_t mnt_id;
> > >         uint64_t param;
> > >         uint64_t *mnt_ids;
> > > @@ -73,12 +74,12 @@ static struct tcase {
> > >         {
> > >                 .req_usage = 1,
> > >                 .size = MNT_ID_REQ_SIZE_VER0,
> > > -               .spare = -1,
> > > +               .mnt_ns_fd = -1,
> > >                 .mnt_id = LSMT_ROOT,
> > >                 .mnt_ids = mnt_ids,
> > >                 .nr_mnt_ids = MNT_SIZE,
> > > -               .exp_errno = EINVAL,
> > > -               .msg = "invalid mnt_id_req.spare",
> > > +               .exp_errno = EBADF,
> > > +               .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor",
> > >         },
> > >         {
> > >                 .req_usage = 1,
> > > @@ -122,7 +123,7 @@ static void run(unsigned int n)
> > >                 req->mnt_id = tc->mnt_id;
> > >                 req->param = tc->param;
> > >                 req->size = tc->size;
> > > -               req->spare = tc->spare;
> > > +               req->mnt_ns_fd = tc->mnt_ns_fd;
> > >         }

> > >         TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids,
> > > @@ -133,9 +134,14 @@ static void run(unsigned int n)
> > >  static struct tst_test test = {
> > >         .test = run,
> > >         .tcnt = ARRAY_SIZE(tcases),
> > > -       .min_kver = "6.8",
> > > +       .min_kver = "6.18",


FYI this is a runtime check, but the problem is with kernel headers.
include/lapi/mount.h [1] uses <sys/mount.h> (see LTP include/lapi/mount.h [1]
and the reason why we did endup using <sys/mount.h> instead of <linux/mount.h>
[2] [3]), but glibc (since certain version, unlike musl) includes <linux/mount.h>.
Therefore while the problem is on current Debian testing with linux-libc-dev all
6.17.9-1 (it was working in previous builds with linux-libc-dev all 6.17.8-1).
But OTOH my openSUSE Tumbleweed VM with 6.18.0-rc6-4.gfea0d97 works without this
patch. Also SLE16 with 6.12 based kernel works without this patch.

tst_test.c:2028: TINFO: Tested kernel: 6.18.0-rc6-4.gfea0d97-default #1 SMP PREEMPT_DYNAMIC Sat Nov 22 19:46:55 UTC 2025 (fea0d97) x86_64
tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
tst_kconfig.c:676: TINFO: CONFIG_FAULT_INJECTION kernel option detected which might slow the execution
tst_test.c:1846: TINFO: Overall timeout per run is 0h 02m 00s
listmount04.c:128: TPASS: request points to unaccessible memory : EFAULT (14)
listmount04.c:128: TPASS: mnt_ids points to unaccessible memory : EFAULT (14)
listmount04.c:128: TPASS: invalid flags : EINVAL (22)
listmount04.c:128: TPASS: insufficient mnt_id_req.size : EINVAL (22)
listmount04.c:128: TPASS: invalid mnt_id_req.spare : EINVAL (22)
listmount04.c:128: TPASS: invalid mnt_id_req.param : EINVAL (22)
listmount04.c:128: TPASS: invalid mnt_id_req.mnt_id : EINVAL (22)
listmount04.c:128: TPASS: non-existant mnt_id : ENOENT (2)

[1] https://github.com/linux-test-project/ltp/blob/master/include/lapi/mount.h
[2] https://github.com/linux-test-project/ltp/commit/a2300dc0f51f46ffb07a465d8734639dbe3af044
[3] https://github.com/linux-test-project/ltp/commit/1feeb57811a4aa2f56ad85edf69a8ea870867c65

> > Reviewed-by: Li Wang <liwang@redhat.com>

> > This patch looks good, I have one question do we need to cover the 'spare'
> > field test for kernels between 6.8 to 6.18?
> I think only keep tracking latest feature's change can make our life
> easy for this case :)

Due the above IMHO we should consider support for <6.11, 6.17> as well.
We have similar crazy approach for a struct change in include/lapi/fanotify.h,
see FSID_VAL_MEMBER().

Kind regards,
Petr

> >         .bufs = (struct tst_buffers []) {
> > >                 { &request, .size = MNT_ID_REQ_SIZE_VER0 },
> > >                 {},
> > >         },
> > >  };
> > > +
> > > +#else
> > > +       TST_TEST_TCONF(
> > > +               "This system does not support mnt_id_req.mnt_ns_fd.");
> > > +#endif /* HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD */
> > > --
> > > 2.51.0


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



> > -- 
> > Regards,
> > Li Wang

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

  reply	other threads:[~2025-12-08 11:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 14:39 [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd Wei Gao via ltp
2025-11-28  3:26 ` Li Wang via ltp
2025-11-28  7:37   ` Wei Gao via ltp
2025-12-08 11:51     ` Petr Vorel [this message]
2025-12-09  0:50       ` Wei Gao via ltp
2025-12-09  0:41 ` [LTP] [PATCH v2] " Wei Gao via ltp
2025-12-09 11:17   ` Petr Vorel
2025-12-09 15:53     ` Cyril Hrubis
2025-12-09 17:49       ` Petr Vorel
2025-12-10  6:19   ` [LTP] [PATCH v3] " Wei Gao via ltp
2025-12-10  8:38     ` Petr Vorel
2025-12-11  1:59     ` [LTP] [PATCH v4] " Wei Gao via ltp
2025-12-11  9:25       ` Cyril Hrubis
2025-12-11 11:51         ` Petr Vorel
2025-12-12 11:50       ` [LTP] [PATCH v5] " Wei Gao via ltp
2025-12-12 12:28         ` Petr Vorel
2025-12-12 12:56           ` Cyril Hrubis
2025-12-12 14:20             ` Petr Vorel
2025-12-12 15:11               ` Petr Vorel
2025-12-14  1:54                 ` Wei Gao via ltp
2025-12-15 15:22                   ` Petr Vorel
2025-12-14  2:15         ` [LTP] [PATCH v6] " Wei Gao via ltp
2025-12-15 15:20           ` Petr Vorel
2025-12-16  8:08           ` Li Wang via ltp
2025-12-17  9:32           ` Cyril Hrubis
2025-12-17 13:15             ` Petr Vorel

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=20251208115132.GB683201@pevik \
    --to=pvorel@suse.cz \
    --cc=avagin@google.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.