[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADYN=9J1xAgctUqwptD5C3Ss9aJZvZQ2ep=Ck2zP6X+ZrKe81Q@mail.gmail.com>
Date: Thu, 23 Oct 2025 21:20:06 +0200
From: Anders Roxell <anders.roxell@...aro.org>
To: Naresh Kamboju <naresh.kamboju@...aro.org>
Cc: ltp@...ts.linux.it, lkft@...aro.org, arnd@...nel.org,
dan.carpenter@...aro.org, pvorel@...e.cz, jack@...e.cz, brauner@...nel.org,
chrubis@...e.cz, linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
regressions@...ts.linux.dev, aalbersh@...nel.org, arnd@...db.de,
viro@...iv.linux.org.uk, benjamin.copeland@...aro.org,
andrea.cervesato@...e.com, lkft-triage@...ts.linaro.org
Subject: Re: [PATCH v2] ioctl_pidfd05: accept both EINVAL and ENOTTY as valid errors
On Thu, 23 Oct 2025 at 18:44, Naresh Kamboju <naresh.kamboju@...aro.org> 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@...aro.org>
Verified this on arm64, and the test passed now.
Tested-by: Anders Roxell <anders.roxell@...aro.org>
Cheers,
Anders
> ---
> 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);
> }
> --
> 2.43.0
>
Powered by blists - more mailing lists