* [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd @ 2025-11-27 14:39 Wei Gao via ltp 2025-11-28 3:26 ` Li Wang via ltp 2025-12-09 0:41 ` [LTP] [PATCH v2] " Wei Gao via ltp 0 siblings, 2 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-11-27 14:39 UTC (permalink / raw) To: ltp 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", .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 ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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-09 0:41 ` [LTP] [PATCH v2] " Wei Gao via ltp 1 sibling, 1 reply; 26+ messages in thread From: Li Wang via ltp @ 2025-11-28 3:26 UTC (permalink / raw) To: Wei Gao; +Cc: Christian Brauner, Jan Kara, ltp, Andrei Vagin 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", > 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? .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 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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 0 siblings, 1 reply; 26+ messages in thread From: Wei Gao via ltp @ 2025-11-28 7:37 UTC (permalink / raw) To: Li Wang; +Cc: Christian Brauner, Jan Kara, ltp, Andrei Vagin 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", > > > > 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 :) > > > .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 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-11-28 7:37 ` Wei Gao via ltp @ 2025-12-08 11:51 ` Petr Vorel 2025-12-09 0:50 ` Wei Gao via ltp 0 siblings, 1 reply; 26+ messages in thread From: Petr Vorel @ 2025-12-08 11:51 UTC (permalink / raw) To: Wei Gao; +Cc: Christian Brauner, Jan Kara, Andrei Vagin, ltp 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 ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v1] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-08 11:51 ` Petr Vorel @ 2025-12-09 0:50 ` Wei Gao via ltp 0 siblings, 0 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-09 0:50 UTC (permalink / raw) To: Petr Vorel; +Cc: Christian Brauner, Jan Kara, Andrei Vagin, ltp On Mon, Dec 08, 2025 at 12:51:32PM +0100, Petr Vorel wrote: > 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/ I guess above new change should not handled within this commit correct? > > > 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(). v2 patch is sent wihtout touch min version, since another patch will increase min version seperately. > > 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 ^ permalink raw reply [flat|nested] 26+ messages in thread
* [LTP] [PATCH v2] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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-12-09 0:41 ` Wei Gao via ltp 2025-12-09 11:17 ` Petr Vorel 2025-12-10 6:19 ` [LTP] [PATCH v3] " Wei Gao via ltp 1 sibling, 2 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-09 0:41 UTC (permalink / raw) To: ltp 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 | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) 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..0a198e6a9 100644 --- a/testcases/kernel/syscalls/listmount/listmount04.c +++ b/testcases/kernel/syscalls/listmount/listmount04.c @@ -26,7 +26,11 @@ static uint64_t mnt_ids[MNT_SIZE]; static struct tcase { int req_usage; uint32_t size; +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + uint32_t mnt_ns_fd; +#else uint32_t spare; +#endif uint64_t mnt_id; uint64_t param; uint64_t *mnt_ids; @@ -73,12 +77,21 @@ static struct tcase { { .req_usage = 1, .size = MNT_ID_REQ_SIZE_VER0, +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + .mnt_ns_fd = -1, +#else .spare = -1, +#endif .mnt_id = LSMT_ROOT, .mnt_ids = mnt_ids, .nr_mnt_ids = MNT_SIZE, +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + .exp_errno = EBADF, + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", +#else .exp_errno = EINVAL, .msg = "invalid mnt_id_req.spare", +#endif }, { .req_usage = 1, @@ -122,7 +135,11 @@ static void run(unsigned int n) req->mnt_id = tc->mnt_id; req->param = tc->param; req->size = tc->size; +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + req->mnt_ns_fd = tc->mnt_ns_fd; +#else req->spare = tc->spare; +#endif } TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v2] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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-10 6:19 ` [LTP] [PATCH v3] " Wei Gao via ltp 1 sibling, 1 reply; 26+ messages in thread From: Petr Vorel @ 2025-12-09 11:17 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, > New kernel commit lead test case failure with following error message: "New" will eventually become "old" :). Why not to state that it's change from v6.18-rc7? (it saves people in the future to search.) > listmount04.c:128: TFAIL: invalid mnt_id_req.spare expected EINVAL: EBADF (9) 2 things needs to be changed. > 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 | 17 +++++++++++++++++ > 2 files changed, 18 insertions(+) > 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..0a198e6a9 100644 > --- a/testcases/kernel/syscalls/listmount/listmount04.c > +++ b/testcases/kernel/syscalls/listmount/listmount04.c > @@ -26,7 +26,11 @@ static uint64_t mnt_ids[MNT_SIZE]; > static struct tcase { > int req_usage; > uint32_t size; > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD Any time you modify configure.ac please remember to use: #include "config.h" > + uint32_t mnt_ns_fd; > +#else > uint32_t spare; > +#endif > uint64_t mnt_id; > uint64_t param; > uint64_t *mnt_ids; > @@ -73,12 +77,21 @@ static struct tcase { > { > .req_usage = 1, > .size = MNT_ID_REQ_SIZE_VER0, > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + .mnt_ns_fd = -1, > +#else > .spare = -1, > +#endif > .mnt_id = LSMT_ROOT, > .mnt_ids = mnt_ids, > .nr_mnt_ids = MNT_SIZE, > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + .exp_errno = EBADF, > + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", > +#else > .exp_errno = EINVAL, > .msg = "invalid mnt_id_req.spare", > +#endif I tried to run it on VM with affected (new) libc and old kernel and it fails: tst_test.c:2028: TINFO: Tested kernel: 6.12.38+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.38-1 (2025-07-16) x86_64 tst_kconfig.c:88: TINFO: Parsing kernel config '/boot/config-6.12.38+deb13-amd64' tst_test.c:1846: TINFO: Overall timeout per run is 0h 00m 30s listmount04.c:146: TPASS: request points to unaccessible memory : EFAULT (14) listmount04.c:146: TPASS: mnt_ids points to unaccessible memory : EFAULT (14) listmount04.c:146: TPASS: invalid flags : EINVAL (22) listmount04.c:146: TPASS: insufficient mnt_id_req.size : EINVAL (22) listmount04.c:146: TFAIL: invalid mnt_id_req.mnt_ns_fd bad file descriptor expected EBADF: EINVAL (22) Usual "headers vs running kernel mismatch problem". @Li, @Cyril Do we care about these incompatibilities? Could we just accept both? Or we don't care? Obviously it works on new enough kernel (patch change is from 6.18): tst_test.c:2028: TINFO: Tested kernel: 6.17.11+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.17.11-1 (2025-12-07) x86_64 tst_kconfig.c:88: TINFO: Parsing kernel config '/boot/config-6.17.11+deb14-amd64' tst_test.c:1846: TINFO: Overall timeout per run is 0h 00m 30s listmount04.c:146: TPASS: request points to unaccessible memory : EFAULT (14) listmount04.c:146: TPASS: mnt_ids points to unaccessible memory : EFAULT (14) listmount04.c:146: TPASS: invalid flags : EINVAL (22) listmount04.c:146: TPASS: insufficient mnt_id_req.size : EINVAL (22) listmount04.c:146: TPASS: invalid mnt_id_req.mnt_ns_fd bad file descriptor : EBADF (9) listmount04.c:146: TPASS: invalid mnt_id_req.param : EINVAL (22) listmount04.c:146: TPASS: invalid mnt_id_req.mnt_id : EINVAL (22) listmount04.c:146: TPASS: non-existant mnt_id : ENOENT (2) Kind regards, Petr > }, > { > .req_usage = 1, > @@ -122,7 +135,11 @@ static void run(unsigned int n) > req->mnt_id = tc->mnt_id; > req->param = tc->param; > req->size = tc->size; > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + req->mnt_ns_fd = tc->mnt_ns_fd; > +#else > req->spare = tc->spare; > +#endif -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v2] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-09 11:17 ` Petr Vorel @ 2025-12-09 15:53 ` Cyril Hrubis 2025-12-09 17:49 ` Petr Vorel 0 siblings, 1 reply; 26+ messages in thread From: Cyril Hrubis @ 2025-12-09 15:53 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp Hi! > > + uint32_t mnt_ns_fd; > > +#else > > uint32_t spare; > > +#endif > > uint64_t mnt_id; > > uint64_t param; > > uint64_t *mnt_ids; > > @@ -73,12 +77,21 @@ static struct tcase { > > { > > .req_usage = 1, > > .size = MNT_ID_REQ_SIZE_VER0, > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > + .mnt_ns_fd = -1, > > +#else > > .spare = -1, > > +#endif > > .mnt_id = LSMT_ROOT, > > .mnt_ids = mnt_ids, > > .nr_mnt_ids = MNT_SIZE, > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > + .exp_errno = EBADF, > > + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", > > +#else > > .exp_errno = EINVAL, > > .msg = "invalid mnt_id_req.spare", > > +#endif This is never going to work, how kernel interprets the value depends on solely on the running kernel verision not on headers that were present during the compilation. What we need to do is to differentiate the expected errno based on running kernel version. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v2] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-09 15:53 ` Cyril Hrubis @ 2025-12-09 17:49 ` Petr Vorel 0 siblings, 0 replies; 26+ messages in thread From: Petr Vorel @ 2025-12-09 17:49 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp > Hi! > > > + uint32_t mnt_ns_fd; > > > +#else > > > uint32_t spare; > > > +#endif > > > uint64_t mnt_id; > > > uint64_t param; > > > uint64_t *mnt_ids; > > > @@ -73,12 +77,21 @@ static struct tcase { > > > { > > > .req_usage = 1, > > > .size = MNT_ID_REQ_SIZE_VER0, > > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > > + .mnt_ns_fd = -1, > > > +#else > > > .spare = -1, > > > +#endif > > > .mnt_id = LSMT_ROOT, > > > .mnt_ids = mnt_ids, > > > .nr_mnt_ids = MNT_SIZE, > > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > > + .exp_errno = EBADF, > > > + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", > > > +#else > > > .exp_errno = EINVAL, > > > .msg = "invalid mnt_id_req.spare", > > > +#endif > This is never going to work, how kernel interprets the value depends on > solely on the running kernel verision not on headers that were present > during the compilation. +1, I realized that myself as well. > What we need to do is to differentiate the expected errno based on > running kernel version. Other option would be just accept both errnos (as kernel developers seem to be not forcing us to be pedantic on kernel internals - recent swapon03.c rewrite requirement). But lets use tst_kvercmp() to not delay the fix with more discussion. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* [LTP] [PATCH v3] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-09 0:41 ` [LTP] [PATCH v2] " Wei Gao via ltp 2025-12-09 11:17 ` Petr Vorel @ 2025-12-10 6:19 ` Wei Gao via ltp 2025-12-10 8:38 ` Petr Vorel 2025-12-11 1:59 ` [LTP] [PATCH v4] " Wei Gao via ltp 1 sibling, 2 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-10 6:19 UTC (permalink / raw) To: ltp Kernel change from v6.18-rc7 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 | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) 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 a6921a249..973b472f6 100644 --- a/testcases/kernel/syscalls/listmount/listmount04.c +++ b/testcases/kernel/syscalls/listmount/listmount04.c @@ -14,6 +14,7 @@ #define _GNU_SOURCE +#include "config.h" #include "tst_test.h" #include "lapi/mount.h" #include "lapi/syscalls.h" @@ -26,7 +27,11 @@ static uint64_t mnt_ids[MNT_SIZE]; static struct tcase { int req_usage; uint32_t size; +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + uint32_t mnt_ns_fd; +#else uint32_t spare; +#endif uint64_t mnt_id; uint64_t param; uint64_t *mnt_ids; @@ -73,12 +78,21 @@ static struct tcase { { .req_usage = 1, .size = MNT_ID_REQ_SIZE_VER0, +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + .mnt_ns_fd = -1, +#else .spare = -1, +#endif .mnt_id = LSMT_ROOT, .mnt_ids = mnt_ids, .nr_mnt_ids = MNT_SIZE, +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + .exp_errno = EBADF, + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", +#else .exp_errno = EINVAL, .msg = "invalid mnt_id_req.spare", +#endif }, { .req_usage = 1, @@ -122,7 +136,17 @@ static void run(unsigned int n) req->mnt_id = tc->mnt_id; req->param = tc->param; req->size = tc->size; - req->spare = tc->spare; +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + if ((tst_kvercmp(6, 18, 0)) >= 0) + req->mnt_ns_fd = tc->mnt_ns_fd; + else + tst_brk(TCONF, "Skipping test, kernel version should > 6.18"); +#else + if ((tst_kvercmp(6, 18, 0)) >= 0) + tst_brk(TCONF, "Skipping test, kernel version should < 6.18"); + else + req->spare = tc->spare; +#endif } TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v3] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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 1 sibling, 0 replies; 26+ messages in thread From: Petr Vorel @ 2025-12-10 8:38 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, > Kernel change from v6.18-rc7 lead test case failure with following error message: > listmount04.c:128: TFAIL: invalid mnt_id_req.spare expected EINVAL: EBADF (9) > .req_usage = 1, > @@ -122,7 +136,17 @@ static void run(unsigned int n) > req->mnt_id = tc->mnt_id; > req->param = tc->param; > req->size = tc->size; > - req->spare = tc->spare; > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + if ((tst_kvercmp(6, 18, 0)) >= 0) > + req->mnt_ns_fd = tc->mnt_ns_fd; > + else > + tst_brk(TCONF, "Skipping test, kernel version should > 6.18"); nit: "should be >= " (missing "be" and "="). OK, for insufficient kernel version only first test (which does not set .req_usage) will be run. > +#else > + if ((tst_kvercmp(6, 18, 0)) >= 0) > + tst_brk(TCONF, "Skipping test, kernel version should < 6.18"); nit: "should be" (missing "be"). Reviewed-by: Petr Vorel <pvorel@suse.cz> Thanks! Kind regards, Petr > + else > + req->spare = tc->spare; > +#endif > } -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* [LTP] [PATCH v4] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-10 6:19 ` [LTP] [PATCH v3] " Wei Gao via ltp 2025-12-10 8:38 ` Petr Vorel @ 2025-12-11 1:59 ` Wei Gao via ltp 2025-12-11 9:25 ` Cyril Hrubis 2025-12-12 11:50 ` [LTP] [PATCH v5] " Wei Gao via ltp 1 sibling, 2 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-11 1:59 UTC (permalink / raw) To: ltp Kernel change from v6.18-rc7 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> Reviewed-by: Petr Vorel <pvorel@suse.cz> --- configure.ac | 1 + .../kernel/syscalls/listmount/listmount04.c | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) v3->v4: fix grammatical errors 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 a6921a249..3579a4296 100644 --- a/testcases/kernel/syscalls/listmount/listmount04.c +++ b/testcases/kernel/syscalls/listmount/listmount04.c @@ -14,6 +14,7 @@ #define _GNU_SOURCE +#include "config.h" #include "tst_test.h" #include "lapi/mount.h" #include "lapi/syscalls.h" @@ -26,7 +27,11 @@ static uint64_t mnt_ids[MNT_SIZE]; static struct tcase { int req_usage; uint32_t size; +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + uint32_t mnt_ns_fd; +#else uint32_t spare; +#endif uint64_t mnt_id; uint64_t param; uint64_t *mnt_ids; @@ -73,12 +78,21 @@ static struct tcase { { .req_usage = 1, .size = MNT_ID_REQ_SIZE_VER0, +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + .mnt_ns_fd = -1, +#else .spare = -1, +#endif .mnt_id = LSMT_ROOT, .mnt_ids = mnt_ids, .nr_mnt_ids = MNT_SIZE, +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + .exp_errno = EBADF, + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", +#else .exp_errno = EINVAL, .msg = "invalid mnt_id_req.spare", +#endif }, { .req_usage = 1, @@ -122,7 +136,17 @@ static void run(unsigned int n) req->mnt_id = tc->mnt_id; req->param = tc->param; req->size = tc->size; - req->spare = tc->spare; +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD + if ((tst_kvercmp(6, 18, 0)) >= 0) + req->mnt_ns_fd = tc->mnt_ns_fd; + else + tst_brk(TCONF, "Skipping test, kernel version should be >= 6.18"); +#else + if ((tst_kvercmp(6, 18, 0)) >= 0) + tst_brk(TCONF, "Skipping test, kernel version should be < 6.18"); + else + req->spare = tc->spare; +#endif } TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, -- 2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v4] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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 1 sibling, 1 reply; 26+ messages in thread From: Cyril Hrubis @ 2025-12-11 9:25 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > #define _GNU_SOURCE > > +#include "config.h" > #include "tst_test.h" > #include "lapi/mount.h" > #include "lapi/syscalls.h" > @@ -26,7 +27,11 @@ static uint64_t mnt_ids[MNT_SIZE]; > static struct tcase { > int req_usage; > uint32_t size; > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + uint32_t mnt_ns_fd; > +#else > uint32_t spare; > +#endif > uint64_t mnt_id; > uint64_t param; > uint64_t *mnt_ids; > @@ -73,12 +78,21 @@ static struct tcase { > { > .req_usage = 1, > .size = MNT_ID_REQ_SIZE_VER0, > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + .mnt_ns_fd = -1, > +#else > .spare = -1, > +#endif > .mnt_id = LSMT_ROOT, > .mnt_ids = mnt_ids, > .nr_mnt_ids = MNT_SIZE, > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + .exp_errno = EBADF, > + .msg = "invalid mnt_id_req.mnt_ns_fd bad file descriptor", > +#else > .exp_errno = EINVAL, > .msg = "invalid mnt_id_req.spare", > +#endif > > }, > { > .req_usage = 1, > @@ -122,7 +136,17 @@ static void run(unsigned int n) > req->mnt_id = tc->mnt_id; > req->param = tc->param; > req->size = tc->size; > - req->spare = tc->spare; > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > + if ((tst_kvercmp(6, 18, 0)) >= 0) > + req->mnt_ns_fd = tc->mnt_ns_fd; > + else > + tst_brk(TCONF, "Skipping test, kernel version should be >= 6.18"); > +#else > + if ((tst_kvercmp(6, 18, 0)) >= 0) > + tst_brk(TCONF, "Skipping test, kernel version should be < 6.18"); > + else > + req->spare = tc->spare; > +#endif I do not like this solution. Here we disable the test on newer kernel if it was compiled on older headers and vice versa. There are actually two problems to be solved and they are independent of each other and we shouldn't mix these two. First problem is that the mnt_ns_fd is not defined on older headers. That should be fixed by a fallback defintion in lapi/. The spare in lapi/mount.h in struct mnt_id_req should be renamed to mnt_ns_fd. And we should use that structure if mnt_id_req is not defined in system headers. I guess that we can use typedef for that and do something as: struct mnt_id_req_fallback { uint32_t size; ... }; #if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD typedef struct mnt_id_req_fallback mnt_id_req #else typedef struct mnd_id_req mnt_id_req #endif And then use mnt_id_req in test with the guarantee that the mnt_ns_fd is always there. The second problem is the expected errno. That should be just set once based on the kernel version in the test setup(). > } > > TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, > -- > 2.51.0 > -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v4] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-11 9:25 ` Cyril Hrubis @ 2025-12-11 11:51 ` Petr Vorel 0 siblings, 0 replies; 26+ messages in thread From: Petr Vorel @ 2025-12-11 11:51 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp ... > > @@ -122,7 +136,17 @@ static void run(unsigned int n) > > req->mnt_id = tc->mnt_id; > > req->param = tc->param; > > req->size = tc->size; > > - req->spare = tc->spare; > > +#ifdef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > + if ((tst_kvercmp(6, 18, 0)) >= 0) > > + req->mnt_ns_fd = tc->mnt_ns_fd; > > + else > > + tst_brk(TCONF, "Skipping test, kernel version should be >= 6.18"); > > +#else > > + if ((tst_kvercmp(6, 18, 0)) >= 0) > > + tst_brk(TCONF, "Skipping test, kernel version should be < 6.18"); > > + else > > + req->spare = tc->spare; > > +#endif > I do not like this solution. Here we disable the test on newer kernel if > it was compiled on older headers and vice versa. Thanks for catching this up. I had a feeling something is wrong but was not sure what. > There are actually two problems to be solved and they are independent of > each other and we shouldn't mix these two. > First problem is that the mnt_ns_fd is not defined on older headers. > That should be fixed by a fallback defintion in lapi/. The spare in > lapi/mount.h in struct mnt_id_req should be renamed to mnt_ns_fd. And we > should use that structure if mnt_id_req is not defined in system > headers. I guess that we can use typedef for that and do something as: OK, I did not realize that struct size is actually the same, only struct member has changed so that we can happily pass that to any kernel version. > struct mnt_id_req_fallback { > uint32_t size; > ... > }; > #if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > typedef struct mnt_id_req_fallback mnt_id_req > #else > typedef struct mnd_id_req mnt_id_req > #endif > And then use mnt_id_req in test with the guarantee that the mnt_ns_fd is > always there. > The second problem is the expected errno. That should be just set once > based on the kernel version in the test setup(). +1. I was also thinking about moving this to setup to prevent repeated detecting but was not sure how to do it in elegant way as errno is in the struct. I guess you mean just to store result of tst_kvercmp(6, 18, 0), but even that is not enough. The cleanest way looks to me to add another struct member int exp_errno_old: static bool old_kernel = true; static struct tcase { ... int exp_errno; int exp_errno_old; } static void setup() { if ((tst_kvercmp(6, 18, 0)) < 0) old_kernel = false; } static void run(unsigned int n) { ... int exp_errno = (tc->exp_errno_old && old_kernel ? tc->exp_errno_old : tc->exp_errno); TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, tc->nr_mnt_ids, tc->flags), exp_errno, "%s", tc->msg); } Also when looking in the code I'd personally factor out tc->req_usage to make it obvious it's not called by first tcases member. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-11 1:59 ` [LTP] [PATCH v4] " Wei Gao via ltp 2025-12-11 9:25 ` Cyril Hrubis @ 2025-12-12 11:50 ` Wei Gao via ltp 2025-12-12 12:28 ` Petr Vorel 2025-12-14 2:15 ` [LTP] [PATCH v6] " Wei Gao via ltp 1 sibling, 2 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-12 11:50 UTC (permalink / raw) To: ltp Kernel change from v6.18-rc7 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 + include/lapi/mount.h | 10 +++++++--- .../kernel/syscalls/listmount/listmount04.c | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) v4->v5: Update base solution of Cyril 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/include/lapi/mount.h b/include/lapi/mount.h index 0f7bb5e43..7b1c4ca0f 100644 --- a/include/lapi/mount.h +++ b/include/lapi/mount.h @@ -45,14 +45,18 @@ # define MS_NOSYMFOLLOW 256 #endif -#ifndef HAVE_STRUCT_MNT_ID_REQ -struct mnt_id_req { +struct mnt_id_req_fallback { uint32_t size; - uint32_t spare; + uint32_t mnt_ns_fd; uint64_t mnt_id; uint64_t param; uint64_t mnt_ns_id; }; + +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD +typedef struct mnt_id_req_fallback mnt_id_req; +#else +typedef struct mnt_id_req mnt_id_req; #endif #ifndef HAVE_STRUCT_STATMOUNT diff --git a/testcases/kernel/syscalls/listmount/listmount04.c b/testcases/kernel/syscalls/listmount/listmount04.c index a6921a249..955f98e20 100644 --- a/testcases/kernel/syscalls/listmount/listmount04.c +++ b/testcases/kernel/syscalls/listmount/listmount04.c @@ -14,13 +14,14 @@ #define _GNU_SOURCE +#include "config.h" #include "tst_test.h" #include "lapi/mount.h" #include "lapi/syscalls.h" #define MNT_SIZE 32 -static struct mnt_id_req *request; +static mnt_id_req *request; static uint64_t mnt_ids[MNT_SIZE]; static struct tcase { @@ -113,7 +114,7 @@ static struct tcase { static void run(unsigned int n) { struct tcase *tc = &tcases[n]; - struct mnt_id_req *req = NULL; + mnt_id_req *req = NULL; memset(mnt_ids, 0, sizeof(mnt_ids)); @@ -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->spare; } TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, @@ -130,8 +131,17 @@ static void run(unsigned int n) "%s", tc->msg); } +static void setup(void) +{ + if (tst_kvercmp(6, 18, 0) >= 0) { + tcases[4].exp_errno = EBADF; + tcases[4].msg = "invalid mnt_id_req.mnt_ns_fd (EBADF)"; + } +} + static struct tst_test test = { .test = run, + .setup = setup, .tcnt = ARRAY_SIZE(tcases), .min_kver = "6.11", .bufs = (struct tst_buffers []) { -- 2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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-14 2:15 ` [LTP] [PATCH v6] " Wei Gao via ltp 1 sibling, 1 reply; 26+ messages in thread From: Petr Vorel @ 2025-12-12 12:28 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, all, ... > -#ifndef HAVE_STRUCT_MNT_ID_REQ > -struct mnt_id_req { > +struct mnt_id_req_fallback { > uint32_t size; > - uint32_t spare; > + uint32_t mnt_ns_fd; > uint64_t mnt_id; > uint64_t param; > uint64_t mnt_ns_id; > }; > + > +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD Shouldn't be !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) ? Also, this patchset introduces compilation error on old systems: In file included from listmount03.c:13:0: listmount.h:20:4: error: 'struct mnt_id_req' has no member named 'mnt_id' .mnt_id = mnt_id, Obviously some definition is wrong. https://github.com/pevik/ltp/actions/runs/20166087670/job/57889711762 (CI does not work, therefore I pushed you patchset.) > +typedef struct mnt_id_req_fallback mnt_id_req; > +#else > +typedef struct mnt_id_req mnt_id_req; > #endif ... > +static void setup(void) > +{ > + if (tst_kvercmp(6, 18, 0) >= 0) { > + tcases[4].exp_errno = EBADF; > + tcases[4].msg = "invalid mnt_id_req.mnt_ns_fd (EBADF)"; Hardcoding array index is asking for problems in the future. That's why I suggested more complicated code in previous version. https://lore.kernel.org/ltp/20251211115111.GA63924@pevik/ Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-12 12:28 ` Petr Vorel @ 2025-12-12 12:56 ` Cyril Hrubis 2025-12-12 14:20 ` Petr Vorel 0 siblings, 1 reply; 26+ messages in thread From: Cyril Hrubis @ 2025-12-12 12:56 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp Hi! > > -#ifndef HAVE_STRUCT_MNT_ID_REQ > > -struct mnt_id_req { > > +struct mnt_id_req_fallback { > > uint32_t size; > > - uint32_t spare; > > + uint32_t mnt_ns_fd; > > uint64_t mnt_id; > > uint64_t param; > > uint64_t mnt_ns_id; > > }; > > + > > +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > Shouldn't be !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) ? > > Also, this patchset introduces compilation error on old systems: > > In file included from listmount03.c:13:0: > listmount.h:20:4: error: 'struct mnt_id_req' has no member named 'mnt_id' > .mnt_id = mnt_id, > > Obviously some definition is wrong. That looks like we need configure check for mnt_id too however that happens in a different test. > https://github.com/pevik/ltp/actions/runs/20166087670/job/57889711762 > > (CI does not work, therefore I pushed you patchset.) > > > +typedef struct mnt_id_req_fallback mnt_id_req; > > +#else > > +typedef struct mnt_id_req mnt_id_req; > > #endif > > ... > > +static void setup(void) > > +{ > > + if (tst_kvercmp(6, 18, 0) >= 0) { > > + tcases[4].exp_errno = EBADF; > > + tcases[4].msg = "invalid mnt_id_req.mnt_ns_fd (EBADF)"; > > Hardcoding array index is asking for problems in the future. > > That's why I suggested more complicated code in previous version. > https://lore.kernel.org/ltp/20251211115111.GA63924@pevik/ Another solution would be to define testcases for both for EINVAL and EBADF and add a flag which should be enabled on newer kernel: #define BEFORE_6_18 1 #define AFTER_6_18 2 ... { .req_usage = 1, .size = MNT_ID_REQ_SIZE_VER0, .spare = -1, .mnt_id = LSMT_ROOT, .mnt_ids = mnt_ids, .nr_mnt_ids = MNT_SIZE, .exp_errno = EINVAL, .msg = "invalid mnt_id_req.spare", .kver = BEFORE_6_18, }, { .req_usage = 1, .size = MNT_ID_REQ_SIZE_VER0, .spare = -1, .mnt_id = LSMT_ROOT, .mnt_ids = mnt_ids, .nr_mnt_ids = MNT_SIZE, .exp_errno = EBADF, .msg = "invalid mnt_id_req.mnt_nf_fd", .kver = AFTER_6_18, }, ... static void run(...) { ... if (tc->kver && tc->kver != kver) return; ... } static void setup(void) { if (tst_kvercmp(6, 18, 0) >= 0) kver = AFTER_6_18; else kver = BEFORE_6_18; } -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-12 12:56 ` Cyril Hrubis @ 2025-12-12 14:20 ` Petr Vorel 2025-12-12 15:11 ` Petr Vorel 0 siblings, 1 reply; 26+ messages in thread From: Petr Vorel @ 2025-12-12 14:20 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp > Hi! > > > -#ifndef HAVE_STRUCT_MNT_ID_REQ > > > -struct mnt_id_req { > > > +struct mnt_id_req_fallback { > > > uint32_t size; > > > - uint32_t spare; > > > + uint32_t mnt_ns_fd; > > > uint64_t mnt_id; > > > uint64_t param; > > > uint64_t mnt_ns_id; > > > }; > > > + > > > +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > Shouldn't be !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) ? > > Also, this patchset introduces compilation error on old systems: > > In file included from listmount03.c:13:0: > > listmount.h:20:4: error: 'struct mnt_id_req' has no member named 'mnt_id' > > .mnt_id = mnt_id, > > Obviously some definition is wrong. > That looks like we need configure check for mnt_id too however that > happens in a different test. Yes: Do we still need the check for the struct mnt_id_req now? I'd say no: -AC_CHECK_TYPES([struct mnt_id_req],,,[#include <sys/mount.h>]) +AC_CHECK_MEMBERS([struct mnt_id_req.mnt_ns_fd, struct mnt_id_req.mnt_id],,,[#include <sys/mount.h>]) -#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD +#if !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) || !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_ID) But we also need to change listmount.h to use the struct fallback. Full diff is at the end. > > https://github.com/pevik/ltp/actions/runs/20166087670/job/57889711762 > > (CI does not work, therefore I pushed you patchset.) > > > +typedef struct mnt_id_req_fallback mnt_id_req; > > > +#else > > > +typedef struct mnt_id_req mnt_id_req; > > > #endif > > ... > > > +static void setup(void) > > > +{ > > > + if (tst_kvercmp(6, 18, 0) >= 0) { > > > + tcases[4].exp_errno = EBADF; > > > + tcases[4].msg = "invalid mnt_id_req.mnt_ns_fd (EBADF)"; > > Hardcoding array index is asking for problems in the future. > > That's why I suggested more complicated code in previous version. > > https://lore.kernel.org/ltp/20251211115111.GA63924@pevik/ > Another solution would be to define testcases for both for EINVAL and > EBADF and add a flag which should be enabled on newer kernel: > #define BEFORE_6_18 1 > #define AFTER_6_18 2 > ... > { > .req_usage = 1, > .size = MNT_ID_REQ_SIZE_VER0, > .spare = -1, > .mnt_id = LSMT_ROOT, > .mnt_ids = mnt_ids, > .nr_mnt_ids = MNT_SIZE, > .exp_errno = EINVAL, > .msg = "invalid mnt_id_req.spare", > .kver = BEFORE_6_18, > }, > { > .req_usage = 1, > .size = MNT_ID_REQ_SIZE_VER0, > .spare = -1, > .mnt_id = LSMT_ROOT, > .mnt_ids = mnt_ids, > .nr_mnt_ids = MNT_SIZE, > .exp_errno = EBADF, > .msg = "invalid mnt_id_req.mnt_nf_fd", > .kver = AFTER_6_18, > }, > ... > static void run(...) > { > ... > if (tc->kver && tc->kver != kver) > return; Yeah that would work as well, but I suppose TCONF will be needed due check for results. > ... > } > static void setup(void) > { > if (tst_kvercmp(6, 18, 0) >= 0) > kver = AFTER_6_18; > else > kver = BEFORE_6_18; > } Kind regards, Petr Diff without kernel version change. +++ configure.ac @@ -262,8 +262,8 @@ AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>]) 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 mnt_id_req],,,[#include <sys/mount.h>]) +AC_CHECK_MEMBERS([struct mnt_id_req.mnt_ns_fd, struct mnt_id_req.mnt_id],,,[#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 include/lapi/mount.h include/lapi/mount.h index 7b1c4ca0fe..8bde0e563a 100644 --- include/lapi/mount.h +++ include/lapi/mount.h @@ -53,7 +53,7 @@ struct mnt_id_req_fallback { uint64_t mnt_ns_id; }; -#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD +#if !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) || !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_ID) typedef struct mnt_id_req_fallback mnt_id_req; #else typedef struct mnt_id_req mnt_id_req; diff --git testcases/kernel/syscalls/listmount/listmount.h testcases/kernel/syscalls/listmount/listmount.h index aad927f714..74f334c74e 100644 --- testcases/kernel/syscalls/listmount/listmount.h +++ testcases/kernel/syscalls/listmount/listmount.h @@ -8,6 +8,7 @@ #define _GNU_SOURCE +#include "config.h" #include "tst_test.h" #include "lapi/mount.h" #include "lapi/syscalls.h" @@ -15,11 +16,10 @@ static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id, uint64_t list[], size_t num, unsigned int flags) { - struct mnt_id_req req = { - .size = MNT_ID_REQ_SIZE_VER0, - .mnt_id = mnt_id, - .param = last_mnt_id, - }; + mnt_id_req *req = NULL; + req->size = MNT_ID_REQ_SIZE_VER0; + req->mnt_id = mnt_id; + req->param = last_mnt_id; return tst_syscall(__NR_listmount, &req, list, num, flags); } -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-12 14:20 ` Petr Vorel @ 2025-12-12 15:11 ` Petr Vorel 2025-12-14 1:54 ` Wei Gao via ltp 0 siblings, 1 reply; 26+ messages in thread From: Petr Vorel @ 2025-12-12 15:11 UTC (permalink / raw) To: Cyril Hrubis, Wei Gao, ltp, Li Wang > > Hi! > > > > -#ifndef HAVE_STRUCT_MNT_ID_REQ > > > > -struct mnt_id_req { > > > > +struct mnt_id_req_fallback { > > > > uint32_t size; > > > > - uint32_t spare; > > > > + uint32_t mnt_ns_fd; > > > > uint64_t mnt_id; > > > > uint64_t param; > > > > uint64_t mnt_ns_id; > > > > }; > > > > + > > > > +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > > Shouldn't be !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > > !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) ? > > > Also, this patchset introduces compilation error on old systems: > > > In file included from listmount03.c:13:0: > > > listmount.h:20:4: error: 'struct mnt_id_req' has no member named 'mnt_id' > > > .mnt_id = mnt_id, > > > Obviously some definition is wrong. > > That looks like we need configure check for mnt_id too however that > > happens in a different test. > Yes: Actually no, the problem was that typedef expects using pointer. And we now need to use it in all tests, therefore listmount.h needs to be updated. Below is diff (without handling different errno). Kind regards, Petr diff --git configure.ac configure.ac index fcff907991..2866ee981d 100644 --- configure.ac +++ configure.ac @@ -172,6 +172,9 @@ AC_CHECK_FUNCS_ONCE([ \ ]) AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!)) +# Defined in <linux/mount.h>, but include/lapi/mount.h includes <sys/mount.h> */ +AC_CHECK_MEMBERS([struct mnt_id_req.mnt_ns_fd],,,[#include <sys/mount.h>]) + AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>]) AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>]) AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>]) @@ -261,9 +264,6 @@ AC_CHECK_TYPES([struct mount_attr],,,[ AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>]) 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 include/lapi/mount.h include/lapi/mount.h index 7b1c4ca0fe..5d9ccde28d 100644 --- include/lapi/mount.h +++ include/lapi/mount.h @@ -53,7 +53,7 @@ struct mnt_id_req_fallback { uint64_t mnt_ns_id; }; -#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD +#ifndef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_ID typedef struct mnt_id_req_fallback mnt_id_req; #else typedef struct mnt_id_req mnt_id_req; diff --git testcases/kernel/syscalls/listmount/listmount.h testcases/kernel/syscalls/listmount/listmount.h index aad927f714..74f334c74e 100644 --- testcases/kernel/syscalls/listmount/listmount.h +++ testcases/kernel/syscalls/listmount/listmount.h @@ -8,6 +8,7 @@ #define _GNU_SOURCE +#include "config.h" #include "tst_test.h" #include "lapi/mount.h" #include "lapi/syscalls.h" @@ -15,11 +16,10 @@ static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id, uint64_t list[], size_t num, unsigned int flags) { - struct mnt_id_req req = { - .size = MNT_ID_REQ_SIZE_VER0, - .mnt_id = mnt_id, - .param = last_mnt_id, - }; + mnt_id_req *req = NULL; + req->size = MNT_ID_REQ_SIZE_VER0; + req->mnt_id = mnt_id; + req->param = last_mnt_id; return tst_syscall(__NR_listmount, &req, list, num, flags); } -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-12 15:11 ` Petr Vorel @ 2025-12-14 1:54 ` Wei Gao via ltp 2025-12-15 15:22 ` Petr Vorel 0 siblings, 1 reply; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-14 1:54 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp On Fri, Dec 12, 2025 at 04:11:56PM +0100, Petr Vorel wrote: > > > Hi! > > > > > -#ifndef HAVE_STRUCT_MNT_ID_REQ > > > > > -struct mnt_id_req { > > > > > +struct mnt_id_req_fallback { > > > > > uint32_t size; > > > > > - uint32_t spare; > > > > > + uint32_t mnt_ns_fd; > > > > > uint64_t mnt_id; > > > > > uint64_t param; > > > > > uint64_t mnt_ns_id; > > > > > }; > > > > > + > > > > > +#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > > > Shouldn't be !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > > > > !defined(HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD) ? > > > > > Also, this patchset introduces compilation error on old systems: > > > > > In file included from listmount03.c:13:0: > > > > listmount.h:20:4: error: 'struct mnt_id_req' has no member named 'mnt_id' > > > > .mnt_id = mnt_id, > > > > > Obviously some definition is wrong. > > > > That looks like we need configure check for mnt_id too however that > > > happens in a different test. > > > Yes: > > Actually no, the problem was that typedef expects using pointer. > And we now need to use it in all tests, therefore listmount.h needs to be > updated. > > Below is diff (without handling different errno). > > Kind regards, > Petr > > diff --git configure.ac configure.ac > index fcff907991..2866ee981d 100644 > --- configure.ac > +++ configure.ac > @@ -172,6 +172,9 @@ AC_CHECK_FUNCS_ONCE([ \ > ]) > AC_CHECK_FUNCS(mkdtemp,[],AC_MSG_ERROR(mkdtemp() not found!)) > > +# Defined in <linux/mount.h>, but include/lapi/mount.h includes <sys/mount.h> */ > +AC_CHECK_MEMBERS([struct mnt_id_req.mnt_ns_fd],,,[#include <sys/mount.h>]) > + > AC_CHECK_MEMBERS([struct fanotify_event_info_fid.fsid.__val],,,[#include <sys/fanotify.h>]) > AC_CHECK_MEMBERS([struct perf_event_mmap_page.aux_head],,,[#include <linux/perf_event.h>]) > AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],[],[],[#include <signal.h>]) > @@ -261,9 +264,6 @@ AC_CHECK_TYPES([struct mount_attr],,,[ > AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>]) > 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 include/lapi/mount.h include/lapi/mount.h > index 7b1c4ca0fe..5d9ccde28d 100644 > --- include/lapi/mount.h > +++ include/lapi/mount.h > @@ -53,7 +53,7 @@ struct mnt_id_req_fallback { > uint64_t mnt_ns_id; > }; > > -#if !defined(HAVE_STRUCT_MNT_ID_REQ) || !HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD > +#ifndef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_ID > typedef struct mnt_id_req_fallback mnt_id_req; > #else > typedef struct mnt_id_req mnt_id_req; > diff --git testcases/kernel/syscalls/listmount/listmount.h testcases/kernel/syscalls/listmount/listmount.h > index aad927f714..74f334c74e 100644 > --- testcases/kernel/syscalls/listmount/listmount.h > +++ testcases/kernel/syscalls/listmount/listmount.h > @@ -8,6 +8,7 @@ > > #define _GNU_SOURCE > > +#include "config.h" > #include "tst_test.h" > #include "lapi/mount.h" > #include "lapi/syscalls.h" > @@ -15,11 +16,10 @@ > static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id, > uint64_t list[], size_t num, unsigned int flags) > { > - struct mnt_id_req req = { > - .size = MNT_ID_REQ_SIZE_VER0, > - .mnt_id = mnt_id, > - .param = last_mnt_id, > - }; > + mnt_id_req *req = NULL; > + req->size = MNT_ID_REQ_SIZE_VER0; > + req->mnt_id = mnt_id; > + req->param = last_mnt_id; > > return tst_syscall(__NR_listmount, &req, list, num, flags); Thanks for such detail feedback, will sent next patch. I guess we need s/&req/req/, or i think simple s/struct mnt_id_req/mnt_id_req/ more better. > } -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v5] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-14 1:54 ` Wei Gao via ltp @ 2025-12-15 15:22 ` Petr Vorel 0 siblings, 0 replies; 26+ messages in thread From: Petr Vorel @ 2025-12-15 15:22 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, ... > > static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id, > > uint64_t list[], size_t num, unsigned int flags) > > { > > - struct mnt_id_req req = { > > - .size = MNT_ID_REQ_SIZE_VER0, > > - .mnt_id = mnt_id, > > - .param = last_mnt_id, > > - }; > > + mnt_id_req *req = NULL; > > + req->size = MNT_ID_REQ_SIZE_VER0; > > + req->mnt_id = mnt_id; > > + req->param = last_mnt_id; > > return tst_syscall(__NR_listmount, &req, list, num, flags); > Thanks for such detail feedback, will sent next patch. > I guess we need s/&req/req/, > or i think simple s/struct mnt_id_req/mnt_id_req/ more better. Sure, just remove "struct" is way better, thanks! Kind regards, Petr > > } -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* [LTP] [PATCH v6] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-12 11:50 ` [LTP] [PATCH v5] " Wei Gao via ltp 2025-12-12 12:28 ` Petr Vorel @ 2025-12-14 2:15 ` Wei Gao via ltp 2025-12-15 15:20 ` Petr Vorel ` (2 more replies) 1 sibling, 3 replies; 26+ messages in thread From: Wei Gao via ltp @ 2025-12-14 2:15 UTC (permalink / raw) To: ltp Kernel change from v6.18-rc7 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 | 2 +- include/lapi/mount.h | 10 +++-- .../kernel/syscalls/listmount/listmount.h | 2 +- .../kernel/syscalls/listmount/listmount04.c | 37 +++++++++++++++++-- .../kernel/syscalls/statmount/statmount.h | 2 +- 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 0480f46ca..a0ebbb34d 100644 --- a/configure.ac +++ b/configure.ac @@ -262,7 +262,7 @@ AC_CHECK_TYPES([struct cachestat_range],,,[#include <sys/mman.h>]) 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/include/lapi/mount.h b/include/lapi/mount.h index 0f7bb5e43..3b296fc9c 100644 --- a/include/lapi/mount.h +++ b/include/lapi/mount.h @@ -45,14 +45,18 @@ # define MS_NOSYMFOLLOW 256 #endif -#ifndef HAVE_STRUCT_MNT_ID_REQ -struct mnt_id_req { +struct mnt_id_req_fallback { uint32_t size; - uint32_t spare; + uint32_t mnt_ns_fd; uint64_t mnt_id; uint64_t param; uint64_t mnt_ns_id; }; + +#ifndef HAVE_STRUCT_MNT_ID_REQ_MNT_NS_FD +typedef struct mnt_id_req_fallback mnt_id_req; +#else +typedef struct mnt_id_req mnt_id_req; #endif #ifndef HAVE_STRUCT_STATMOUNT diff --git a/testcases/kernel/syscalls/listmount/listmount.h b/testcases/kernel/syscalls/listmount/listmount.h index aad927f71..e7ef375d7 100644 --- a/testcases/kernel/syscalls/listmount/listmount.h +++ b/testcases/kernel/syscalls/listmount/listmount.h @@ -15,7 +15,7 @@ static inline ssize_t listmount(uint64_t mnt_id, uint64_t last_mnt_id, uint64_t list[], size_t num, unsigned int flags) { - struct mnt_id_req req = { + mnt_id_req req = { .size = MNT_ID_REQ_SIZE_VER0, .mnt_id = mnt_id, .param = last_mnt_id, diff --git a/testcases/kernel/syscalls/listmount/listmount04.c b/testcases/kernel/syscalls/listmount/listmount04.c index a6921a249..c1f00d99a 100644 --- a/testcases/kernel/syscalls/listmount/listmount04.c +++ b/testcases/kernel/syscalls/listmount/listmount04.c @@ -14,14 +14,18 @@ #define _GNU_SOURCE +#include "config.h" #include "tst_test.h" #include "lapi/mount.h" #include "lapi/syscalls.h" #define MNT_SIZE 32 +#define BEFORE_6_18 1 +#define AFTER_6_18 2 -static struct mnt_id_req *request; +static mnt_id_req *request; static uint64_t mnt_ids[MNT_SIZE]; +static int kver; static struct tcase { int req_usage; @@ -34,6 +38,7 @@ static struct tcase { uint64_t flags; int exp_errno; char *msg; + int kver; } tcases[] = { { .req_usage = 0, @@ -79,6 +84,18 @@ static struct tcase { .nr_mnt_ids = MNT_SIZE, .exp_errno = EINVAL, .msg = "invalid mnt_id_req.spare", + .kver = BEFORE_6_18, + }, + { + .req_usage = 1, + .size = MNT_ID_REQ_SIZE_VER0, + .spare = -1, + .mnt_id = LSMT_ROOT, + .mnt_ids = mnt_ids, + .nr_mnt_ids = MNT_SIZE, + .exp_errno = EBADF, + .msg = "invalid mnt_id_req.mnt_ns_fd", + .kver = AFTER_6_18, }, { .req_usage = 1, @@ -113,7 +130,12 @@ static struct tcase { static void run(unsigned int n) { struct tcase *tc = &tcases[n]; - struct mnt_id_req *req = NULL; + mnt_id_req *req = NULL; + + if (tc->kver && tc->kver != kver) { + tst_res(TCONF, "Skip the case that is not suitable for the current kernel version"); + return; + } memset(mnt_ids, 0, sizeof(mnt_ids)); @@ -122,7 +144,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->spare; } TST_EXP_FAIL(tst_syscall(__NR_listmount, req, tc->mnt_ids, @@ -130,8 +152,17 @@ static void run(unsigned int n) "%s", tc->msg); } +static void setup(void) +{ + if (tst_kvercmp(6, 18, 0) >= 0) + kver = AFTER_6_18; + else + kver = BEFORE_6_18; +} + static struct tst_test test = { .test = run, + .setup = setup, .tcnt = ARRAY_SIZE(tcases), .min_kver = "6.11", .bufs = (struct tst_buffers []) { diff --git a/testcases/kernel/syscalls/statmount/statmount.h b/testcases/kernel/syscalls/statmount/statmount.h index d21d7f8da..4217a82d8 100644 --- a/testcases/kernel/syscalls/statmount/statmount.h +++ b/testcases/kernel/syscalls/statmount/statmount.h @@ -16,7 +16,7 @@ static inline int statmount(uint64_t mnt_id, uint64_t mask, struct statmount *buf, size_t bufsize, unsigned int flags) { - struct mnt_id_req req = { + mnt_id_req req = { .size = MNT_ID_REQ_SIZE_VER0, .mnt_id = mnt_id, .param = mask, -- 2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v6] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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 2 siblings, 0 replies; 26+ messages in thread From: Petr Vorel @ 2025-12-15 15:20 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, LGTM now. Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v6] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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 2 siblings, 0 replies; 26+ messages in thread From: Li Wang via ltp @ 2025-12-16 8:08 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, Patch v6 generally looks good: Reviewed-by: Li Wang <liwang@redhat.com> -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v6] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 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 2 siblings, 1 reply; 26+ messages in thread From: Cyril Hrubis @ 2025-12-17 9:32 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi! > static void run(unsigned int n) > { > struct tcase *tc = &tcases[n]; > - struct mnt_id_req *req = NULL; > + mnt_id_req *req = NULL; > + > + if (tc->kver && tc->kver != kver) { > + tst_res(TCONF, "Skip the case that is not suitable for the current kernel version"); I would shorten this message a bit "Test not suitable for current kernel version" Because the information that the test is skipped is already in the TCONF flag. Otherwise: Reviewed-by: Cyril Hrubis <chrubis@suse.cz> -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [LTP] [PATCH v6] listmount04.c: Update case support mnt_id_req.mnt_ns_fd 2025-12-17 9:32 ` Cyril Hrubis @ 2025-12-17 13:15 ` Petr Vorel 0 siblings, 0 replies; 26+ messages in thread From: Petr Vorel @ 2025-12-17 13:15 UTC (permalink / raw) To: Cyril Hrubis; +Cc: ltp > Hi! > > static void run(unsigned int n) > > { > > struct tcase *tc = &tcases[n]; > > - struct mnt_id_req *req = NULL; > > + mnt_id_req *req = NULL; > > + > > + if (tc->kver && tc->kver != kver) { > > + tst_res(TCONF, "Skip the case that is not suitable for the current kernel version"); > I would shorten this message a bit "Test not suitable for current kernel version" > Because the information that the test is skipped is already in the TCONF > flag. +1. I noticed that as well, just forget to point this out. I modified the message and also rewrite commit message to get more info what was needed to do. Thanks you all, finally we have CI fixed (+ compilation of the package on various distros) :). > Otherwise: Reviewed-by: Cyril Hrubis <chrubis@suse.cz> @Cyril FYI: RBT should be on a separate line otherwise it's not added by patchwork when applying the patch. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2025-12-17 13:16 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox