 
            On Thu 23-10-25 12:46:45, Jiri Slaby wrote:
On 10. 09. 25, 16:36, Christian Brauner wrote:
Validate extensible ioctls stricter than we do now.
Signed-off-by: Christian Brauner brauner@kernel.org
fs/pidfs.c | 2 +- include/linux/fs.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
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);Hi,
this turned EINVAL (from pidfd_info()) into ENOTTY (from pidfd_ioctl()) for at least LTP's: struct pidfd_info_invalid { uint32_t dummy; };
#define PIDFD_GET_INFO_SHORT _IOWR(PIDFS_IOCTL_MAGIC, 11, struct pidfd_info_invalid)
ioctl(pidfd, PIDFD_GET_INFO_SHORT, info_invalid) == EINVAL
at: https://github.com/linux-test-project/ltp/blob/9bb94efa39bb1b08f37e56c7437db...
Is this expected?
We already discussed this internally but for others the problem was discussed here [1] and we decided the new errno value is OK and LTP test is being fixed up.
Honza
[1] https://lore.kernel.org/all/aPIPGeWo8gtxVxQX@yuki.lan/