RE: [PATCH] vsock: ratelimit unknown ioctl error message
flat view
From: David Laight <hidden>
Date: 2020-10-26 09:46:24
Also in:
kernel-janitors, lkml
From: Stefano Garzarella
Sent: 26 October 2020 09:39 On Mon, Oct 26, 2020 at 09:13:23AM +0000, David Laight wrote:quoted
From: Stefano Garzarellaquoted
Sent: 26 October 2020 08:43...quoted
quoted
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.quoted
No idea where ENOIOCTLCMD comes from, but ENOTTY probably goes back to the early 1970s.Me too.quoted
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. Back in the old days error values were probably almost unique. strerror(EAGIAN) was "No more processes" for a long time! David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)