lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110125215039.GB20030@core.coreip.homeip.net>
Date:	Tue, 25 Jan 2011 13:50:39 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Mauro Carvalho Chehab <mchehab@...hat.com>,
	Mark Lord <kernel@...savvy.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	linux-input@...r.kernel.org, linux-media@...r.kernel.org
Subject: Re: 2.6.36/2.6.37: broken compatibility with userspace input-utils ?

On Wed, Jan 26, 2011 at 07:20:07AM +1000, Linus Torvalds wrote:
> On Wed, Jan 26, 2011 at 7:01 AM, Dmitry Torokhov
> <dmitry.torokhov@...il.com> wrote:
> >
> > BTW, another issue is that evdev's ioctl returns -EINVAL for unknown
> > ioctls so applications would have hard time figuring out whether error
> > returned because of kernel being too old or because they are trying to
> > retrieve/establish invalid mapping if they had to go only by the error
> > code.
> 
> So that's just another evdev interface bug.

Huh? I do not have lot of options here as far as error codes go. Invalid
request, invalid data in request - all goes to EINVAL.

> 
> > As far as I can see EINVAL is a proper error for unknown ioctls:
> >
> > [dtor@...mer work]$ man 2 ioctl | grep EINVAL
> >       EINVAL Request or argp is not valid.
> 
> Yeah, there's some confusion there.
> 
> The "unknown ioctl" error code is (for traditional reasons) ENOTTY,
> but yes, the EINVAL thing admittedly has a lot of legacy use too.
> 
> Inside the kernel, the preferred way to say "I don't recognize that
> ioctl number" is actually ENOIOCTLCMD.  That's exactly so that various
> nested ioctl handlers can then tell the difference between "I didn't
> recognize that ioctl" and "I understand what you asked me to do, but
> your arguments were crap".
> 
> vfs_ioctl() will then turn ENOIOCTLCMD to EINVAL to return to user space.

OK, so I can change evdev to employ ENOIOCTLCMD where needed, bit that
will not change older kernels where such distinction is needed (as never
kernels do support newer ioctl). And even if I could go back it would
not help since userspace still sees EINVAL only.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ