From: Petr Vorel <pvorel@suse.cz>
To: Jan Kara <jack@suse.cz>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
Christian Brauner <brauner@kernel.org>,
Andrey Albershteyn <aalbersh@kernel.org>,
Linux Regressions <regressions@lists.linux.dev>,
Arnd Bergmann <arnd@arndb.de>,
open list <linux-kernel@vger.kernel.org>,
lkft-triage@lists.linaro.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Ben Copeland <benjamin.copeland@linaro.org>,
linux-fsdevel@vger.kernel.org, LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] 6.18.0-rc1: LTP syscalls ioctl_pidfd05: TFAIL: ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid) expected EINVAL: ENOTTY (25)
Date: Wed, 22 Oct 2025 09:51:34 +0200 [thread overview]
Message-ID: <20251022075134.GA463176@pevik> (raw)
In-Reply-To: <lguqncbotw2cu2nfaf6hwgip6wtrmeg2azvyeht7l56itlomy5@uccupuql3let>
> On Tue 21-10-25 15:21:08, Christian Brauner wrote:
> > On Fri, Oct 17, 2025 at 02:43:14PM +0200, Jan Kara wrote:
> > > On Fri 17-10-25 11:40:41, Cyril Hrubis wrote:
> > > > Hi!
> > > > > > ## Test error log
> > > > > > tst_buffers.c:57: TINFO: Test is using guarded buffers
> > > > > > tst_test.c:2021: TINFO: LTP version: 20250930
> > > > > > tst_test.c:2024: TINFO: Tested kernel: 6.18.0-rc1 #1 SMP PREEMPT
> > > > > > @1760657272 aarch64
> > > > > > tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
> > > > > > tst_kconfig.c:676: TINFO: CONFIG_TRACE_IRQFLAGS kernel option detected
> > > > > > which might slow the execution
> > > > > > tst_test.c:1842: TINFO: Overall timeout per run is 0h 21m 36s
> > > > > > ioctl_pidfd05.c:45: TPASS: ioctl(pidfd, PIDFD_GET_INFO, NULL) : EINVAL (22)
> > > > > > ioctl_pidfd05.c:46: TFAIL: ioctl(pidfd, PIDFD_GET_INFO_SHORT,
> > > > > > info_invalid) expected EINVAL: ENOTTY (25)
> > > > Looking closely this is a different problem.
> > > > What we do in the test is that we pass PIDFD_IOCTL_INFO whith invalid
> > > > size with:
> > > > struct pidfd_info_invalid {
> > > > uint32_t dummy;
> > > > };
> > > > #define PIDFD_GET_INFO_SHORT _IOWR(PIDFS_IOCTL_MAGIC, 11, struct pidfd_info_invalid)
> > > > And we expect to hit:
> > > > if (usize < PIDFD_INFO_SIZE_VER0)
> > > > return -EINVAL; /* First version, no smaller struct possible */
> > > > in fs/pidfs.c
> > > > And apparently the return value was changed in:
> > > > commit 3c17001b21b9f168c957ced9384abe969019b609
> > > > Author: Christian Brauner <brauner@kernel.org>
> > > > Date: Fri Sep 12 13:52:24 2025 +0200
> > > > pidfs: validate extensible ioctls
> > > > Validate extensible ioctls stricter than we do now.
> > > > Reviewed-by: Aleksa Sarai <cyphar@cyphar.com>
> > > > Reviewed-by: Jan Kara <jack@suse.cz>
> > > > Signed-off-by: Christian Brauner <brauner@kernel.org>
> > > > diff --git a/fs/pidfs.c b/fs/pidfs.c
> > > > index edc35522d75c..0a5083b9cce5 100644
> > > > --- a/fs/pidfs.c
> > > > +++ b/fs/pidfs.c
> > > > @@ -440,7 +440,7 @@ static bool pidfs_ioctl_valid(unsigned int cmd)
> > > > * erronously mistook the file descriptor for a pidfd.
> > > > * This is not perfect but will catch most cases.
> > > > */
> > > > - return (_IOC_TYPE(cmd) == _IOC_TYPE(PIDFD_GET_INFO));
> > > > + return extensible_ioctl_valid(cmd, PIDFD_GET_INFO, PIDFD_INFO_SIZE_VER0);
> > > > }
> > > > return false;
> > > > So kernel has changed error it returns, if this is a regression or not
> > > > is for kernel developers to decide.
> > > Yes, it's mostly a question to Christian whether if passed size for
> > > extensible ioctl is smaller than minimal, we should be returning
> > > ENOIOCTLCMD or EINVAL. I think EINVAL would make more sense but Christian
> > > is our "extensible ioctl expert" :).
> > You're asking difficult questions actually. :D
> > I think it would be completely fine to return EINVAL in this case.
> > But traditionally ENOTTY has been taken to mean that this is not a
> > supported ioctl. This translation is done by the VFS layer itself iirc.
> Now the translation is done by VFS, I agree. But in the past (when the LTP
> test was written) extensible ioctl with too small structure passed the
> initial checks, only later we found out the data is too short and returned
> EINVAL for that case. I *think* we are fine with just adjusting the test to
> accept the new world order but wanted your opinion what are the chances of
> some real userspace finding the old behavior useful or otherwise depending
> on it.
+1, thanks! Is it ok just expect any of these two regardless kernel version?
@Naresh Kamboju will you send a patch to LTP ML?
Kind regards,
Petr
> Honza
--
Mailing list info: https://lists.linux.it/listinfo/ltp
WARNING: multiple messages have this Message-ID (diff)
From: Petr Vorel <pvorel@suse.cz>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
Cyril Hrubis <chrubis@suse.cz>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
open list <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org, lkft-triage@lists.linaro.org,
Linux Regressions <regressions@lists.linux.dev>,
LTP List <ltp@lists.linux.it>,
Andrey Albershteyn <aalbersh@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Dan Carpenter <dan.carpenter@linaro.org>,
Anders Roxell <anders.roxell@linaro.org>,
Ben Copeland <benjamin.copeland@linaro.org>,
Andrea Cervesato <andrea.cervesato@suse.com>
Subject: Re: 6.18.0-rc1: LTP syscalls ioctl_pidfd05: TFAIL: ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid) expected EINVAL: ENOTTY (25)
Date: Wed, 22 Oct 2025 09:51:34 +0200 [thread overview]
Message-ID: <20251022075134.GA463176@pevik> (raw)
In-Reply-To: <lguqncbotw2cu2nfaf6hwgip6wtrmeg2azvyeht7l56itlomy5@uccupuql3let>
> On Tue 21-10-25 15:21:08, Christian Brauner wrote:
> > On Fri, Oct 17, 2025 at 02:43:14PM +0200, Jan Kara wrote:
> > > On Fri 17-10-25 11:40:41, Cyril Hrubis wrote:
> > > > Hi!
> > > > > > ## Test error log
> > > > > > tst_buffers.c:57: TINFO: Test is using guarded buffers
> > > > > > tst_test.c:2021: TINFO: LTP version: 20250930
> > > > > > tst_test.c:2024: TINFO: Tested kernel: 6.18.0-rc1 #1 SMP PREEMPT
> > > > > > @1760657272 aarch64
> > > > > > tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
> > > > > > tst_kconfig.c:676: TINFO: CONFIG_TRACE_IRQFLAGS kernel option detected
> > > > > > which might slow the execution
> > > > > > tst_test.c:1842: TINFO: Overall timeout per run is 0h 21m 36s
> > > > > > ioctl_pidfd05.c:45: TPASS: ioctl(pidfd, PIDFD_GET_INFO, NULL) : EINVAL (22)
> > > > > > ioctl_pidfd05.c:46: TFAIL: ioctl(pidfd, PIDFD_GET_INFO_SHORT,
> > > > > > info_invalid) expected EINVAL: ENOTTY (25)
> > > > Looking closely this is a different problem.
> > > > What we do in the test is that we pass PIDFD_IOCTL_INFO whith invalid
> > > > size with:
> > > > struct pidfd_info_invalid {
> > > > uint32_t dummy;
> > > > };
> > > > #define PIDFD_GET_INFO_SHORT _IOWR(PIDFS_IOCTL_MAGIC, 11, struct pidfd_info_invalid)
> > > > And we expect to hit:
> > > > if (usize < PIDFD_INFO_SIZE_VER0)
> > > > return -EINVAL; /* First version, no smaller struct possible */
> > > > in fs/pidfs.c
> > > > And apparently the return value was changed in:
> > > > commit 3c17001b21b9f168c957ced9384abe969019b609
> > > > Author: Christian Brauner <brauner@kernel.org>
> > > > Date: Fri Sep 12 13:52:24 2025 +0200
> > > > pidfs: validate extensible ioctls
> > > > Validate extensible ioctls stricter than we do now.
> > > > Reviewed-by: Aleksa Sarai <cyphar@cyphar.com>
> > > > Reviewed-by: Jan Kara <jack@suse.cz>
> > > > Signed-off-by: Christian Brauner <brauner@kernel.org>
> > > > diff --git a/fs/pidfs.c b/fs/pidfs.c
> > > > index edc35522d75c..0a5083b9cce5 100644
> > > > --- a/fs/pidfs.c
> > > > +++ b/fs/pidfs.c
> > > > @@ -440,7 +440,7 @@ static bool pidfs_ioctl_valid(unsigned int cmd)
> > > > * erronously mistook the file descriptor for a pidfd.
> > > > * This is not perfect but will catch most cases.
> > > > */
> > > > - return (_IOC_TYPE(cmd) == _IOC_TYPE(PIDFD_GET_INFO));
> > > > + return extensible_ioctl_valid(cmd, PIDFD_GET_INFO, PIDFD_INFO_SIZE_VER0);
> > > > }
> > > > return false;
> > > > So kernel has changed error it returns, if this is a regression or not
> > > > is for kernel developers to decide.
> > > Yes, it's mostly a question to Christian whether if passed size for
> > > extensible ioctl is smaller than minimal, we should be returning
> > > ENOIOCTLCMD or EINVAL. I think EINVAL would make more sense but Christian
> > > is our "extensible ioctl expert" :).
> > You're asking difficult questions actually. :D
> > I think it would be completely fine to return EINVAL in this case.
> > But traditionally ENOTTY has been taken to mean that this is not a
> > supported ioctl. This translation is done by the VFS layer itself iirc.
> Now the translation is done by VFS, I agree. But in the past (when the LTP
> test was written) extensible ioctl with too small structure passed the
> initial checks, only later we found out the data is too short and returned
> EINVAL for that case. I *think* we are fine with just adjusting the test to
> accept the new world order but wanted your opinion what are the chances of
> some real userspace finding the old behavior useful or otherwise depending
> on it.
+1, thanks! Is it ok just expect any of these two regardless kernel version?
@Naresh Kamboju will you send a patch to LTP ML?
Kind regards,
Petr
> Honza
next prev parent reply other threads:[~2025-10-22 7:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 8:51 6.18.0-rc1: LTP syscalls ioctl_pidfd05: TFAIL: ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid) expected EINVAL: ENOTTY (25) Naresh Kamboju
2025-10-17 9:20 ` [LTP] " Naresh Kamboju
2025-10-17 9:20 ` Naresh Kamboju
2025-10-17 9:25 ` [LTP] " Cyril Hrubis
2025-10-17 9:25 ` Cyril Hrubis
2025-10-17 9:40 ` [LTP] " Cyril Hrubis
2025-10-17 9:40 ` Cyril Hrubis
2025-10-17 12:43 ` [LTP] " Jan Kara
2025-10-17 12:43 ` Jan Kara
2025-10-21 13:21 ` [LTP] " Christian Brauner via ltp
2025-10-21 13:21 ` Christian Brauner
2025-10-21 20:48 ` [LTP] " Jan Kara
2025-10-21 20:48 ` Jan Kara
2025-10-22 7:51 ` Petr Vorel [this message]
2025-10-22 7:51 ` Petr Vorel
2025-10-22 8:10 ` [LTP] " Naresh Kamboju
2025-10-22 8:10 ` Naresh Kamboju
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=20251022075134.GA463176@pevik \
--to=pvorel@suse.cz \
--cc=aalbersh@kernel.org \
--cc=arnd@arndb.de \
--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=ltp@lists.linux.it \
--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 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.