linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jeff Dike <jdike@addtoit.com>,
	Richard Weinberger <richard@nod.at>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-um@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 03/11] compat_ioctl: remove translation for sound ioctls
Date: Tue, 11 Sep 2018 21:35:48 +0200	[thread overview]
Message-ID: <CAK8P3a2ZPDtFax50joj402H5m-kZG0etu10HqNRjSmo2xU5R5w@mail.gmail.com> (raw)
In-Reply-To: <20180909041632.GE19965@ZenIV.linux.org.uk>

On Sun, Sep 9, 2018 at 6:17 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Sat, Sep 08, 2018 at 04:28:09PM +0200, Arnd Bergmann wrote:
> > The SNDCTL_* and SOUND_* commands are the old OSS user interface.
> >
> > I checked all the sound ioctl commands listed in fs/compat_ioctl.c
> > to see if we still need the translation handlers. Here is what I
> > found:
> >
> > - sound/oss/ is (almost) gone from the kernel, this is what actually
> >   needed all the translations
> > - The ALSA emulation for OSS correctly handles all compat_ioctl
> >   commands already.
> > - sound/oss/dmasound/ is the last holdout of the original OSS code,
> >   this is only used on arch/m68k, which has no 64-bit mode and
> >   hence needs no compat handlers
> > - arch/um/drivers/hostaudio_kern.c may run in 64-bit mode with
> >   32-bit x86 user space underneath it. This rare corner case is
> >   the only one that still needs the compat handlers.
> >
> > By adding a simple redirect of .compat_ioctl to .unlocked_ioctl in the
> > UML driver, we can remove all the COMPATIBLE_IOCTL() annotations without
> > a change in functionality. For completeness, I'm adding the same thing
> > to the dmasound file, knowing that it makes no difference.
>
> > diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
> > index 7f9dbdbc4eb7..0278a642a622 100644
> > --- a/arch/um/drivers/hostaudio_kern.c
> > +++ b/arch/um/drivers/hostaudio_kern.c
> > @@ -298,6 +298,7 @@ static const struct file_operations hostaudio_fops = {
> >       .write          = hostaudio_write,
> >       .poll           = hostaudio_poll,
> >       .unlocked_ioctl = hostaudio_ioctl,
> > +     .compat_ioctl   = hostaudio_ioctl,
>
> Umm...  OK, seeing that it's not going to be used on s390...  It's still
> not quite right, though, and I'm afraid that places where we have the
> same ->unlocked_ioctl and ->compat_ioctl need an audit - there probably
> had been other folks who'd stepped into the same.

It turns out that it's actually much more common to have the same
pointer for ioctl handlers that thake pointer arguments than to have
the wrapper. I found 16 instances of trivial wrappers to do compat_ptr()
for file_operations, 4 instances that have a wrapper but skip the
compat_ptr() and around 40 (depending on how you count) that use
the same pointer for both when they only use pointers and should
go through compat_ptr(). This includes a couple that don't use
the argument at all, so they are fine either way.

I've created patches to change all of the above to a new
generic_compat_ioctl_ptrarg() helper I added.

loop_control_ioctl(), kcov_ioctl(), proc_bus_pci_ioctl(), and nbd_ioctl() seem
to be ones that are correct because,  the argument is always an integer.
fs3270_ioctl() has a is_compat_task() check to deal with the problem.

inotify_ioctl(),  vsoc_ioctl(), and usblp_ioctl() are somethat uses both integer
and pointer arguments and may need special handling for s390.

I did not touch those so far.

       Arnd

  reply	other threads:[~2018-09-12  0:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-08 14:28 [PATCH 01/11] compat_ioctl: remove keyboard ioctl translation Arnd Bergmann
2018-09-08 14:28 ` [PATCH 02/11] compat_ioctl: remove HIDIO translation Arnd Bergmann
2018-09-08 14:28 ` [PATCH 03/11] compat_ioctl: remove translation for sound ioctls Arnd Bergmann
2018-09-09  4:16   ` Al Viro
2018-09-11 19:35     ` Arnd Bergmann [this message]
2018-09-08 14:28 ` [PATCH 04/11] compat_ioctl: remove isdn ioctl translation Arnd Bergmann
2018-09-08 14:28 ` [PATCH 05/11] compat_ioctl: remove IGNORE_IOCTL() Arnd Bergmann
2018-09-08 14:28 ` [PATCH 06/11] compat_ioctl: remove /dev/random commands Arnd Bergmann
2018-09-09  4:11   ` Al Viro
2018-09-11 20:26     ` Arnd Bergmann
2018-09-12  5:28       ` Martin Schwidefsky
2018-09-12 14:02         ` Arnd Bergmann
2018-09-13  6:42           ` Martin Schwidefsky
2018-09-13  8:13             ` Arnd Bergmann
2018-09-08 14:28 ` [PATCH 07/11] compat_ioctl: remove joystick ioctl translation Arnd Bergmann
2018-09-08 14:28 ` [PATCH 08/11] compat_ioctl: remove PCI " Arnd Bergmann
2018-09-08 14:28 ` [PATCH 09/11] compat_ioctl: remove /dev/raw " Arnd Bergmann
2018-09-08 14:28 ` [PATCH 10/11] compat_ioctl: remove last RAID handling code Arnd Bergmann
2018-09-08 14:28 ` [PATCH 11/11] compat_ioctl: move tape handling into drivers Arnd Bergmann
2018-09-09  4:37   ` Al Viro
2018-09-11 15:36     ` Arnd Bergmann
2018-09-11 20:13       ` Arnd Bergmann

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=CAK8P3a2ZPDtFax50joj402H5m-kZG0etu10HqNRjSmo2xU5R5w@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=jdike@addtoit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=perex@perex.cz \
    --cc=richard@nod.at \
    --cc=tiwai@suse.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH 03/11] compat_ioctl: remove translation for sound ioctls' \
    /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

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).