public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it, Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: arnd@kernel.org, brauner@kernel.org, jack@suse.cz,
	regressions@lists.linux.dev, arnd@arndb.de,
	linux-kernel@vger.kernel.org, lkft-triage@lists.linaro.org,
	viro@zeniv.linux.org.uk, benjamin.copeland@linaro.org,
	linux-fsdevel@vger.kernel.org, aalbersh@kernel.org,
	lkft@linaro.org, dan.carpenter@linaro.org
Subject: Re: [LTP] [PATCH v2] ioctl_pidfd05: accept both EINVAL and ENOTTY as valid errors
Date: Thu, 23 Oct 2025 22:02:32 +0200	[thread overview]
Message-ID: <12786420.O9o76ZdvQC@thinkpad> (raw)
In-Reply-To: <20251023164401.302967-1-naresh.kamboju@linaro.org>

Hi,


On Thursday, October 23, 2025 6:44:01 PM CEST Naresh Kamboju wrote:
> Newer kernels (since ~v6.18-rc1) return ENOTTY instead of EINVAL when
> invoking ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid). Update the
> test to accept both EINVAL and ENOTTY as valid errors to ensure
> compatibility across different kernel versions.
> 
> Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>

Tested-by: Avinesh Kumar <akumar@suse.de>
Reviewed-by: Avinesh Kumar <akumar@suse.de>

Regards,
Avinesh

> ---
>  testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c
> index d20c6f074..744f7def4 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c
> @@ -4,8 +4,8 @@
>   */
>  
>  /*\
> - * Verify that ioctl() raises an EINVAL error when PIDFD_GET_INFO is used. This
> - * happens when:
> + * Verify that ioctl() raises an EINVAL or ENOTTY (since ~v6.18-rc1) error when
> + * PIDFD_GET_INFO is used. This happens when:
>   *
>   * - info parameter is NULL
>   * - info parameter is providing the wrong size
> @@ -14,6 +14,7 @@
>  #include "tst_test.h"
>  #include "lapi/pidfd.h"
>  #include "lapi/sched.h"
> +#include <errno.h>
>  #include "ioctl_pidfd.h"
>  
>  struct pidfd_info_invalid {
> @@ -43,7 +44,12 @@ static void run(void)
>  		exit(0);
>  
>  	TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO, NULL), EINVAL);
> -	TST_EXP_FAIL(ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid), EINVAL);
> +
> +	/* Expect ioctl to fail; accept either EINVAL or ENOTTY (~v6.18-rc1) */
> +	int exp_errnos[] = {EINVAL, ENOTTY};
> +
> +	TST_EXP_FAIL_ARR(ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid),
> +			exp_errnos, ARRAY_SIZE(exp_errnos));
>  
>  	SAFE_CLOSE(pidfd);
>  }
> 





      parent reply	other threads:[~2025-10-23 20:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 16:44 [PATCH v2] ioctl_pidfd05: accept both EINVAL and ENOTTY as valid errors Naresh Kamboju
2025-10-23 19:20 ` Anders Roxell
2025-10-24  8:15   ` Petr Vorel
2025-10-23 20:02 ` Avinesh Kumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12786420.O9o76ZdvQC@thinkpad \
    --to=akumar@suse.de \
    --cc=aalbersh@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=benjamin.copeland@linaro.org \
    --cc=brauner@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=lkft@linaro.org \
    --cc=ltp@lists.linux.it \
    --cc=naresh.kamboju@linaro.org \
    --cc=regressions@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    /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