Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Darren Chang <chihsheng@google.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/listmount04: Detect backported commit 78f0e33cd6c9 dynamically
Date: Wed, 3 Jun 2026 11:27:03 +0200	[thread overview]
Message-ID: <ah_zZ5jmnKGl5mFF@yuki.lan> (raw)
In-Reply-To: <20260603051401.658906-1-chihsheng@google.com>

Hi!
>  static void setup(void)
>  {
> -	if (tst_kvercmp(6, 17, 9) >= 0)
> -		kver = AFTER_6_17_9;
> -	else
> -		kver = BEFORE_6_17_9;
> +	/* 1. If kernel is 6.17.9 or newer, it definitively has the new behavior */
> +	if (tst_kvercmp(6, 17, 9) >= 0) {
> +		current_fd_err_behavior = INVALID_FD_RET_EBADF;
> +		return;
> +	}
> +
> +	/* 2. Runtime probe for older kernels:
> +	 * Check if commit 78f0e33cd6c9 was backported by manually issuing
> +	 * a syscall with an invalid mnt_ns_fd (-1).
> +	 */
> +	mnt_id_req probe_req = {
> +		.size = MNT_ID_REQ_SIZE_VER0,
> +		.mnt_id = LSMT_ROOT,
> +		.mnt_ns_fd = -1,
> +		.param = 0
> +	};
> +
> +	tst_syscall(__NR_listmount, &probe_req, mnt_ids, MNT_SIZE, 0);
> +
> +	/* 3. Set global behavior flag based on actual kernel response */
> +	if (errno == EBADF) {
> +		tst_res(TINFO, "Detected backported commit 78f0e33cd6c9 (returns EBADF)");
> +		current_fd_err_behavior = INVALID_FD_RET_EBADF;
> +	} else {
> +		current_fd_err_behavior = INVALID_FD_RET_EINVAL;
> +	}

This is too complicated. I think that we want to settle for:

* new behavior after 6.17.9 (i.e. EBADF)
* any of the two errnos before that (i.e. either EINVAL or EBADF)

For that we should skip to TST_EXP_FAIL_ARR() pass array with only single
errno for all cases but the one one where we need to allow both EINVAL
and EBADF.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2026-06-03  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  5:14 [LTP] [PATCH] syscalls/listmount04: Detect backported commit 78f0e33cd6c9 dynamically Darren Chang via ltp
2026-06-03  9:27 ` Cyril Hrubis [this message]
2026-06-03  9:35 ` [LTP] " linuxtestproject.agent

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=ah_zZ5jmnKGl5mFF@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=chihsheng@google.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox