From: Stefano Garzarella <sgarzare@redhat.com>
To: Colin King <colin.king@canonical.com>, Jakub Kicinski <kuba@kernel.org>
Cc: David Laight <David.Laight@aculab.com>,
"David S . Miller" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vsock: ratelimit unknown ioctl error message
Date: Mon, 26 Oct 2020 19:24:57 +0100 [thread overview]
Message-ID: <20201026182457.fy6uxrjgs5bpzmnr@steredhat> (raw)
In-Reply-To: <20201026105548.0cc911a8@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
On Mon, Oct 26, 2020 at 10:55:48AM -0700, Jakub Kicinski wrote:
>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.
>
Thanks for clarify!
@Colin, can you send a v2 removing the error message and updating the
return value?
Thanks,
Stefano
next prev parent reply other threads:[~2020-10-26 18:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-23 12:21 [PATCH] vsock: ratelimit unknown ioctl error message Colin King
2020-10-23 14:09 ` Stefano Garzarella
2020-10-23 20:25 ` Jakub Kicinski
2020-10-23 21:30 ` David Laight
2020-10-26 8:43 ` Stefano Garzarella
2020-10-26 9:13 ` David Laight
2020-10-26 9:39 ` Stefano Garzarella
2020-10-26 9:46 ` David Laight
2020-10-26 10:01 ` Stefano Garzarella
2020-10-26 17:55 ` Jakub Kicinski
2020-10-26 18:24 ` Stefano Garzarella [this message]
2020-10-26 18:37 ` Jakub Kicinski
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=20201026182457.fy6uxrjgs5bpzmnr@steredhat \
--to=sgarzare@redhat.com \
--cc=David.Laight@aculab.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).