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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 26 Oct 2020 10:55:48 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Stefano Garzarella <sgarzare@...hat.com>
Cc:     David Laight <David.Laight@...lab.com>,
        Colin King <colin.king@...onical.com>,
        "David S . Miller" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vsock: ratelimit unknown ioctl error message

On Mon, 26 Oct 2020 11:01:12 +0100 Stefano Garzarella wrote:
> On Mon, Oct 26, 2020 at 09:46:17AM +0000, David Laight wrote:
> >From: Stefano Garzarella  
> >> Sent: 26 October 2020 09:39
> >>
> >> On Mon, Oct 26, 2020 at 09:13:23AM +0000, David Laight wrote:  
> >> >From: Stefano Garzarella  
> >> >> Sent: 26 October 2020 08:43  
> >> >...  
> >> >> >Isn't the canonical error for unknown ioctl codes -ENOTTY?
> >> >> >  
> >> >>
> >> >> Oh, thanks for pointing that out!
> >> >>
> >> >> I had not paid attention to the error returned, but looking at it I
> >> >> noticed that perhaps the most appropriate would be -ENOIOCTLCMD.
> >> >> In the ioctl syscall we return -ENOTTY, if the callback returns
> >> >> -ENOIOCTLCMD.
> >> >>
> >> >> What do you think?  
> >> >
> >> >It is 729 v 443 in favour of ENOTTY (based on grep).  
> >>
> >> Under net/ it is 6 vs 83 in favour of ENOIOCTLCMD.
> >>  
> >> >
> >> >No idea where ENOIOCTLCMD comes from, but ENOTTY probably
> >> >goes back to the early 1970s.  
> >>
> >> Me too.
> >>  
> >> >
> >> >The fact that the ioctl wrapper converts the value is a good
> >> >hint that userspace expects ENOTTY.  
> >>
> >> Agree on that, but since we are not interfacing directly with userspace,
> >> I think it is better to return the more specific error (ENOIOCTLCMD).  
> >
> >I bet Linux thought it could use a different error code then
> >found that 'unknown ioctl' was spelt ENOTTY.  
> 
> It could be :-)
> 
> Anyway, as you pointed out, I think we should change the -EINVAL with 
> -ENOTTY or -ENOIOCTLCMD.
> 
> @Jakub what do you suggest?

ENOIOCTLCMD is a kernel-internal high return code (515) which should 
be returned by the driver, but it's then caught inside the core and
translated to ENOTTY which is then returned to user space.

So you're both right, I guess? But the driver should use ENOIOCTLCMD.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ