From patchwork Sat Sep 8 14:28:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D90F113AC for ; Sat, 8 Sep 2018 14:28:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9EEF2A39E for ; Sat, 8 Sep 2018 14:28:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD7B42A3A4; Sat, 8 Sep 2018 14:28:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UPPERCASE_50_75 autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57A392A39E for ; Sat, 8 Sep 2018 14:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbeIHTOk (ORCPT ); Sat, 8 Sep 2018 15:14:40 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:60997 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbeIHTOk (ORCPT ); Sat, 8 Sep 2018 15:14:40 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MtO4E-1fja7C2jHC-00us4C; Sat, 08 Sep 2018 16:28:40 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/11] compat_ioctl: remove keyboard ioctl translation Date: Sat, 8 Sep 2018 16:28:07 +0200 Message-Id: <20180908142837.2819693-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:Gz8Xz6xl87kUTIzpUST9fXtlPaHTobfeRYO3+pf3eMsd4Ck/d85 5ItkPxs+5a6/WChTlqUCiSCyfh8vMMaaq+vt6J427MFBvlfz0IcKjuuhr+YBq9csEJaf3t/ Lardw6pIIsDI9Qdb5nAariLPcws01/eOgBt/zzPwatnj+3m+UI+f4NLmAuV8P8t77MbGBiM 6ROJgVhNbg/T5UMmWoUfQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:27Pqvg3AFhU=:uNkLBf8C+9w11YLvPCfrPf 15h2unUxaZPoAptUKCID34yK2FtnaUcaJrIQ6Tm5mmmxvXAN26Y8rYJTkc8bQhZeB3kHPMxGx +zcZk/Ke02N+StrWkraTHvoPFCHqSCgsEadsVGl0QAP6BJ7EeD7wv5cet0AYnVfoFM4NxjGC9 M2LktmpLkjKpnhNzAJLO4fIEeKsmzWYwOBVtWanqZH1qGhmPR2IxLsA0c7ANcLmEEc3t9GOTl A6dKJvpm1B3KWp6UukS5dVkq+Qogeg1BMuPAN+FNnQyFu2GjRkrQEvgGc7HGMbH5djP0nKO2x 9OREChJ84Dki6n78f9DLxuJ5qXJorRgnwfoTDSWdrHWdj2daFbs+kucIwG+B6oM5svcSB/2bq R4Jpk8qnnkyVzmEwoaJGC2mk+jjdycNs19+L4cGG204VmmiR0igUkGoRNbebrFTC9Zi1SFwKQ IjDS0rVubh1GkN3QctzogqsEXjT4+TSCbBUPY2w9ele9Jt8JHEY1mb1j0cZdGVrRb0yJE4tKL NeVsE2NB/ufXW4Z+fhPK5xSXAT+sh/bVGAhTy4skxaAi7xsCOwnGJogD7lLmHwvtcg6pkbbts ApNKoo6C1QRfzWg2FktyXpaB7BiqmaZ/lxrPo2lUgByhDqdCE5HAClW7nFAy5QKRPuHTSVzsY mQFckiMUPW+JIEDLpNlItot0oEnFAR34+V7WoB4ih+kOgEmhoI78deNqhshI/FhrK0oI= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The KD* family of ioctls is implemented in two drivers: drivers/tty/vt and drivers/s390/char/tty3270.c. Both of them have compat handlers for all their ioctl commands, so translation in fs/compat_ioctl.c is never used. Commit fb07a5f857ac ("compat_ioctl: remove all VT ioctl handling") removed the compat handling for all the other VT ioctls back in 2009, but it seems I missed the keyboard ones back then. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9237076bdcf5..4c2f83a386a2 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -546,23 +546,6 @@ COMPATIBLE_IOCTL(FIGETBSZ) COMPATIBLE_IOCTL(FIFREEZE) COMPATIBLE_IOCTL(FITHAW) COMPATIBLE_IOCTL(FITRIM) -COMPATIBLE_IOCTL(KDGETKEYCODE) -COMPATIBLE_IOCTL(KDSETKEYCODE) -COMPATIBLE_IOCTL(KDGKBTYPE) -COMPATIBLE_IOCTL(KDGETMODE) -COMPATIBLE_IOCTL(KDGKBMODE) -COMPATIBLE_IOCTL(KDGKBMETA) -COMPATIBLE_IOCTL(KDGKBENT) -COMPATIBLE_IOCTL(KDSKBENT) -COMPATIBLE_IOCTL(KDGKBSENT) -COMPATIBLE_IOCTL(KDSKBSENT) -COMPATIBLE_IOCTL(KDGKBDIACR) -COMPATIBLE_IOCTL(KDSKBDIACR) -COMPATIBLE_IOCTL(KDGKBDIACRUC) -COMPATIBLE_IOCTL(KDSKBDIACRUC) -COMPATIBLE_IOCTL(KDKBDREP) -COMPATIBLE_IOCTL(KDGKBLED) -COMPATIBLE_IOCTL(KDGETLED) #ifdef CONFIG_BLOCK /* Big S */ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN) @@ -974,15 +957,6 @@ static long do_ioctl_trans(unsigned int cmd, case HOT_ADD_DISK: case SET_DISK_FAULTY: case SET_BITMAP_FILE: - /* Big K */ - case KDSIGACCEPT: - case KIOCSOUND: - case KDMKTONE: - case KDSETMODE: - case KDSKBMODE: - case KDSKBMETA: - case KDSKBLED: - case KDSETLED: return vfs_ioctl(file, cmd, arg); } From patchwork Sat Sep 8 14:28:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D62D13AC for ; Sat, 8 Sep 2018 14:28:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E0362A3C8 for ; Sat, 8 Sep 2018 14:28:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 720422A3DD; Sat, 8 Sep 2018 14:28:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UPPERCASE_50_75 autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23E652A3C8 for ; Sat, 8 Sep 2018 14:28:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726650AbeIHTOv (ORCPT ); Sat, 8 Sep 2018 15:14:51 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:36077 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbeIHTOv (ORCPT ); Sat, 8 Sep 2018 15:14:51 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MQusJ-1gC2Fg0z9r-00O0Hd; Sat, 08 Sep 2018 16:28:51 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/11] compat_ioctl: remove HIDIO translation Date: Sat, 8 Sep 2018 16:28:08 +0200 Message-Id: <20180908142837.2819693-2-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:1I7Gcze/afAgmffd/3BD2ZlxrLv3YnhRyEl67SMr2RW79rV+nw6 9xDXgu89vBFFY4343FDY/bphWCuqeVrHTjzmx5Qzr4mMnc3y2KPsd4mq9wtPFzoOiqt6m9V tuZC3KfeiFYYBpUqReoiB0+vMrIbeHwbyGsCa7JxOdlhm50ruymRLiiEQ2DCc2Et3ZaTkC9 1SJtdld4JYRTkl/VjXeBQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:IjpLeV6cdrY=:xBVd5L/OjCLh7ic+RKjJ/C 4EnnCtZH6/a/caSeTKpIisQaejYJt1dN1yrVlhXIeWSJcLUn8NwW3oarsFFzS2qMFgITKT2Vi ECD3fya2lOHkvFxrl7iu7wmAm21alDrfBvb70fxEDtRPldlDYtmIinDy+UCAVsJGtOycONMqe kdG7ktr7tZk4uHXs/aYyogI1dWVZABadxX3s7TcHmruSuLRBoV5ovBvaBV6WPToooMrmvHe7s QhQph8iWfpTNPntV9X3Vs7mNLBzLEbn57qZGx17t6YajDkxd0UUCleFWmq3P8ojGSiE846+qe XXBADtVORCdbAdxffzyPFunXEmnvilnXPuV3DsFxNAOcE2pLYX/6K7bdFBO44OWDw5sUEwo9N gfgAzB8dp5do2EywwW+2pCsqaWr3qEHegZot0cEsTbrKUWRCfpKFujCQ9j4xura8hwujKKlVC yiHxAFRkiXGA1E+zv0iiWshs3fVlbrKmnzUTKOc4BpamyocMdQGW+ScLU860HHxlFtmqHizTn Vr8ddQvaOSK5AZZEwD//5pvhpFIM1vMAKqY+BL+4eYrrf9OKwd++eRhuX3aTrv1k/bC9nDJlS 9W9NjDPpW4hc9Rt8LLcJWE/xMNLxZYRq+R3qw+4P//PU+6O5l1Q/w4RuBidc0ZA4LGcCIsDhy F6S76PTZzexI8tPc9Hq8X0pzd5+hTZ/ibPCrHw0KKQU2pGjq//10DQz2Tov+kChoGYFw= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The two drivers implementing these both gained proper compat_ioctl() handlers a long time ago with commits bb6c8d8fa9b5 ("HID: hiddev: Add 32bit ioctl compatibilty") and ae5e49c79c05 ("HID: hidraw: add compatibility ioctl() for 32-bit applications."), so the lists in fs/compat_ioctl.c are no longer used. It appears that the lists were also incomplete, so the translation didn't actually work correctly when it was still in use. Remove them as cleanup. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 4c2f83a386a2..c2c73b802fb3 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -853,23 +853,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) -/* hiddev */ -COMPATIBLE_IOCTL(HIDIOCGVERSION) -COMPATIBLE_IOCTL(HIDIOCAPPLICATION) -COMPATIBLE_IOCTL(HIDIOCGDEVINFO) -COMPATIBLE_IOCTL(HIDIOCGSTRING) -COMPATIBLE_IOCTL(HIDIOCINITREPORT) -COMPATIBLE_IOCTL(HIDIOCGREPORT) -COMPATIBLE_IOCTL(HIDIOCSREPORT) -COMPATIBLE_IOCTL(HIDIOCGREPORTINFO) -COMPATIBLE_IOCTL(HIDIOCGFIELDINFO) -COMPATIBLE_IOCTL(HIDIOCGUSAGE) -COMPATIBLE_IOCTL(HIDIOCSUSAGE) -COMPATIBLE_IOCTL(HIDIOCGUCODE) -COMPATIBLE_IOCTL(HIDIOCGFLAG) -COMPATIBLE_IOCTL(HIDIOCSFLAG) -COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) -COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) /* joystick */ COMPATIBLE_IOCTL(JSIOCGVERSION) COMPATIBLE_IOCTL(JSIOCGAXES) From patchwork Sat Sep 8 14:28:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6716C13AC for ; Sat, 8 Sep 2018 14:30:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56AB42A3D3 for ; Sat, 8 Sep 2018 14:30:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AD812A427; Sat, 8 Sep 2018 14:30:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UPPERCASE_50_75 autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 984272A3D3 for ; Sat, 8 Sep 2018 14:30:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbeIHTQS (ORCPT ); Sat, 8 Sep 2018 15:16:18 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53150 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbeIHTQS (ORCPT ); Sat, 8 Sep 2018 15:16:18 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MJEIl-1gHY0H0BsB-00KiV7; Sat, 08 Sep 2018 16:29:46 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk, Jeff Dike , Richard Weinberger , Jaroslav Kysela , Takashi Iwai , Arnd Bergmann Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 03/11] compat_ioctl: remove translation for sound ioctls Date: Sat, 8 Sep 2018 16:28:09 +0200 Message-Id: <20180908142837.2819693-3-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:/ZZEpM3KA5ysIhGr/2Vm0fvqLLI1DZFXkHUEyO2IPY5ksptOeM/ PzsraGAeljHVM91wP+fwCQk6TS1oIcXNTe7s+GVGiV3UEpKtLEC0ahWyROQzZChzruuw2WC rkX57/fX/L8DJdmGe5SJ4n7I1JN1aYFPSYmiGj88fXJsLqXKWPgrdPn/EZX7bqjnKaMUq5P 8KeHbuEdLucTUCv8qK7UA== X-UI-Out-Filterresults: notjunk:1;V01:K0:CDfBQa5MfUQ=:okIMhwnIvlRBjsjgdKzLys 6JRDISEglMpOk72eAlqHtj217XJtF/tTmoWZATbmQt4ddibV1R1RQ5W64Pzqpi1pS7tcgBUWr WwSTco9pga74KyoXzdCaVv4DuZ5u5cSG1vm6H2dUqJIQ8xHfP12DvcMgiGgi2Wtm2QLmtjPDp W36Nsu+O/kXPihn0ZBWGcZeunSpEuvu1F/ZPRjfWPrbKyB9I/yildSQUbGLtZBUmGIsMIE1I4 D+EYsVaIZAVMtylWzqdmFeV1QTMxW0Wg+q0TtQEgkuQFEFgsWlOcVwXQYYIVUP12P1TpiHHvz /viacwEZHlthbcQULSRuchfS9Y0+wFKfpt53pD310tsCsGr955H72WH+Xzovo2IYo86ku6Wp3 fpxvXyPDd9AJ0w3bhzGONVoTGqrOA2B18mv7i0uOHnpD0QvQWucVcCptXCK5EOO4GIsOFGMFH 4eARylgtwHnchrAhUVsu0WRfT7VHRdHbnWpi7my69H4TKDhQ7MlO0b5hOrNHfi78m7vwh93W6 aPwVIcjtwh8g/whHUvkeuTSLcVH/0VxZJYDKXzbaeA3Lgsj1DPM1UAU40j5Y7SOXjh6alUI+W gVBaonhoGgfMKquZsuDvOwsUlzmzAtl2mREicwPaFpjLSRddZJ1KnT4Mz0ZO4UgZar5+fbZWf 9qLzGAznrrg3Y7mQIx0rDkav/5uE8MfAVBZBAfFDvPAccm7TBE05yMFSO+neL7rgu1dA= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. The compat_ioctl list contains one comment about SNDCTL_DSP_MAPINBUF and SNDCTL_DSP_MAPOUTBUF, which actually would need a translation handler if implemented. However, the native implementation just returns -EINVAL, so we don't care. Signed-off-by: Arnd Bergmann --- arch/um/drivers/hostaudio_kern.c | 1 + fs/compat_ioctl.c | 157 ----------------------------- sound/core/oss/pcm_oss.c | 4 + sound/oss/dmasound/dmasound_core.c | 2 + 4 files changed, 7 insertions(+), 157 deletions(-) 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, .mmap = NULL, .open = hostaudio_open, .release = hostaudio_release, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index c2c73b802fb3..875516658c39 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -78,7 +78,6 @@ #include #include -#include #include #include @@ -605,162 +604,6 @@ COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN) /* PPP stuff */ COMPATIBLE_IOCTL(PPPIOCGUNIT) COMPATIBLE_IOCTL(PPPIOCGCHAN) -/* Big A */ -/* sparc only */ -/* Big Q for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET) -COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO) -COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE) -COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT) -COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT) -COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE) -COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR) -COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI) -COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES) -COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS) -COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS) -COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO) -COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL) -COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE) -COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC) -COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND) -COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL) -COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE) -/* Big T for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE) -COMPATIBLE_IOCTL(SNDCTL_TMR_START) -COMPATIBLE_IOCTL(SNDCTL_TMR_STOP) -COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE) -COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO) -COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE) -COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME) -COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT) -/* Little m for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME) -COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE) -COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD) -/* Big P for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_DSP_RESET) -COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC) -COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED) -COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE) -COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS) -COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER) -COMPATIBLE_IOCTL(SNDCTL_DSP_POST) -COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE) -COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR) -/* SNDCTL_DSP_MAPINBUF, XXX needs translation */ -/* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */ -COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO) -COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX) -COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY) -COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE) -COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE) -COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS) -COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS) -COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER) -/* Big C for sound/OSS */ -COMPATIBLE_IOCTL(SNDCTL_COPR_RESET) -COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD) -COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA) -COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE) -COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA) -COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE) -COMPATIBLE_IOCTL(SNDCTL_COPR_RUN) -COMPATIBLE_IOCTL(SNDCTL_COPR_HALT) -COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG) -COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG) -/* Big M for sound/OSS */ -COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO)) -COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR)) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE) -/* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */ -/* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */ -COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS) -COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO)) -COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR)) -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE) -/* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */ -/* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */ -COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC) -COMPATIBLE_IOCTL(SOUND_MIXER_INFO) -COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO) -COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS) -COMPATIBLE_IOCTL(SOUND_MIXER_AGC) -COMPATIBLE_IOCTL(SOUND_MIXER_3DSE) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4) -COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5) -COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS) -COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS) -COMPATIBLE_IOCTL(OSS_GETVERSION) /* Raw devices */ COMPATIBLE_IOCTL(RAW_SETBIND) COMPATIBLE_IOCTL(RAW_GETBIND) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index f8d4a419f3af..3f25c9d7b7df 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2732,6 +2732,10 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long static long snd_pcm_oss_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) { + /* + * Everything is compatbile except SNDCTL_DSP_MAPINBUF/SNDCTL_DSP_MAPOUTBUF, + * which are not implemented for the native case either + */ return snd_pcm_oss_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); } #else diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index fc9bcd47d6a4..b6b5f5a5df9c 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c @@ -384,6 +384,7 @@ static const struct file_operations mixer_fops = .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = mixer_unlocked_ioctl, + .compat_ioctl = mixer_unlocked_ioctl, .open = mixer_open, .release = mixer_release, }; @@ -1167,6 +1168,7 @@ static const struct file_operations sq_fops = .write = sq_write, .poll = sq_poll, .unlocked_ioctl = sq_unlocked_ioctl, + .compat_ioctl = sq_unlocked_ioctl, .open = sq_open, .release = sq_release, }; From patchwork Sat Sep 8 14:28:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3610E13AC for ; Sat, 8 Sep 2018 14:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 225B42A427 for ; Sat, 8 Sep 2018 14:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15CF62A516; Sat, 8 Sep 2018 14:30:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E28D2A427 for ; Sat, 8 Sep 2018 14:30:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727287AbeIHTQc (ORCPT ); Sat, 8 Sep 2018 15:16:32 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:46373 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbeIHTQc (ORCPT ); Sat, 8 Sep 2018 15:16:32 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MFsER-1g5WvQ3FwF-00HMTN; Sat, 08 Sep 2018 16:30:23 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , Karsten Keil , Paul Bolle , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gigaset307x-common@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: [PATCH 04/11] compat_ioctl: remove isdn ioctl translation Date: Sat, 8 Sep 2018 16:28:10 +0200 Message-Id: <20180908142837.2819693-4-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:WgQp1kucjzT9wpU82gmyNa2NWeV+CUQUCZhKJKPf+jQrikhscCh oZ29mZnpA1q27MxKVC+RNzANQPqkL8aaFxXruUYtKZZIOK4WYLCJfpb9nwCLOrgrmyELvzQ pNw5Xncgxtu9+xUX2radRs5iruAzaP/9LjiFGHaV95QpvFsD9OLmU0L+s7QCat7aj+plFNj jSEeOB9uYBxMcrcqiRUig== X-UI-Out-Filterresults: notjunk:1;V01:K0:v6ytYpd0Njg=:PCa9TBvgLaTRpp//15zQuX ZDmAtx/uUtW7TaGRasUMQwQd37lmsWVzBf2lhZOQsWBh2aQeUeTnZCWHRzBKYZlnGTjD522BN 5MUGKDPsSI/uw2qJwm2UiswVZeViNXOTv/xVpCNPwm7tQmIcqRXmbl35ET7oBUHYQNUEWNLOf HCx2gaZsFrKnToX/rkpNJ2IyprghqiIWTmG+v65JrCK0ELzwDx2X2MaZJG/l/kyA6R96N+b6K hGjGY0CAt2QbCY87skNcgA752wQFVgtntsktgc9gP6rWkmLNTePzu4uJjeJ4crkP/7lh5u6bc Atj4arnpsx6VvT1lFqOcILC5p9hK4ejKmL01FgPgbYa2Ap7xTe2ZGHccVb9GKv8Tk1I0FHcsw 9qNvH8OJoMVnMkuCy0J23Ks7pGXgVtDG1Z/+z1/J2ZpE/gvJPml3n2ydb5g2hGu8d3aj0NiIR WX0zbg733ACCA/JnWN2qVBiI14KeZQ/xy1UDKzf8fE5/81fIokVdrq49yDVIObY6K+a+dUKos 4m+9xEGxtkA6oCD0N2pVBvNkjW/4JPq8QaQAhaJ/PXqN6xkbFBp404PoPTwtuG0YkTmOz1fo2 EAoz0zUSK4iYN78V/c1ambpeAc5wQJKOQ6Z0wOeeISEH8GtQy1NR5fJ4TiSL4Nu/86oUrjaYm Eg6eMZLDjiWxVgfHq/pTswVQ4PpMgegoviJNbTl1c3C0GEZT6PKir9hYWSWeTpaH2Fb4= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Neither the old isdn4linux interface nor the newer mISDN stack ever had working 32-bit compat mode as far as I can tell. However, the CAPI stack and the Gigaset ISDN driver (implemented on top of either CAPI or i4l) have some ioctl commands that are correctly listed in fs/compat_ioctl.c. We can trivially move all of those into the two corresponding files that implement the native handlers by adding a compat_ioctl redirect to that. I did notice that treating CAPI_MANUFACTURER_CMD() as compatible is broken, so I'm also adding a handler for that, realizing that in all likelyhood, nobody is ever going to call it. Signed-off-by: Arnd Bergmann --- drivers/isdn/capi/capi.c | 31 +++++++++++++++++++++++++++++++ drivers/isdn/gigaset/interface.c | 10 ++++++++++ fs/compat_ioctl.c | 22 ---------------------- 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index ef5560b848ab..4851dc3941eb 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -942,6 +942,34 @@ capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } +#ifdef CONFIG_COMPAT +static long +capi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + int ret; + + if (cmd == CAPI_MANUFACTURER_CMD) { + struct { + unsigned long cmd; + compat_uptr_t data; + } mcmd32; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + if (copy_from_user(&mcmd32, compat_ptr(arg), sizeof(mcmd32))) + return -EFAULT; + + mutex_lock(&capi_mutex); + ret = capi20_manufacturer(mcmd32.cmd, compat_ptr(mcmd32.data)); + mutex_unlock(&capi_mutex); + + return ret; + } + + return capi_unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int capi_open(struct inode *inode, struct file *file) { struct capidev *cdev; @@ -988,6 +1016,9 @@ static const struct file_operations capi_fops = .write = capi_write, .poll = capi_poll, .unlocked_ioctl = capi_unlocked_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = capi_compat_ioctl, +#endif .open = capi_open, .release = capi_release, }; diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index 600c79b030cd..faae8ae54802 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c @@ -233,6 +233,13 @@ static int if_ioctl(struct tty_struct *tty, return retval; } +#ifdef CONFIG_COMPAT +static long if_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) +{ + return if_ioctl(tty, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int if_tiocmget(struct tty_struct *tty) { struct cardstate *cs = tty->driver_data; @@ -472,6 +479,9 @@ static const struct tty_operations if_ops = { .open = if_open, .close = if_close, .ioctl = if_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = if_compat_ioctl, +#endif .write = if_write, .write_room = if_write_room, .chars_in_buffer = if_chars_in_buffer, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 875516658c39..7d8c5722fd0a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -61,9 +61,6 @@ #include #include -#include -#include - #ifdef CONFIG_BLOCK #include #include @@ -670,25 +667,6 @@ COMPATIBLE_IOCTL(HIDPCONNADD) COMPATIBLE_IOCTL(HIDPCONNDEL) COMPATIBLE_IOCTL(HIDPGETCONNLIST) COMPATIBLE_IOCTL(HIDPGETCONNINFO) -/* CAPI */ -COMPATIBLE_IOCTL(CAPI_REGISTER) -COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER) -COMPATIBLE_IOCTL(CAPI_GET_VERSION) -COMPATIBLE_IOCTL(CAPI_GET_SERIAL) -COMPATIBLE_IOCTL(CAPI_GET_PROFILE) -COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD) -COMPATIBLE_IOCTL(CAPI_GET_ERRCODE) -COMPATIBLE_IOCTL(CAPI_INSTALLED) -COMPATIBLE_IOCTL(CAPI_GET_FLAGS) -COMPATIBLE_IOCTL(CAPI_SET_FLAGS) -COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) -COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) -COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) -/* Siemens Gigaset */ -COMPATIBLE_IOCTL(GIGASET_REDIR) -COMPATIBLE_IOCTL(GIGASET_CONFIG) -COMPATIBLE_IOCTL(GIGASET_BRKCHARS) -COMPATIBLE_IOCTL(GIGASET_VERSION) /* Misc. */ COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ From patchwork Sat Sep 8 14:28:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 266D613AC for ; Sat, 8 Sep 2018 14:30:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 140D62A427 for ; Sat, 8 Sep 2018 14:30:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 086652A46C; Sat, 8 Sep 2018 14:30:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 947C42A427 for ; Sat, 8 Sep 2018 14:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbeIHTQk (ORCPT ); Sat, 8 Sep 2018 15:16:40 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:44743 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbeIHTQj (ORCPT ); Sat, 8 Sep 2018 15:16:39 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mzhzd-1fc9Ql2W1Z-00vgsF; Sat, 08 Sep 2018 16:30:38 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/11] compat_ioctl: remove IGNORE_IOCTL() Date: Sat, 8 Sep 2018 16:28:11 +0200 Message-Id: <20180908142837.2819693-5-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:nGbJ5rDoHoRTqGmMjwVxk1EKcIjD3EJ4qLojhrz8TGe5tT+v4vw wShQKhuSiQodO+1Y/rvhQQgjbBFG15AfpNpwXsNKzDwJYzoro7wPQsg7PL/0+JHIIEYZYnt g3HYDhDVdkqNc8lxT7dZFgKeqv2SkcIvgcJKiXi8zPQhW/jDSJkEZrkFUxpeEoOHkIx1p45 6yAaspwr2GgTn84kY2izg== X-UI-Out-Filterresults: notjunk:1;V01:K0:OdVvqWONxx8=:KOdinIiFeW80teagBmcu9c Uj691wMWWSrTqvMjFTmBe02FhdKpw0F8AbYxxdqLevsZIs1+Qxhp/wEwpMWpIVjUoLwaZvO9j Go9Wa4UZU34AnqZ68Ko8r/7B9zoQ0vIphOqsCvH2vHwBxq1zR13lu2xyzf3WfwBbngzb4uGK/ ECs4rWABxwvZr+MBt6wETmljILAgXjb86JzKyrv2g39wilYC2I7rTaGSvoIXMcBdD5dPvbpwC XTZSSlOb1zX7Te9HuYVBW71GWwv2cPl4f+m8nRuyzX7WZtiHwxhDnSwwmmX9F34qOXQk3FVxs IuTn8qHSAHdNRcQ/SJpWchhW8UtFmiizyr2Cs4bZ3dHXCuZnCHGNBFM/uCZszr7sVLTd7RPrz qxnFO/D8yPkzgXq6HkkqhkVnydv0LWhmttmFkRD4Y/0yYyFdpFCPwD9MuI5M1QXyLS1l/GMb9 qpKbViThyCzbKpy3MiZqzumrdUsAS9Cffqsk7P/gmDoMl8GVBZGN2NOeR4lBTVsq40UC5CT9Y 2x/jVkz4ze3rmX5nIDt1Ex+2VJhhi9vwvjLEpdmxBicQdvuBB1CvC9fhndg+uj90AKeT8mJPc mlQtIOhATBWfmpHS26tMlT9DNfHAw4m5dgyU1Z4EZbRyuio49pdxZo/W0lnh2/JOU/LF7paab rfwF1bsvbN1TanbDngbYB+0G3D8iFkiZa725mDpDQs4YyMBMryhNgEElTQnaOn2vM5Mo= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 07d106d0a33d ("vfs: fix up ENOIOCTLCMD error handling"), we don't warn about unhandled compat-ioctl command code any more, but just return the same error that a native file descriptor returns when there is no handler. This means the IGNORE_IOCTL() annotations are completely useless and can all be removed. TIOCSTART/TIOCSTOP and KDGHWCLK/KDSHWCLK fall into the same category, but for some reason were listed as COMPATIBLE_IOCTL(). Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 56 ----------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 7d8c5722fd0a..b56a3842d61d 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -463,20 +463,7 @@ static int compat_ioctl_preallocate(struct file *file, #define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff) #define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd), -/* ioctl should not be warned about even if it's not implemented. - Valid reasons to use this: - - It is implemented with ->compat_ioctl on some device, but programs - call it on others too. - - The ioctl is not implemented in the native kernel, but programs - call it commonly anyways. - Most other reasons are not valid. */ -#define IGNORE_IOCTL(cmd) COMPATIBLE_IOCTL(cmd) - static unsigned int ioctl_pointer[] = { -/* compatible ioctls first */ -COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ -COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ - /* Big T */ COMPATIBLE_IOCTL(TCGETA) COMPATIBLE_IOCTL(TCSETA) @@ -553,9 +540,6 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND) COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST) COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) #endif -/* Big V (don't complain on serial console) */ -IGNORE_IOCTL(VT_OPENQRY) -IGNORE_IOCTL(VT_GETMODE) /* * These two are only for the sbus rtc driver, but * hwclock tries them on every rtc device first when @@ -569,11 +553,6 @@ COMPATIBLE_IOCTL(MTIOCTOP) /* Socket level stuff */ COMPATIBLE_IOCTL(FIOQSIZE) #ifdef CONFIG_BLOCK -/* md calls this on random blockdevs */ -IGNORE_IOCTL(RAID_VERSION) -/* qemu/qemu-img might call these two on plain files for probing */ -IGNORE_IOCTL(CDROM_DRIVE_STATUS) -IGNORE_IOCTL(FDGETPRM32) /* SG stuff */ COMPATIBLE_IOCTL(SG_SET_TIMEOUT) COMPATIBLE_IOCTL(SG_GET_TIMEOUT) @@ -684,41 +663,6 @@ COMPATIBLE_IOCTL(JSIOCGNAME(0)) COMPATIBLE_IOCTL(TIOCGLTC) COMPATIBLE_IOCTL(TIOCSLTC) #endif -#ifdef TIOCSTART -/* - * For these two we have definitions in ioctls.h and/or termios.h on - * some architectures but no actual implemention. Some applications - * like bash call them if they are defined in the headers, so we provide - * entries here to avoid syslog message spew. - */ -COMPATIBLE_IOCTL(TIOCSTART) -COMPATIBLE_IOCTL(TIOCSTOP) -#endif - -/* fat 'r' ioctls. These are handled by fat with ->compat_ioctl, - but we don't want warnings on other file systems. So declare - them as compatible here. */ -#define VFAT_IOCTL_READDIR_BOTH32 _IOR('r', 1, struct compat_dirent[2]) -#define VFAT_IOCTL_READDIR_SHORT32 _IOR('r', 2, struct compat_dirent[2]) - -IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32) -IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32) - -#ifdef CONFIG_SPARC -/* Sparc framebuffers, handled in sbusfb_compat_ioctl() */ -IGNORE_IOCTL(FBIOGTYPE) -IGNORE_IOCTL(FBIOSATTR) -IGNORE_IOCTL(FBIOGATTR) -IGNORE_IOCTL(FBIOSVIDEO) -IGNORE_IOCTL(FBIOGVIDEO) -IGNORE_IOCTL(FBIOSCURPOS) -IGNORE_IOCTL(FBIOGCURPOS) -IGNORE_IOCTL(FBIOGCURMAX) -IGNORE_IOCTL(FBIOPUTCMAP32) -IGNORE_IOCTL(FBIOGETCMAP32) -IGNORE_IOCTL(FBIOSCURSOR32) -IGNORE_IOCTL(FBIOGCURSOR32) -#endif }; /* From patchwork Sat Sep 8 14:28:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CD446CB for ; Sat, 8 Sep 2018 14:31:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 075932A427 for ; Sat, 8 Sep 2018 14:31:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED3382A446; Sat, 8 Sep 2018 14:31:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74E632A427 for ; Sat, 8 Sep 2018 14:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727163AbeIHTRW (ORCPT ); Sat, 8 Sep 2018 15:17:22 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:35157 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbeIHTRW (ORCPT ); Sat, 8 Sep 2018 15:17:22 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mum2d-1fg1Jv33Jr-00rrOL; Sat, 08 Sep 2018 16:31:16 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , "Theodore Ts'o" , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 06/11] compat_ioctl: remove /dev/random commands Date: Sat, 8 Sep 2018 16:28:12 +0200 Message-Id: <20180908142837.2819693-6-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:aj9N/Luw1AgvpyHqFjV+g2BVt9SmQDi1RBBVWq/UXeUyPqlGStR /6q8X4FurUmI69zE9AQv50siBmmPxPQrLpywDCyTYvYaof6kCkUtH82PYfXu4YDPhpepNHy hOnac0kSL4cRiGT6opE22cuY3OqFJyTXqmiIdu9QGevCguoZ2io/nkvHw0r0uCs1QsQqK7C /JRNr7SOwQ8tdku1OafmA== X-UI-Out-Filterresults: notjunk:1;V01:K0:VCdWvQt2xfM=:lk2BnzLE5H9lWOjLg2MqeM rBZDVqTB5qxaxwWmlgL3bDVaPOe+LTVuUA/PCtu/Gs0JMsZCiDjD2p2fBt+nHnlafA9jBnXBg /zC6tTC/dZaMdb9jbGg4V9tZLKtYLgffy0yfDO6xT34P/iyc8eycOl4b9XryOTxBAKTCbrMEP 2Vq5afSIArd6k3HDbzDba0aswtojUNNbXi3lJb8q22GddmUiRIVYsjwLN+j/QoBD+rxd3zGN2 PgrfURoFbbJIo6p4Rg8ytwxL/srNxzbNCU/SIRPhylly+GKRyKxsyUZT0sEdg1WyDeFXQ+FoM jzbuNuQkWKf48lDaG2bfeQ06mg5d0H+ln42SWLQ7DdUmSF/azYRIA1yqM4nPr7VnU3MLes6X3 xuhWtwOjr24Z10B4z2Q9e60eDH3T5HQ1N4pUh5vdKQbDguq0A97d4vTaxRDv0oFPfzy7I3w0f b+tignH1npdju6LuBO7x/fWFq3HltOGCf5GgVTCu7eB9uV5Hvrjk8hhPaJsHO1aGffIhMOmDi 6ySWUq7E78EnNlgdzgH1jWKvVXiFdfIde1inuZLdT7KG5ERCR3UxzMinQFcML5JI5AfTpsITH QWA7M6WUxkD0n5d18E6G/qHjAoiN4ZZlpMbMo1EkabJFKm0YuJj+5OA4pGpifYFnmzwbUCNyC BdBzSRMiLUMzhwy1RjneNJsmPs50UGXYWZyGtKm6aYd8SKeUc0wulWjH8uxQ1TWE2neI= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These are all handled by the random driver, so instead of listing each ioctl, we can just use the same function to deal with both native and compat commands. Signed-off-by: Arnd Bergmann --- drivers/char/random.c | 1 + fs/compat_ioctl.c | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index bf5f99fc36f1..103abf82444a 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2021,6 +2021,7 @@ const struct file_operations random_fops = { .write = random_write, .poll = random_poll, .unlocked_ioctl = random_ioctl, + .compat_ioctl = random_ioctl, .fasync = random_fasync, .llseek = noop_llseek, }; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index b56a3842d61d..eb29188d1dbb 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -594,13 +594,6 @@ COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_SETPRETIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETPRETIMEOUT) -/* Big R */ -COMPATIBLE_IOCTL(RNDGETENTCNT) -COMPATIBLE_IOCTL(RNDADDTOENTCNT) -COMPATIBLE_IOCTL(RNDGETPOOL) -COMPATIBLE_IOCTL(RNDADDENTROPY) -COMPATIBLE_IOCTL(RNDZAPENTCNT) -COMPATIBLE_IOCTL(RNDCLEARPOOL) /* Bluetooth */ COMPATIBLE_IOCTL(HCIDEVUP) COMPATIBLE_IOCTL(HCIDEVDOWN) From patchwork Sat Sep 8 14:28:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98E1213AC for ; Sat, 8 Sep 2018 14:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86C482A427 for ; Sat, 8 Sep 2018 14:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78FA02A446; Sat, 8 Sep 2018 14:31:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 196082A427 for ; Sat, 8 Sep 2018 14:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbeIHTRj (ORCPT ); Sat, 8 Sep 2018 15:17:39 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:34378 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbeIHTRj (ORCPT ); Sat, 8 Sep 2018 15:17:39 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M1HuU-1g0IAC2sPq-002m0e; Sat, 08 Sep 2018 16:31:38 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/11] compat_ioctl: remove joystick ioctl translation Date: Sat, 8 Sep 2018 16:28:13 +0200 Message-Id: <20180908142837.2819693-7-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:wzPDog2sf4LNWniMkNTBPh+9VsaUDQDMSz61f4KlH9gIoo3lROa ZWAcpZN+1qFk+2NazzedX63oqEE/GGGabgVlemlfNwj+yClqpb/SFcSxx51eziD6ugrVhpQ RbsCG8MNGr+vHax24qVphlSvVKh8CKCxTFYrgvRmoma7BSP71E80ZRJLt3N1rMxGhLH+kov edox9FFrWg0GH9nfMjPKg== X-UI-Out-Filterresults: notjunk:1;V01:K0:5zUYGzFksIY=:QXLXW/sNKeSUfKwP9Stk2J 316Iiawm1j/ia7aCcbhk6/ygop1+q44gPy4aWRx3mad3O1oG+Wr5OlFjh9/ra6OU/oNDQoa/K ZaRpsHPqigN3w8bcZ1ugkO1XjLmIL7Jzq24CzA2zU+qvAluwuRnsjTb/+BeP4pHNGQcNi1IvW 7FW4X1WHEa3ikyD1OzduxqzU0+zYuyfUOQOHepB1ofv8L7hXt1kOSRBwNgo8lDFE5m92lA+1M rq5dC8DUIaQijgBya25QJTY5pogpAuhM8SMx34SOKt6eZKM9k2JECyrVeK+BtDwgTmfxqqFtS wu3LPnyyo0qJhV+CygQj/hGF5KCwhNu9U48xczTwHmE+w9PfkuPKZeSoBQ/vu9YtidFPKwnnd 1sZQvSOWG78uzuFbS/R/8rhrTIU9mxG6Y5Si97MVwf4nJGtUXJDauFMXzUa8zgTQEaC/j19q3 8E5lc9Y8ZtBYqmUy/j0K7AcqqU4ij2FUVZJtCRIGSab4FQD006+I27MNzQDD+V8XuF23+xmSZ M31m8GodBlsmQ1U05XcigFRyyYJvImCwmNkAAFo6MVk5bcEtwoECG6IXhhY21vQmF9pvLnHM3 C5IWvu6EC3KnMgKTbVN1fGkekUJG9PUZlYSihgCkxEFf/x4GbkBK2eLYXbtfLB0fIc/aopMb1 hToOxAwPoPpHbslnJt/EzXcZABztbZsJgigl1Skxn1Q8Ys9Ym6WFW3oCljqdWndwd7dM= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The joystick driver already handles these just fine, so the entries in the table are not needed any more. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index eb29188d1dbb..23c0406d8b30 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -11,8 +11,6 @@ * ioctls. */ -#include - #include #include #include @@ -646,12 +644,6 @@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) -/* joystick */ -COMPATIBLE_IOCTL(JSIOCGVERSION) -COMPATIBLE_IOCTL(JSIOCGAXES) -COMPATIBLE_IOCTL(JSIOCGBUTTONS) -COMPATIBLE_IOCTL(JSIOCGNAME(0)) - #ifdef TIOCGLTC COMPATIBLE_IOCTL(TIOCGLTC) COMPATIBLE_IOCTL(TIOCSLTC) From patchwork Sat Sep 8 14:28:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B18B13AC for ; Sat, 8 Sep 2018 14:31:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BDEB2A427 for ; Sat, 8 Sep 2018 14:31:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2009D2A446; Sat, 8 Sep 2018 14:31:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C372D2A427 for ; Sat, 8 Sep 2018 14:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbeIHTRx (ORCPT ); Sat, 8 Sep 2018 15:17:53 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:53125 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbeIHTRx (ORCPT ); Sat, 8 Sep 2018 15:17:53 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MdNse-1fPJWa0qJM-00ZMfa; Sat, 08 Sep 2018 16:31:52 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/11] compat_ioctl: remove PCI ioctl translation Date: Sat, 8 Sep 2018 16:28:14 +0200 Message-Id: <20180908142837.2819693-8-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:5i0atZbPU/6NU8g3lethk2tgTnaPSx3cL96LTyt/iN9OTM4WgXC 67Zz3stSmOARnU8rh1TnOzrc0bhhhVx4WUU8a2z0BXswwQmgqStzU0W4rG4qkbejKns8HdE qG2aByc4kotLE79J2Q1ELscEyCzqFQyQNCyFfJx2rdVZpC0w1InNg8r5smujCUqxnhK0dij 4qvOmSKwvaXXAwTO4RFrQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:B+APLvWVNGg=:9uBcQdvy1Q/zEmVZ5M8znf wfwaJlo15jDnM589Yagx84SpsWTIZzjneA0fVQOfkg3pxO2JGLBliym0DhC24c+MqADOcPtb0 p/awAWYA9wi7Ou+XvYE3PPPm2S6ykgTVmQu93hPWN+1Y7PpWjh/g6yKfOnkIMxNHlsG0xL8vQ CTl8/wYz+3LgeviRg8AWmyW9dlq23aom/bu7iL4UiI6tQ2rcRahm58508hSCE93ZeaD1LG/W/ nOFA2k9tCca8Mxzfdz4e9tAIjN9QzyZIzgU9Djzs/klYu3M1i5wxfZxDys5yc3cSC8eOKQyV8 lcB9cJYDsB/b6EbwsY6HVUZrTxv97i7W3rMWok1MfYiUkHySWkb6N+sJqJNXdHPiuIwK5RNX/ 6ll2jx8Ftgy5Yy3n8NKFgvbwK78/m/BQBwusKB/0frBqzNrq1CGb+MLgID8/BPTE9he3YQJ08 AH5l2s7816QY/Z/DwYiJzGf+llDCFcBl7po2kH/Zc33yMrxJ9/3cHc8eKPzPcuG8me10fIAqt uWR1bebRHMmvwcKInNovYgve87ZhJ5fnEm269rxHDynBs22HQrxfAIi4wC6he5TMjwHp004Qc KZ9I/dzLxExdKhDjyoaiev/EZbyI8cxvJR9mgQVJ0A64JnTDC2iPSaXcFXrLHUqMYQ+r8AVM1 ouz/k1v05oTI52hnmCy72GQw1vyTVHFtyRfh2zjEKqYfTOQFuq8JGYgrUgjfcPPUySE0= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The /proc/pci/ implementation already handles these just fine, so the entries in the table are not needed any more. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 23c0406d8b30..28ebff2d1799 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -640,10 +639,6 @@ COMPATIBLE_IOCTL(HIDPGETCONNINFO) /* Misc. */ COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */ COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */ -COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) -COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) -COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) -COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) #ifdef TIOCGLTC COMPATIBLE_IOCTL(TIOCGLTC) COMPATIBLE_IOCTL(TIOCSLTC) From patchwork Sat Sep 8 14:28:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52D5714E2 for ; Sat, 8 Sep 2018 14:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 436402A427 for ; Sat, 8 Sep 2018 14:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37F062A446; Sat, 8 Sep 2018 14:32:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25B912A427 for ; Sat, 8 Sep 2018 14:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbeIHTSI (ORCPT ); Sat, 8 Sep 2018 15:18:08 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:44931 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbeIHTSI (ORCPT ); Sat, 8 Sep 2018 15:18:08 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M2NqA-1g1O6T0GWE-003rwK; Sat, 08 Sep 2018 16:32:07 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/11] compat_ioctl: remove /dev/raw ioctl translation Date: Sat, 8 Sep 2018 16:28:15 +0200 Message-Id: <20180908142837.2819693-9-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:igYwFt37Me/pBzU2cL5f50SU8QPyDjxHobFHBJxRdCx1SRjJQLQ hiIjs01dgrRvah7tGGbQsnWhIqUDZYUK9gybmYyjwlthMj96eKd6gE+NPNEtGvfTlW5sKkF e988tyZFCxgl1tduJgXZHXSxMNvZPtagM1lYlsINbQwFmBx21kkf3U9yYvZ90L6oxIcURRc 2USiZE1Hnxfq0eFZjJwEw== X-UI-Out-Filterresults: notjunk:1;V01:K0:LXDHlHckRH8=:mzkNgCsds9MEPVh/L/x6jR 7y3xeSQHCidanQRs+xk2iwRg1cL7XpWfsDAkO0zRlGWsJPoTppoNOL6PBEWyTA9xTBeF6Rs/T 4ys2req1TPD4vluzkXYE06UlX5olN5OBvkjWjtVpKUA1Gi3R22F+YeYdCqWutbhHOyIhdozlu z35C3mk6y7Gzgi/o2W6xNcMsKR4LRJ7vKbjkMILfxikDiNBqQhCGYwGDrwVjDAJIM1wFAwBy7 Wk+MuU+hi7jwwVCcgVtuclD8tECmu2iVdWsTV+GFhL5YIjLlZzJNYLKAfpReUULEo0QoyCTZL 7LGCpjCI4ysp6ckBJ+niQFCv6jFemgyfGkTK7dSLf6nBDsEDFaXMFaMu/v2kN7T8Up66G0MeT 24D1F5Ih7Zwigy8ZbOjo7f4vceOiUAMjcg0Ybr0EcJsgZ/DMZZbDFmYiMY78kQ0PiiXDTUZt9 cMzkC981IrIKuyRbbGcPDetSoxQ5U5WCRlU3pUfAck0L5EzhWD/rOUf1urthYb63vsH+kWcpK n2GzXXliGPgbCUh7M18Uf/eFdsC3R+idcmM0ZZxEFCKOEEClM7Iui92pF7LC2qZBJFpfA2A7D ZMu2lhI1ETB/6hvHs3xf5TOyoLBEayQVOY5KvoUipDBmEHRsXZPhJZyz2r80XCG1xLrfyupCv EhSlMZCt+DaDVsPeJSY6J1hvxzvCtDmgfmwq9SCjzTZ33vrruAjWDyaCDmLXGCClBEmg= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The /dev/rawX implementation already handles these just fine, so the entries in the table are not needed any more. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 28ebff2d1799..e755802cd887 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -577,9 +576,6 @@ COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN) /* PPP stuff */ COMPATIBLE_IOCTL(PPPIOCGUNIT) COMPATIBLE_IOCTL(PPPIOCGCHAN) -/* Raw devices */ -COMPATIBLE_IOCTL(RAW_SETBIND) -COMPATIBLE_IOCTL(RAW_GETBIND) /* Watchdog */ COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) COMPATIBLE_IOCTL(WDIOC_GETSTATUS) From patchwork Sat Sep 8 14:28:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5F8F14E2 for ; Sat, 8 Sep 2018 14:32:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52382A427 for ; Sat, 8 Sep 2018 14:32:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9B692A446; Sat, 8 Sep 2018 14:32:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77CF82A427 for ; Sat, 8 Sep 2018 14:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726906AbeIHTSV (ORCPT ); Sat, 8 Sep 2018 15:18:21 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:46757 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbeIHTSV (ORCPT ); Sat, 8 Sep 2018 15:18:21 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M7sYM-1ftgSv3jta-004xrU; Sat, 08 Sep 2018 16:32:20 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/11] compat_ioctl: remove last RAID handling code Date: Sat, 8 Sep 2018 16:28:16 +0200 Message-Id: <20180908142837.2819693-10-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:iW7l/Gd5IQMh7nfRB2avxtImh6Fc3QsDzwqSE8CsNKg/ePQA3El vsnxK19XNvCGdRJlgqHCw8qR9tu67nekmJA0NhwUMaPudeCDp/RhL4t444f/KATXyLKZKmJ lNaFpBlrr/5zrrWu1k4rGlnBlAnbgTKOByJf/KWYljWidLjXd2s2PjpjIzWVBLoSPJ5sWYi y355Ts4qNTOIT/KOilbXg== X-UI-Out-Filterresults: notjunk:1;V01:K0:sC2n6bb9Lts=:wAD5c2VTEVHuJ8K8fvJJOD Pkm7DV4E8MXD0tSBVhZ8po58wHKmosjQ1VkeA5ADPgFozyMrAC5PRcvD9VRT7HO74hNx65sNB qdAJ2wsxQxqAXmoopcaCL2bbFH1jHV4ijCRLUyTRAwyxFwGoyyU15rbmrUabshOCsHAs13tDi 0F/Hzx1ONIwVZsIxD+yE9CNjli04nO7NuMvH2ldACLDK3apyK2J/lnc9wq4IsR8j+/uhlQEex GmfVNKv131g77qwtRlmM86hWyw7+OdyOdmGt/yFcHOEpPNq7LvjzPXy/7wkcr/uiMHxj21XwM vMk2Legm3MF568cyxATbupeVYqlKlZKO98uqm2y3Y4UJvP1aU+DxtRHqRaPDVJtnmeXw3J6wL +Hy1XBK7VEMgKgS1meODmWD0Af6LAlAvrMrf8o3dOinCgjMlViZxjlhqQfm2ej2HRRsmoWd32 VOcPlGU5VcWgsvOTXqwsscoasoNW9E9W0kUEtyRsXzePgzRVpagba7t6phEOE4LT3K4Tux6IK PB3RGoYEcNocW7MZjzCmW26WN2UnYyAexaxB8MxlsfCe50OP8QbvwJPIFZdcWPCy5uV2axgf5 +4a4m83kZCTRVqXnGoEfm1+VkVPtJC8XPC4olV3jrpj4/VnxJ22Tju6c/kdqBwbA215MQgJjF G48qnGO87Et7AGnykF1IdyJaxsTR8jTTtxJxdB++IYnEPjCrrzd7xJdWnLxM/CyY9G/8= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit aa98aa31987a ("md: move compat_ioctl handling into md.c") already removed the COMPATIBLE_IOCTL() table entries and added a complete implementation, but a few lines got left behind and should also be removed here. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index e755802cd887..bb73d52f02a2 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -676,11 +676,6 @@ static long do_ioctl_trans(unsigned int cmd, case TCSBRKP: case TIOCMIWAIT: case TIOCSCTTY: - /* RAID */ - case HOT_REMOVE_DISK: - case HOT_ADD_DISK: - case SET_DISK_FAULTY: - case SET_BITMAP_FILE: return vfs_ioctl(file, cmd, arg); } From patchwork Sat Sep 8 14:28:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10593105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6C62109C for ; Sat, 8 Sep 2018 14:33:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B66032A42C for ; Sat, 8 Sep 2018 14:33:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA48F2A446; Sat, 8 Sep 2018 14:33:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 925562A42C for ; Sat, 8 Sep 2018 14:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbeIHTTi (ORCPT ); Sat, 8 Sep 2018 15:19:38 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:42596 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727142AbeIHTTh (ORCPT ); Sat, 8 Sep 2018 15:19:37 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N0WwO-1fdWRx1nbY-00wVgk; Sat, 08 Sep 2018 16:33:13 +0200 From: Arnd Bergmann To: viro@zeniv.linux.org.uk Cc: Arnd Bergmann , "David S. Miller" , Martin Schwidefsky , Heiko Carstens , Willem Riede , "James E.J. Bottomley" , "Martin K. Petersen" , =?utf-8?q?Kai_M=C3=A4kis?= =?utf-8?q?ara?= , linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-s390@vger.kernel.org, osst-users@lists.sourceforge.net, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 11/11] compat_ioctl: move tape handling into drivers Date: Sat, 8 Sep 2018 16:28:17 +0200 Message-Id: <20180908142837.2819693-11-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de> References: <20180908142837.2819693-1-arnd@arndb.de> X-Provags-ID: V03:K1:tWYI6aJE5u0DYgGogRZh9qXzsk/ogr+iisgfCpvwrGrKQPUxZj4 BOEcgnjIPPvnOf26/QG38NWXZbu6oId5Ny7DdNB3JkcO7v2iDu3VAbL3scl4rIPlCn9yyd4 +lRhVcP2JcuWDMMq+GaryBdd8UxwKn0bAduvVaOHr7FWsHhodTvfdIckVEtc7DWodRLwF5g L06miINDQYjLOxt6PW9Zg== X-UI-Out-Filterresults: notjunk:1;V01:K0:lciv7CJdXFM=:uxYgEu9WVnoU8EOLtECJFT iUlzRfEewEwXR/BLl1r65+mqAD3G/vtKJrljqjpahQIJ4JwgiWxAzR4QHu7MchB14sfYdo+h9 UwuyC0raAYVYGSg6P1MFx6rP1/DwCrYJ7E71SWJNX4Ot2XZxssAueqRxZjT1JeIn+j7BVTp63 n8o7VX+8E7zeKNh6T6Nosf6CcMarI0o1+b0E3uVsRFdcQgH3QmSEOXookG7oX7c04Yjp7bJ6j 1hx3kiL/y4KdQM+7+M0/2fGVTK2eN4fYKuZBHGnRBTimbdVv+I3fkF0qBK2L+9JNxHF0FWikT pvyFzlXa2vh3IMyV6UI4syMDeFY1aOG9UsZR/PRpwgoOxPM4AeDDEV6larYYMgdZZTuZdhG6j KCLBqvvfrxlxGbAm5TSh8RQprR09ZzNiLaLqzRDwWiQM3vHnvg3Gi9bAC8mPPzq6xK1dScN3M 0aeGeNtPWZib3xvoCqPW8ruIaHTWeK1OwEAKE/XyvBO6SRUK29F9M925ayvP94XtVqOR4xuKq a0OpVA1Uso39V9rHuwUCYIyD2U6w/w4IS8pY9mES+Lrf5plqmWTsqq2+qg327w7YTLwH6vy8X U7PMjq45LJGwnEoHSCq6IEujo66P2xEjUqqx5oVzf5ktb1720mpt5JTbMY09crdJZ5Ck+ELEC KxHmaYvIVNQqeoWUSoqJlqJebdGNGWRQRL34E0Lm2fj8lUBQEsvmEdEECr9vuCAmRFk0= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP MTIOCPOS and MTIOCGET are incompatible between 32-bit and 64-bit user space, and traditionally have been translated in fs/compat_ioctl.c. To get rid of that translation handler, move a corresponding implementation into each of the four drivers implementing those commands. The interesting part of that is now in a new linux/mtio.h header that wraps the existing uapi/linux/mtio.h header and provides an abstraction to let drivers handle both cases easily. Signed-off-by: Arnd Bergmann --- drivers/ide/ide-tape.c | 31 ++++++++++++---- drivers/s390/char/tape_char.c | 41 ++++++++------------ drivers/scsi/osst.c | 34 ++++++++++------- drivers/scsi/st.c | 35 +++++++++++------- fs/compat_ioctl.c | 70 ----------------------------------- include/linux/mtio.h | 58 +++++++++++++++++++++++++++++ 6 files changed, 137 insertions(+), 132 deletions(-) create mode 100644 include/linux/mtio.h diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 34c1165226a4..137febf3658d 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -19,6 +19,7 @@ #define IDETAPE_VERSION "1.20" +#include #include #include #include @@ -1368,7 +1369,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) * ide-tape ioctls are supported on both interfaces. */ static long do_idetape_chrdev_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg, bool compat) { struct ide_tape_obj *tape = file->private_data; ide_drive_t *drive = tape->drive; @@ -1407,14 +1408,10 @@ static long do_idetape_chrdev_ioctl(struct file *file, if (tape->drv_write_prot) mtget.mt_gstat |= GMT_WR_PROT(0xffffffff); - if (copy_to_user(argp, &mtget, sizeof(struct mtget))) - return -EFAULT; - return 0; + return put_user_mtget(argp, &mtget, compat); case MTIOCPOS: mtpos.mt_blkno = position / tape->user_bs_factor - block_offset; - if (copy_to_user(argp, &mtpos, sizeof(struct mtpos))) - return -EFAULT; - return 0; + return put_user_mtpos(argp, &mtpos, compat); default: if (tape->chrdev_dir == IDETAPE_DIR_READ) ide_tape_discard_merge_buffer(drive, 1); @@ -1427,7 +1424,23 @@ static long idetape_chrdev_ioctl(struct file *file, { long ret; mutex_lock(&ide_tape_mutex); - ret = do_idetape_chrdev_ioctl(file, cmd, arg); + ret = do_idetape_chrdev_ioctl(file, cmd, arg, false); + mutex_unlock(&ide_tape_mutex); + return ret; +} + +static long idetape_chrdev_compat_ioctl(struct file *file, + unsigned int cmd, unsigned long arg) +{ + long ret; + + if (cmd == MTIOCPOS32) + cmd = MTIOCPOS; + else if (cmd == MTIOCGET32) + cmd = MTIOCGET; + + mutex_lock(&ide_tape_mutex); + ret = do_idetape_chrdev_ioctl(file, cmd, arg, true); mutex_unlock(&ide_tape_mutex); return ret; } @@ -1886,6 +1899,8 @@ static const struct file_operations idetape_fops = { .read = idetape_chrdev_read, .write = idetape_chrdev_write, .unlocked_ioctl = idetape_chrdev_ioctl, + .compat_ioctl = IS_ENABLED(CONFIG_COMPAT) ? + idetape_chrdev_compat_ioctl : NULL, .open = idetape_chrdev_open, .release = idetape_chrdev_release, .llseek = noop_llseek, diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index fc206c9d1c56..522ca9b836e3 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -341,14 +341,14 @@ tapechar_release(struct inode *inode, struct file *filp) */ static int __tapechar_ioctl(struct tape_device *device, - unsigned int no, unsigned long data) + unsigned int no, void __user *data, bool compat) { int rc; if (no == MTIOCTOP) { struct mtop op; - if (copy_from_user(&op, (char __user *) data, sizeof(op)) != 0) + if (copy_from_user(&op, data, sizeof(op)) != 0) return -EFAULT; if (op.mt_count < 0) return -EINVAL; @@ -392,9 +392,7 @@ __tapechar_ioctl(struct tape_device *device, if (rc < 0) return rc; pos.mt_blkno = rc; - if (copy_to_user((char __user *) data, &pos, sizeof(pos)) != 0) - return -EFAULT; - return 0; + return put_user_mtpos(data, &pos, compat); } if (no == MTIOCGET) { /* MTIOCGET: query the tape drive status. */ @@ -424,15 +422,12 @@ __tapechar_ioctl(struct tape_device *device, get.mt_blkno = rc; } - if (copy_to_user((char __user *) data, &get, sizeof(get)) != 0) - return -EFAULT; - - return 0; + return put_user_mtget(data, &get, compat); } /* Try the discipline ioctl function. */ if (device->discipline->ioctl_fn == NULL) return -EINVAL; - return device->discipline->ioctl_fn(device, no, data); + return device->discipline->ioctl_fn(device, no, (unsigned long)data); } static long @@ -445,7 +440,7 @@ tapechar_ioctl(struct file *filp, unsigned int no, unsigned long data) device = (struct tape_device *) filp->private_data; mutex_lock(&device->mutex); - rc = __tapechar_ioctl(device, no, data); + rc = __tapechar_ioctl(device, no, (void __user *)data, false); mutex_unlock(&device->mutex); return rc; } @@ -455,23 +450,17 @@ static long tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) { struct tape_device *device = filp->private_data; - int rval = -ENOIOCTLCMD; - unsigned long argp; + long rc; - /* The 'arg' argument of any ioctl function may only be used for - * pointers because of the compat pointer conversion. - * Consider this when adding new ioctls. - */ - argp = (unsigned long) compat_ptr(data); - if (device->discipline->ioctl_fn) { - mutex_lock(&device->mutex); - rval = device->discipline->ioctl_fn(device, no, argp); - mutex_unlock(&device->mutex); - if (rval == -EINVAL) - rval = -ENOIOCTLCMD; - } + if (no == MTIOCPOS32) + no = MTIOCPOS; + else if (no == MTIOCGET32) + no = MTIOCGET; - return rval; + mutex_lock(&device->mutex); + rc = __tapechar_ioctl(device, no, compat_ptr(data), false); + mutex_unlock(&device->mutex); + return rc; } #endif /* CONFIG_COMPAT */ diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 7a1a1edde35d..842457b9134a 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c @@ -33,6 +33,7 @@ static const char * osst_version = "0.99.4"; #include +#include #include #include #include @@ -4941,7 +4942,7 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp) static long osst_ioctl(struct file * file, unsigned int cmd_in, unsigned long arg) { - int i, cmd_nr, cmd_type, blk, retval = 0; + int i, cmd_nr, cmd_type, cmd_size, blk, retval = 0; struct st_modedef * STm; struct st_partstat * STps; struct osst_request * SRpnt = NULL; @@ -4978,6 +4979,7 @@ static long osst_ioctl(struct file * file, cmd_type = _IOC_TYPE(cmd_in); cmd_nr = _IOC_NR(cmd_in); + cmd_size = _IOC_SIZE(cmd_in); #if DEBUG printk(OSST_DEB_MSG "%s:D: Ioctl %d,%d in %s mode\n", name, cmd_type, cmd_nr, STp->raw?"raw":"normal"); @@ -5179,7 +5181,8 @@ static long osst_ioctl(struct file * file, if (cmd_type == _IOC_TYPE(MTIOCGET) && cmd_nr == _IOC_NR(MTIOCGET)) { struct mtget mt_status; - if (_IOC_SIZE(cmd_in) != sizeof(struct mtget)) { + if (cmd_size != sizeof(struct mtget) && + cmd_size != sizeof(struct mtget32)) { retval = (-EINVAL); goto out; } @@ -5229,21 +5232,18 @@ static long osst_ioctl(struct file * file, STp->drv_buffer != 0) mt_status.mt_gstat |= GMT_IM_REP_EN(0xffffffff); - i = copy_to_user(p, &mt_status, sizeof(struct mtget)); - if (i) { - retval = (-EFAULT); - goto out; - } - - STp->recover_erreg = 0; /* Clear after read */ - retval = 0; + retval = put_user_mtget(p, &mt_status, + cmd_size == sizeof(struct mtget32)); + if (!retval) + STp->recover_erreg = 0; /* Clear after read */ goto out; } /* End of MTIOCGET */ if (cmd_type == _IOC_TYPE(MTIOCPOS) && cmd_nr == _IOC_NR(MTIOCPOS)) { struct mtpos mt_pos; - if (_IOC_SIZE(cmd_in) != sizeof(struct mtpos)) { + if (cmd_size != sizeof(struct mtpos) && + cmd_size != sizeof(struct mtpos32)) { retval = (-EINVAL); goto out; } @@ -5256,9 +5256,7 @@ static long osst_ioctl(struct file * file, goto out; } mt_pos.mt_blkno = blk; - i = copy_to_user(p, &mt_pos, sizeof(struct mtpos)); - if (i) - retval = -EFAULT; + retval = put_user_mtpos(p, &mt_pos, cmd_size == sizeof(struct mtpos32)); goto out; } if (SRpnt) osst_release_request(SRpnt); @@ -5284,6 +5282,14 @@ static long osst_compat_ioctl(struct file * file, unsigned int cmd_in, unsigned struct osst_tape *STp = file->private_data; struct scsi_device *sdev = STp->device; int ret = -ENOIOCTLCMD; + + switch (cmd_in) { + case MTIOCTOP: + case MTIOCPOS32: + case MTIOCGET32: + return osst_ioctl(file, cmd_in, (unsigned long)compat_ptr(arg)); + } + if (sdev->host->hostt->compat_ioctl) { ret = sdev->host->hostt->compat_ioctl(sdev, cmd_in, (void __user *)arg); diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 307df2fa39a3..62244ce53baa 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -21,6 +21,7 @@ static const char *verstr = "20160209"; #include +#include #include #include #include @@ -3498,7 +3499,7 @@ static int partition_tape(struct scsi_tape *STp, int size) /* The ioctl command */ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) { - int i, cmd_nr, cmd_type, bt; + int i, cmd_nr, cmd_type, cmd_size, bt; int retval = 0; unsigned int blk; struct scsi_tape *STp = file->private_data; @@ -3532,6 +3533,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) cmd_type = _IOC_TYPE(cmd_in); cmd_nr = _IOC_NR(cmd_in); + cmd_size = _IOC_SIZE(cmd_in); if (cmd_type == _IOC_TYPE(MTIOCTOP) && cmd_nr == _IOC_NR(MTIOCTOP)) { struct mtop mtc; @@ -3741,7 +3743,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) if (cmd_type == _IOC_TYPE(MTIOCGET) && cmd_nr == _IOC_NR(MTIOCGET)) { struct mtget mt_status; - if (_IOC_SIZE(cmd_in) != sizeof(struct mtget)) { + if (cmd_size != sizeof(struct mtget) && + cmd_size != sizeof(struct mtget32)) { retval = (-EINVAL); goto out; } @@ -3796,19 +3799,16 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) if (STp->cleaning_req) mt_status.mt_gstat |= GMT_CLN(0xffffffff); - i = copy_to_user(p, &mt_status, sizeof(struct mtget)); - if (i) { - retval = (-EFAULT); - goto out; - } + retval = put_user_mtget(p, &mt_status, + cmd_size == sizeof(struct mtget32)); STp->recover_reg = 0; /* Clear after read */ - retval = 0; goto out; } /* End of MTIOCGET */ if (cmd_type == _IOC_TYPE(MTIOCPOS) && cmd_nr == _IOC_NR(MTIOCPOS)) { struct mtpos mt_pos; - if (_IOC_SIZE(cmd_in) != sizeof(struct mtpos)) { + if (cmd_size != sizeof(struct mtpos) && + cmd_size != sizeof(struct mtpos32)) { retval = (-EINVAL); goto out; } @@ -3817,9 +3817,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) goto out; } mt_pos.mt_blkno = blk; - i = copy_to_user(p, &mt_pos, sizeof(struct mtpos)); - if (i) - retval = (-EFAULT); + retval = put_user_mtpos(p, &mt_pos, + cmd_size == sizeof(struct mtpos32)); goto out; } mutex_unlock(&STp->lock); @@ -3853,14 +3852,22 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) } #ifdef CONFIG_COMPAT -static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +static long st_compat_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) { struct scsi_tape *STp = file->private_data; struct scsi_device *sdev = STp->device; int ret = -ENOIOCTLCMD; + + switch (cmd_in) { + case MTIOCTOP: + case MTIOCPOS32: + case MTIOCGET32: + return st_ioctl(file, cmd_in, (unsigned long)compat_ptr(arg)); + } + if (sdev->host->hostt->compat_ioctl) { - ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); + ret = sdev->host->hostt->compat_ioctl(sdev, cmd_in, (void __user *)arg); } return ret; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index bb73d52f02a2..70db940aeea9 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -265,70 +264,6 @@ static int sg_ioctl_trans(struct file *file, unsigned int cmd, return err; } -struct mtget32 { - compat_long_t mt_type; - compat_long_t mt_resid; - compat_long_t mt_dsreg; - compat_long_t mt_gstat; - compat_long_t mt_erreg; - compat_daddr_t mt_fileno; - compat_daddr_t mt_blkno; -}; -#define MTIOCGET32 _IOR('m', 2, struct mtget32) - -struct mtpos32 { - compat_long_t mt_blkno; -}; -#define MTIOCPOS32 _IOR('m', 3, struct mtpos32) - -static int mt_ioctl_trans(struct file *file, - unsigned int cmd, void __user *argp) -{ - /* NULL initialization to make gcc shut up */ - struct mtget __user *get = NULL; - struct mtget32 __user *umget32; - struct mtpos __user *pos = NULL; - struct mtpos32 __user *upos32; - unsigned long kcmd; - void *karg; - int err = 0; - - switch(cmd) { - case MTIOCPOS32: - kcmd = MTIOCPOS; - pos = compat_alloc_user_space(sizeof(*pos)); - karg = pos; - break; - default: /* MTIOCGET32 */ - kcmd = MTIOCGET; - get = compat_alloc_user_space(sizeof(*get)); - karg = get; - break; - } - if (karg == NULL) - return -EFAULT; - err = do_ioctl(file, kcmd, (unsigned long)karg); - if (err) - return err; - switch (cmd) { - case MTIOCPOS32: - upos32 = argp; - err = convert_in_user(&pos->mt_blkno, &upos32->mt_blkno); - break; - case MTIOCGET32: - umget32 = argp; - err = convert_in_user(&get->mt_type, &umget32->mt_type); - err |= convert_in_user(&get->mt_resid, &umget32->mt_resid); - err |= convert_in_user(&get->mt_dsreg, &umget32->mt_dsreg); - err |= convert_in_user(&get->mt_gstat, &umget32->mt_gstat); - err |= convert_in_user(&get->mt_erreg, &umget32->mt_erreg); - err |= convert_in_user(&get->mt_fileno, &umget32->mt_fileno); - err |= convert_in_user(&get->mt_blkno, &umget32->mt_blkno); - break; - } - return err ? -EFAULT: 0; -} - #endif /* CONFIG_BLOCK */ /* Bluetooth ioctls */ @@ -544,8 +479,6 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) */ COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ -/* Little m */ -COMPATIBLE_IOCTL(MTIOCTOP) /* Socket level stuff */ COMPATIBLE_IOCTL(FIOQSIZE) #ifdef CONFIG_BLOCK @@ -657,9 +590,6 @@ static long do_ioctl_trans(unsigned int cmd, #ifdef CONFIG_BLOCK case SG_IO: return sg_ioctl_trans(file, cmd, argp); - case MTIOCGET32: - case MTIOCPOS32: - return mt_ioctl_trans(file, cmd, argp); #endif /* Serial */ case TIOCGSERIAL: diff --git a/include/linux/mtio.h b/include/linux/mtio.h new file mode 100644 index 000000000000..02640756a40d --- /dev/null +++ b/include/linux/mtio.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MTIO_COMPAT_H +#define _LINUX_MTIO_COMPAT_H + +#include +#include + +/* + * helper functions for implementing compat ioctls on the four tape + * drivers: we define the 32-bit layout of each incompatible strucucture, + * plus a wrapper function to copy it to user space in either format. + */ + +struct mtget32 { + s32 mt_type; + s32 mt_resid; + s32 mt_dsreg; + s32 mt_gstat; + s32 mt_erreg; + s32 mt_fileno; + s32 mt_blkno; +}; +#define MTIOCGET32 _IOR('m', 2, struct mtget32) + +struct mtpos32 { + s32 mt_blkno; +}; +#define MTIOCPOS32 _IOR('m', 3, struct mtpos32) + +static inline int put_user_mtget(void __user *u, struct mtget *k, bool compat) +{ + struct mtget32 k32 = { + .mt_type = k->mt_type, + .mt_resid = k->mt_resid, + .mt_dsreg = k->mt_dsreg, + .mt_gstat = k->mt_gstat, + .mt_fileno = k->mt_fileno, + .mt_blkno = k->mt_blkno, + }; + int ret; + + if (IS_ENABLED(CONFIG_COMPAT) && compat) + ret = copy_to_user(u, &k32, sizeof(k32)); + else + ret = copy_to_user(u, k, sizeof(*k)); + + return ret ? -EFAULT : 0; +} + +static inline int put_user_mtpos(void __user *u, struct mtpos *k, bool compat) +{ + if (IS_ENABLED(CONFIG_COMPAT) && compat) + return put_user(k->mt_blkno, (u32 __user *)u); + else + return put_user(k->mt_blkno, (long __user *)u); +} + +#endif