All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] listmount04.c: Update case support mnt_id_req.mnt_ns_fd
Date: Tue, 9 Dec 2025 12:17:25 +0100	[thread overview]
Message-ID: <20251209111725.GA756311@pevik> (raw)
In-Reply-To: <20251209004242.31774-1-wegao@suse.com>

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

  reply	other threads:[~2025-12-09 11:17 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
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 [this message]
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=20251209111725.GA756311@pevik \
    --to=pvorel@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.