Re: [PATCHES] tty ioctls cleanups, compat and not only
From: Arnd Bergmann
Date: Thu Sep 13 2018 - 16:57:09 EST
On Thu, Sep 13, 2018 at 10:31 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Sep 13, 2018 at 01:19:42PM +0200, Arnd Bergmann wrote:
> > On Thu, Sep 13, 2018 at 4:31 AM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> > * TIOCSERGWILD/TIOCSERSWILD are obsolete and never do
> > anything useful, but the return code is inconsistent: ENOTTY
> > in compat mode vs 0 in uart_ioctl, plus a printk for amiserial.
> > If we want to keep it around rather than deleting it completely,
> > it should be marked as compatible.
>
> Yes. Not sure if we want to - the only user is setserial(8), with
> -W Do wild interrupt initialization and exit. This option is no
> longer relevant in Linux kernels after version 2.1.
>
> What's more, rc.serial does *not* use it since 2.15 and even in 2.14 it wouldn't
> have failed the boot - just whine (truthfully) "Cannot scan for wild interrupts"
> on stderr and continue with the rest of the script. The same goes at least as
> far back as setserial-2.02. That's what MCC had; if you want to check something
> earlier, you'll probably have to ask tytso, but I very much doubt that anything
> of that vintage will work with the current kernels *or* that anyone cared to
> abort the script in question on setserial -W /dev/cua0 failing to start with.
>
> So I'd seriously suggest removing those altogether. I mean, sure, we can carry
> explicit "obsolete, quietly return 0 on those" indefinitely, but that really feels
> over the top. Time to bury the body, unless somebody objects...
Sounds good to me.
> > * PPPIOCGCHAN/PPPIOCGUNIT are implemented by multiple
> > ldisc variants, marking them as compatible would save us from
> > implementing a comp_ioctl method for each one separately.
> > These are also used on some things that are not ttys though,
> > so we can't remove them from fs/compat_ioctl.c yet.
>
> Worse - there's ipwireless, which implements it in tty_operations ->ioctl().
Yes, I saw that too, but couldn't figure out exactly what ipwireless
does. I suppose it is some serial port driver that comes with a
hardcoded ppp implementation instead of a switchable ldisc?
> > * SIOCGIFNAME, SIOCGIFENCAP, SIOCSIFENCAP,
> > SIOCSIFHWADDR, SIOCSKEEPALIVE, SIOCGKEEPALIVE,
> > SIOCSOUTFILL, and SIOCGOUTFILL are in the tty_ioctl
> > functions for multiple protocol handlers, comparable to
> > the PPP ones.
>
> Very definitely shared with sockets, and I prefer to handle the tty-side cases
> in ldisc ->compat_ioctl().
Fair enough.
Arnd