From patchwork Tue Jul 30 19:25:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066679 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 6D4C8746 for ; Tue, 30 Jul 2019 19:29:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6088D285F0 for ; Tue, 30 Jul 2019 19:29:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5461B2818E; Tue, 30 Jul 2019 19:29: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=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 E5CA1285A0 for ; Tue, 30 Jul 2019 19:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729318AbfG3T30 (ORCPT ); Tue, 30 Jul 2019 15:29:26 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:51295 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfG3T3Z (ORCPT ); Tue, 30 Jul 2019 15:29:25 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1N63i4-1iPTqd44Km-016M4N; Tue, 30 Jul 2019 21:26:44 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , "Darrick J. Wong" Subject: [PATCH v5 01/29] fix compat handling of FICLONERANGE, FIDEDUPERANGE and FS_IOC_FIEMAP Date: Tue, 30 Jul 2019 21:25:12 +0200 Message-Id: <20190730192552.4014288-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:qXlr0d++2tj+pUFKeftKl2b9BAfEzIV3K/6V1jGgO84qalNDcjH wcCAJdjvc9xpj3/KOMCBEBqHuh+hgqGHN2PClurDOIfZPLAtN39bciMqT5Od9PdfywyWZ5A c2Vc62ISn+PYhK6YrkwChE2ndNdQXTs+Epe3KbFPLlc/f6zSCUJyhRKppzyByJ32xTPHgcs m4jv16XTipzzRDwyK4fjQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:R4vNWzY+q/k=:yTSOyq6A0kE9G8v6NREzxV nfh0DkcjUdtiwsYrz17bzXoYRz/QfCCnAIj/ju417izpnJQ0mfLiF7wGKYYcIuL5d9I0A1VF7 7bsI3H7Yo2tA7k+u0nUGtcUZPn36WdOeGZB5w1TNO7Cfv00mHSZ/CjsG7184gJYfz7o7Jc3Et gpk6ROSYbSx2QmCaJRP9+QWCQjRumCNPrI08bb0C/ugS/YsKOYqlD3HZVMiLodZGMEyWe0FPu IbAjnGqIArJRP4HYbarSNF9uEYsk6baDoP+mH0u1LINvgo0BQFTlAWGFDykgI2IlMlkX7l3u6 3F235Ys5+2YemeLYnAlyXFMfE9EJuX7sl7YDxpV0s0PFNBpexTuAsKqBXayVwIv4dS/4kQAhX e7gat5ch5vSF4i089Ihzq1t7E3vspLofC7AmmltXOQEnWwWwanZh5j4L5LLn581ao8rB0tKU9 UPNiEfd2MQQi4LeSuhcEEmdv2KneMf1WGhN2ApXTQLz8+Fjhi8hiO263eaFii950OocJd6aWP 5UvThB78l1KCn6/mNr3MYXomwpcS81p6+LCgQlWjv5Me5UZVtk2dz3AEp+PS3pwBFL8LVHHOe tS7Jx4qKzvhYmuOUEgtiphYe3+Ak7JqwhYRNhtdekpW7cbW6PKzjs/xHpiGrP8uo+/pvF6/KD vSOs2gw20zh926HOU6ajHEKTNAGAbqTvAiPgK2AOgDenXTNihUn/tUEj7onAtVH74FwtUUyRJ 6Wq/TAKxWvrMt56qQ310LCGGl65D3I56dqe0VA== 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 From: Al Viro Unlike FICLONE, all of those take a pointer argument; they do need compat_ptr() applied to arg. Fixes: d79bdd52d8be7 54dbc15172375 ceac204e1da94 Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6e30949d9f77..31104486fc8b 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1035,10 +1035,11 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, #endif case FICLONE: + goto do_ioctl; case FICLONERANGE: case FIDEDUPERANGE: case FS_IOC_FIEMAP: - goto do_ioctl; + goto found_handler; case FIBMAP: case FIGETBSZ: From patchwork Tue Jul 30 19:25:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066645 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 68CA0746 for ; Tue, 30 Jul 2019 19:26:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D4E7262F2 for ; Tue, 30 Jul 2019 19:26:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51B392675C; Tue, 30 Jul 2019 19:26:57 +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 0183A212BE for ; Tue, 30 Jul 2019 19:26:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727776AbfG3T0w (ORCPT ); Tue, 30 Jul 2019 15:26:52 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:59565 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbfG3T0w (ORCPT ); Tue, 30 Jul 2019 15:26:52 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MHGPA-1i5lAg3ZiK-00DIZr; Tue, 30 Jul 2019 21:26:50 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 02/29] FIGETBSZ: fix compat Date: Tue, 30 Jul 2019 21:25:13 +0200 Message-Id: <20190730192552.4014288-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:VxTk9t+4Eekl9sCPB+GuZDa2xg1XBRfZQglgCfBj49V8HwSmbKd Sw7uRVqvGYKhkeLbQqxl8zdTMC4RfJTS1MLu1l6zvTVCdozLb1nU5LO2C4FwCrVqmUwAY9/ 2crBk3tFpmHkyXL+bmRrp0XMia+YHHHGue9lCZaxxA32R6FWCvfrFcEVEJmOkH1wlSjqQl9 ONVXjZR43c/BwjmHj5cwA== X-UI-Out-Filterresults: notjunk:1;V03:K0:ow8KP7vl+/8=:n/Ux7h/tmfUb5shzgf+p5Q pPUfmEM/h2X2PHpWp0SMRuE9h9EuDgYH8EIHesF/7vQi+qnron5p12uAgMcIpD+GGLVdh/3Hj 9vxHv6tM9/DJWP/vrlWUuvf8SYQE4kmF3gTfrIqPw/TPpDFX+xxQMmRKU918R/gEqQzdF+b+S oJV1Baa1PoKtHM/uw28YGttwVGuJsXw921fmhqrwxAVcT4N/cUS21orvEvbPApvj2YAOXDtC2 77a2RGWNyxbMDRVVtgMnwEGEKwCKh0keLQH0rLvUyoVoPghghJlfxGv3YH/xpuWVGOyvg2SsQ RXO6sD49HUAJ+dC1CvVyoFkVktMA2LXimKhSwRFWVvmqajGgpaFgFiqosFOTWL7mTMu8cKIPx +gEsA6UvhdK1gW0IllbilCWowWIW2PByyXmaJdFEB0eR93WvhKKA6a3Ps95MBxLGb8aB89hN9 Ad5ojH/vyw+eDmh1E83V39mDjzPgFc6UEtrGTxU2aSPwJ5hyKzMOEkcf8E3FBs2kCwYSluqXT PjuZ1hFMCSucerZ2alDT9Lq1Cwhv5ozwJ1mnorN77Z0KcNCNkYdV5fxSpph+Jh42zwtrqTVKZ movYVnycq6YIuYS7cSwb+krgAy5b42qE+eHpKSqM8d81k/zvJ+7Ggs6leXwBJURvChdQGgPIG XaAzB5BzN9h/rakR6aF1W+6czyIb3qO6CHLbKO5j/95yFsUGQvNCr9myzVtCC0qch8NKqhhb4 k6xeofYmahv7IMIcGurE7p5H2R3/FGmphcDIqA== 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 From: Al Viro it takes a pointer argument, regular file or no regular file Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 31104486fc8b..b19edbc57146 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1039,10 +1039,10 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, case FICLONERANGE: case FIDEDUPERANGE: case FS_IOC_FIEMAP: + case FIGETBSZ: goto found_handler; case FIBMAP: - case FIGETBSZ: case FIONREAD: if (S_ISREG(file_inode(f.file)->i_mode)) break; From patchwork Tue Jul 30 19:25:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066647 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 E5350746 for ; Tue, 30 Jul 2019 19:27:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAAB027D16 for ; Tue, 30 Jul 2019 19:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8CCD282EC; Tue, 30 Jul 2019 19:27:03 +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 8451727D16 for ; Tue, 30 Jul 2019 19:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729004AbfG3T1D (ORCPT ); Tue, 30 Jul 2019 15:27:03 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:57603 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbfG3T1C (ORCPT ); Tue, 30 Jul 2019 15:27:02 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1M7sUE-1hxTSY19zm-0055Nl; Tue, 30 Jul 2019 21:27:00 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 03/29] compat: itanic doesn't have one Date: Tue, 30 Jul 2019 21:25:14 +0200 Message-Id: <20190730192552.4014288-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:qaoDHaHD+s46a0f7CuoKPmcS/DsWUB6tQTO63pYVO2pFc9Lk6pw YYnbzo9CPSTw7aED9zn5+RGRDdKkvNH2orYMNySDgu/+DtdQjwcJQxeSP9EIvX70gX0J5ZF uozFzYSxFxxYjowy+PKfj0Pj5XGsGCQ5wL5CxzAgWE8td96LCcXbHxnnhOJ7lSw04j/nRrA 36njQCm2lNfGowV6E1FPw== X-UI-Out-Filterresults: notjunk:1;V03:K0:tzkiCjmVjfk=:G3U5T79b/H8a1iqfECjoBH Lg3LcXWK1AnnKdYz91XsCpRxsLqTRxnuW/6SJ6fwMwnoHOUtMSIGw6GTOXOoh3xuc5I+/kwQI byHHD0PxKHsrtapC0duDNG6h3YcPDd3ujMHXldgPuoB1ZRd8zwKLPXGVCaLTwtY0l2HrqK6Ho zQbFqPGETH0wocKzXDRu6wRzSXFM+6e+Uy8mYqRzkq/zXPLskJc58quAJrfKDRcFCfkt8Xcze qy5F71aAeiIPazyfHfkpxbiR+kMAtpzQ0WVL1txk/XG/FYiePmHXmj9Btwcp6XmXZM5D6Lm9d gNdGyk9b/xuKC5itprkzLPsrb1rfW5bBN72YKue9o80kVSUhvacC972cD60xYflJYyebx6VoB nnChjWRNvM8n0n56J7O4MYDIedPUXhGutyN+GXvF976Py8Kszrn+sYrEOgkW90sC81ZU/EDbV 9/XTjvzPyi1YEkBpvn3I5zuJPo3FGJR+ug7D3huOuA6Hs3+lTIXBTd2CNt+lqDxlp0p3KCikn wBNwItf77CpuvMhRaBD44jBMASj7OydGizef2aZrYLp46sCNEjVQJL42ASyyGqURpBOJ/pE+y YAwMfubyRg9cyOa7rq2dSmeWVBfkEDctvFAPEKR3ii4A3yzX8TmIH4G9PlWXt+8oVxsI8wjEW /ELLu1CA+Cjd0ZPUnNluE2gH2pSCme+bCtFSV1DV+k0iBcHW+5Pr12FeUWBv0pNT9D5+uu8CC 5LF9MZyvAfucOm404aJmI5gb9YIG61VFImJCWg== 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 From: Al Viro ... and hadn't for a long time. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index b19edbc57146..3d08817be7b8 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -468,7 +468,7 @@ static int rtc_ioctl(struct file *file, } /* on ia32 l_start is on a 32-bit boundary */ -#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) +#if defined(CONFIG_X86_64) struct space_resv_32 { __s16 l_type; __s16 l_whence; @@ -1022,7 +1022,7 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, case FIOQSIZE: break; -#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) +#if defined(CONFIG_X86_64) case FS_IOC_RESVSP_32: case FS_IOC_RESVSP64_32: error = compat_ioctl_preallocate(f.file, compat_ptr(arg)); From patchwork Tue Jul 30 19:25:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066671 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 2CC90746 for ; Tue, 30 Jul 2019 19:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E2F4285C6 for ; Tue, 30 Jul 2019 19:29:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10F7E285BE; Tue, 30 Jul 2019 19:29: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 37B83284C5 for ; Tue, 30 Jul 2019 19:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388077AbfG3T33 (ORCPT ); Tue, 30 Jul 2019 15:29:29 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:42193 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfG3T32 (ORCPT ); Tue, 30 Jul 2019 15:29:28 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MPp0l-1hgDjO0Qap-00MtFU; Tue, 30 Jul 2019 21:27:29 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Amir Goldstein , Dave Chinner , Miklos Szeredi , "Darrick J. Wong" Subject: [PATCH v5 04/29] do_vfs_ioctl(): use saner types Date: Tue, 30 Jul 2019 21:25:15 +0200 Message-Id: <20190730192552.4014288-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:MCta0RGgf01015SH24OTPHqteqHOO6itXkDD7QX+UrLmioMGiDF HsY/l7URD7XE5tpeJJYg93oLECrl1DqOEPQ+klC6eTXg/1hLA/wq8MaxniK0LSh7oxOIaTD KLAYGoosvsfjWtewjouxLTs0W2fsnHaZ+6FwPwEHi5NScFngc/pwhe152slTd2DREgnGoCc mRvqNg42XWJZ6ePXxDz1w== X-UI-Out-Filterresults: notjunk:1;V03:K0:QT1LidRZpKY=:0YxiP35xtkAKrc4fvbEh/7 MAQc01UIw8htdvjMtA2MEU8YpOsAx3GPjSmtPNLy93XMBV7ZkU47/YZZKh2HNjWs7q521fC31 NgDK8+GZDcNW4keJ7RvsAZph+KeZrpKQFyy5XsJ9G/2hvPJSfj3GZvrVkyskXRY4r5JklIjmo FpW23co6D3mfLBQQNAvXdUI4FBYo9Q/rm2Ikl3VY0ihJ8LhEwUatKTeV7g4rTKgtUo+QzPnq0 LpUt+qLuzp+3MNKhkZp5yEHR3u7796trclWyCfE8gZIHlQtqJE2M6jpwSivf1UjwClmXX97uO 1L+oJWsGsxmK2N3uIOGLg9dFiwv+dKMPaULFmovLRsubcet9GmewSKRcmJRcW7O3XLYqULtjS Ymyy9CM+ugBPQ4hdfdbYSJpWipJCx30p6sfXUObAAEFvwZKvOJa3urleeFHRFlT20N2VMA1Z/ rTiEqN8uuEt1bMxKhk3+PKox55LtfxrJwldZq3wd5luCXibDX6vDPMpTRaWXtCY/P+MXkujxZ VfWtRsgPeSETQi7cFKud9hx8PnsML/xforbYOvWFtLuYh3YPPxnUfbvFWKdYgT+sGVpPIwoMd /ITZl67R8uh1WGZpDOYub2Kc9lYA+NTWagd1uORKVEFU2QQdhLa2wqLGOLTfx8UCx0brzj+jG ynyfr59FTYlW0vHOlRLU94oIo6fAKlfe/Z51Qzo4RnopydnpzagD1aQ54D+96hEiKRHo8+lJ5 S9ZDdrzCan1rDPRCQAqiQSxoe3DC3LZ1E3qxeA== 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 From: Al Viro casting to pointer to int, only to pass that to function that takes pointer to void and uses it as pointer to structure is really asking for trouble. "Some pointer, I'm not sure what to" is spelled "void *", not "int *"; use that. And declare the functions we are passing that pointer to as taking the pointer to what they really want to access. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/ioctl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/ioctl.c b/fs/ioctl.c index fef3a6bf7c78..3f28b39f32f3 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -174,10 +174,9 @@ static int fiemap_check_ranges(struct super_block *sb, return 0; } -static int ioctl_fiemap(struct file *filp, unsigned long arg) +static int ioctl_fiemap(struct file *filp, struct fiemap __user *ufiemap) { struct fiemap fiemap; - struct fiemap __user *ufiemap = (struct fiemap __user *) arg; struct fiemap_extent_info fieinfo = { 0, }; struct inode *inode = file_inode(filp); struct super_block *sb = inode->i_sb; @@ -244,7 +243,8 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd, return ret; } -static long ioctl_file_clone_range(struct file *file, void __user *argp) +static long ioctl_file_clone_range(struct file *file, + struct file_clone_range __user *argp) { struct file_clone_range args; @@ -584,9 +584,9 @@ static int ioctl_fsthaw(struct file *filp) return thaw_super(sb); } -static int ioctl_file_dedupe_range(struct file *file, void __user *arg) +static int ioctl_file_dedupe_range(struct file *file, + struct file_dedupe_range __user *argp) { - struct file_dedupe_range __user *argp = arg; struct file_dedupe_range *same = NULL; int ret; unsigned long size; @@ -635,7 +635,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg) { int error = 0; - int __user *argp = (int __user *)arg; + void __user *argp = (void __user *)arg; struct inode *inode = file_inode(filp); switch (cmd) { @@ -674,13 +674,13 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, break; case FS_IOC_FIEMAP: - return ioctl_fiemap(filp, arg); + return ioctl_fiemap(filp, argp); case FIGETBSZ: /* anon_bdev filesystems may not have a block size */ if (!inode->i_sb->s_blocksize) return -EINVAL; - return put_user(inode->i_sb->s_blocksize, argp); + return put_user(inode->i_sb->s_blocksize, (int __user *)argp); case FICLONE: return ioctl_file_clone(filp, arg, 0, 0, 0); From patchwork Tue Jul 30 19:25:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066649 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 8AF22746 for ; Tue, 30 Jul 2019 19:27:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 805CF2624D for ; Tue, 30 Jul 2019 19:27:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EAA128396; Tue, 30 Jul 2019 19:27:51 +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 0D7F428429 for ; Tue, 30 Jul 2019 19:27:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728522AbfG3T1t (ORCPT ); Tue, 30 Jul 2019 15:27:49 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:58195 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727797AbfG3T1t (ORCPT ); Tue, 30 Jul 2019 15:27:49 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MsqIi-1iCGYg0g8m-00tAnf; Tue, 30 Jul 2019 21:27:42 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Amir Goldstein , "Darrick J. Wong" , Dave Chinner Subject: [PATCH v5 05/29] compat: move FS_IOC_RESVSP_32 handling to fs/ioctl.c Date: Tue, 30 Jul 2019 21:25:16 +0200 Message-Id: <20190730192552.4014288-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dX0rFn6Lm0g176R2j8aLSlUXtVSxnFFpTjiGEtz+uG2yFRMoLpW gJcCYxwoCpkXung1LVVkFOxfZhdD7ENcquhCe2bYCjXRxSG+pORCi7WhsWWvLGThivYPE1k 3r2tXzAMS4I7Df4uy0RXLSLfrnvtoqABKA9fspjIAYCWu7lCIeRlBRGV/iRLH9tgp30nFJ2 UtllthknH6+3gVDzSb8QA== X-UI-Out-Filterresults: notjunk:1;V03:K0:G9802wau1lg=:CDAVQ6YWBIfOldoKNgof5s R85xKlPdmMVXNKvI24p5c+9dYMHdOvB9DhlEf+FUKkkhJ8Po9nXkO/OrIEKO/5lKOMLcktS9V umhtKfDvlPxB0Xf+7nsGimQg1cUH2mKBlkCB90ggCkcsrNbYn1DcUq0gir5UxmDo3wdzpqq1u FbZ09PLvX1oJHOj9toMaQEi3urf1tzUh6pXJmlSrENGkTmxc8gGMxEvDtF7YMzWAQOj6ZwX2h uj5bjRVwqxSflpznqRDlgCbQwwuibuv+Q8qDNIVKhNFcMdQ+OVlMx1TalpTN44oS2dH6VMskx xzXN3IVfTszifttPr05w70qnO9uztHT/Mnh5fiFe8XeXHe4VmsegfXtEjU1wldZmn/olxnmKF l5VR/Dg/8MvvC7+swqU4AiHEPnWT8yQ2PdscLluBZxApelqkMnTk5rbZ2fj1FxelKu5ovm0iF BOUwa2r/zjvOQW2faH1/qxNRxEeinOXsfc/5oHx8VxRK66zOFn8pmzbla8LnGfBhn6LvQj0hU kVHa1nI3V48NS6fdH/7KeeeGQJXJUZagHCVCFIpRPVeenZIUZcrFCRNZKYo6d97c/w4Wj+qrv 3Z4P3J5ilFP7yt+BeYkac97GGI8KLJkSCxJoqxFIYBSv7z+h+gnZoiFuj1HxyCHt75HrfXj9t XgCDa9WShhV2HQ4/+qnWgI2fUBsY9DmH7BA3TZcioHzUkp6XZ8leZmSo0jcYbXkYdXYoHp0VF JwDqVP9FTctWPp5INUlZwYFye76ytFTTlKCDQQ== 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 From: Al Viro ... and lose the ridiculous games with compat_alloc_user_space() there. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 35 ----------------------------------- fs/ioctl.c | 29 +++++++++++++++++++++++++++++ include/linux/falloc.h | 20 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 3d08817be7b8..0a748324f96f 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -467,41 +467,6 @@ static int rtc_ioctl(struct file *file, return -ENOIOCTLCMD; } -/* on ia32 l_start is on a 32-bit boundary */ -#if defined(CONFIG_X86_64) -struct space_resv_32 { - __s16 l_type; - __s16 l_whence; - __s64 l_start __attribute__((packed)); - /* len == 0 means until end of file */ - __s64 l_len __attribute__((packed)); - __s32 l_sysid; - __u32 l_pid; - __s32 l_pad[4]; /* reserve area */ -}; - -#define FS_IOC_RESVSP_32 _IOW ('X', 40, struct space_resv_32) -#define FS_IOC_RESVSP64_32 _IOW ('X', 42, struct space_resv_32) - -/* just account for different alignment */ -static int compat_ioctl_preallocate(struct file *file, - struct space_resv_32 __user *p32) -{ - struct space_resv __user *p = compat_alloc_user_space(sizeof(*p)); - - if (copy_in_user(&p->l_type, &p32->l_type, sizeof(s16)) || - copy_in_user(&p->l_whence, &p32->l_whence, sizeof(s16)) || - copy_in_user(&p->l_start, &p32->l_start, sizeof(s64)) || - copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) || - copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) || - copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) || - copy_in_user(&p->l_pad, &p32->l_pad, 4*sizeof(u32))) - return -EFAULT; - - return ioctl_preallocate(file, p); -} -#endif - /* * simple reversible transform to make our table more evenly * distributed after sorting. diff --git a/fs/ioctl.c b/fs/ioctl.c index 3f28b39f32f3..9d26251f34a9 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -490,6 +490,35 @@ int ioctl_preallocate(struct file *filp, void __user *argp) return vfs_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len); } +/* on ia32 l_start is on a 32-bit boundary */ +#if defined CONFIG_COMPAT && defined(CONFIG_X86_64) +/* just account for different alignment */ +int compat_ioctl_preallocate(struct file *file, + struct space_resv_32 __user *argp) +{ + struct inode *inode = file_inode(file); + struct space_resv_32 sr; + + if (copy_from_user(&sr, argp, sizeof(sr))) + return -EFAULT; + + switch (sr.l_whence) { + case SEEK_SET: + break; + case SEEK_CUR: + sr.l_start += file->f_pos; + break; + case SEEK_END: + sr.l_start += i_size_read(inode); + break; + default: + return -EINVAL; + } + + return vfs_fallocate(file, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len); +} +#endif + static int file_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { diff --git a/include/linux/falloc.h b/include/linux/falloc.h index 674d59f4d6ce..fc61fdb9d1e9 100644 --- a/include/linux/falloc.h +++ b/include/linux/falloc.h @@ -29,4 +29,24 @@ struct space_resv { FALLOC_FL_INSERT_RANGE | \ FALLOC_FL_UNSHARE_RANGE) +/* on ia32 l_start is on a 32-bit boundary */ +#if defined(CONFIG_X86_64) +struct space_resv_32 { + __s16 l_type; + __s16 l_whence; + __s64 l_start __attribute__((packed)); + /* len == 0 means until end of file */ + __s64 l_len __attribute__((packed)); + __s32 l_sysid; + __u32 l_pid; + __s32 l_pad[4]; /* reserve area */ +}; + +#define FS_IOC_RESVSP_32 _IOW ('X', 40, struct space_resv_32) +#define FS_IOC_RESVSP64_32 _IOW ('X', 42, struct space_resv_32) + +int compat_ioctl_preallocate(struct file *, struct space_resv_32 __user *); + +#endif + #endif /* _FALLOC_H_ */ From patchwork Tue Jul 30 19:25:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066657 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 54676746 for ; Tue, 30 Jul 2019 19:27:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45C982624D for ; Tue, 30 Jul 2019 19:27:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A132285C6; Tue, 30 Jul 2019 19:27:58 +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 C80AB2857E for ; Tue, 30 Jul 2019 19:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729255AbfG3T1x (ORCPT ); Tue, 30 Jul 2019 15:27:53 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:46957 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfG3T1w (ORCPT ); Tue, 30 Jul 2019 15:27:52 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MBDSg-1i5DlA14H8-00CikT; Tue, 30 Jul 2019 21:27:50 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 06/29] compat_sys_ioctl(): make parallel to do_vfs_ioctl() Date: Tue, 30 Jul 2019 21:25:17 +0200 Message-Id: <20190730192552.4014288-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:eUvt0YwKFhdJg3lXz9kxlv3RXRQRot6byum/SOVWh3BqhBoj/Qc n5CZqcDwwKhTWYc1HfnuIFiUr8gnv1TUw0T6/y2KQFQ0GqYgwzhsbaxfkolBUIt5CO4qih8 DnkkS1PeIfjzlniRUYryGnDLX9dVaYM4JbWRnRxBfrMN5rLpNmyQyDj9NMY8v1uv4YE2PEz bl+IkX+jtbo0u4NM30/jQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:s3Bn1Da8AC4=:aD9jeEvFDKbXMao1EcVNht gWfXtfcsfsUvkOV5fH9VL7WfvhDLEP01Rc+Ux+8H7G/7meXuGe1fqJ03l1mlMTEVOcXMgpbn/ DaUnN6Ls/LDtZy4Z2fLoFIaletrZJmrD6HkIB14fj7In5Vzh0AqIjuoq7RWDGxzneVNsB2rTh kFPmzEB4H5xp7gQZ/8/J920fBHy4u7ZKqx25bU9XLd+yHdgwqstrC3nQGB6hRUyIPON4SvsZs 8+kN+LuxBLwMem0zDvl0EcDrGzZIFKFlyOMXhodI5TwTOo1CTm7hsYNo8/XLMfPBxISjB+P/H v3jN0UMcHHQuunipcIAEMutgnKu7wJN1EIVSHjFxRXRDfQmAZCL72eq8MZalKTK8f37orV9b5 ovkR3BUD96LMEycqJH/Bx1clGRN5cC7yv/vk+2zu0nquHaeZn4xJ0RZkmz7oGfY9lclgfxAro orDtEED/WLtX0HVNU3WJrAB72rUxEG4005j82nE1rzgte0N53qDXh90/qpaXg+Rru+9xYctWq zor2KmkXeWprzwK91UazLo1KD4WV0c/xtD6GR/31ke6YZzQqkt6tat9diCMt1Ok1DGGZpcrl0 OdMpUw20AxETEjLetKzW7zVhLec9qTMBopqts22IJbIQ3kYDq44WezJUBgKnoOzQ2y965t3Ef RHnJuqtqmp8cU1lINUG28j5Lf6yoGGoRWeoGxudAVPbe3bGxEUgCZqwLFKNJRw0pn2QQy6sHy EotLIhNf3QjY2oXPpHq3Tmai2wkbZZX02lMI+A== 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 From: Al Viro Handle ioctls that might be handled without reaching ->ioctl() in native case on the top level there. The counterpart of vfs_ioctl() (i.e. calling ->unlock_ioctl(), etc.) left as-is; eventually that would turn simply into the call of ->compat_ioctl(), but that'll take more work. Once that is done, we can move the remains of compat_sys_ioctl() into fs/ioctl.c and finally bury fs/compat_ioctl.c. Signed-off-by: Al Viro Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 63 +++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 0a748324f96f..399287b277dd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -487,19 +487,7 @@ static unsigned int ioctl_pointer[] = { /* compatible ioctls first */ /* Little t */ COMPATIBLE_IOCTL(TIOCOUTQ) -/* Little f */ -COMPATIBLE_IOCTL(FIOCLEX) -COMPATIBLE_IOCTL(FIONCLEX) -COMPATIBLE_IOCTL(FIOASYNC) -COMPATIBLE_IOCTL(FIONBIO) -COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ -COMPATIBLE_IOCTL(FS_IOC_FIEMAP) -/* 0x00 */ -COMPATIBLE_IOCTL(FIBMAP) -COMPATIBLE_IOCTL(FIGETBSZ) /* 'X' - originally XFS but some now in the VFS */ -COMPATIBLE_IOCTL(FIFREEZE) -COMPATIBLE_IOCTL(FITHAW) COMPATIBLE_IOCTL(FITRIM) #ifdef CONFIG_BLOCK /* Big S */ @@ -974,19 +962,39 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, if (error) goto out_fput; - /* - * To allow the compat_ioctl handlers to be self contained - * we need to check the common ioctls here first. - * Just handle them with the standard handlers below. - */ switch (cmd) { + /* these are never seen by ->ioctl(), no argument or int argument */ case FIOCLEX: case FIONCLEX: + case FIFREEZE: + case FITHAW: + case FICLONE: + goto do_ioctl; + /* these are never seen by ->ioctl(), pointer argument */ case FIONBIO: case FIOASYNC: case FIOQSIZE: - break; - + case FS_IOC_FIEMAP: + case FIGETBSZ: + case FICLONERANGE: + case FIDEDUPERANGE: + goto found_handler; + /* + * The next group is the stuff handled inside file_ioctl(). + * For regular files these never reach ->ioctl(); for + * devices, sockets, etc. they do and one (FIONREAD) is + * even accepted in some cases. In all those cases + * argument has the same type, so we can handle these + * here, shunting them towards do_vfs_ioctl(). + * ->compat_ioctl() will never see any of those. + */ + /* pointer argument, never actually handled by ->ioctl() */ + case FIBMAP: + goto found_handler; + /* handled by some ->ioctl(); always a pointer to int */ + case FIONREAD: + goto found_handler; + /* these two get messy on amd64 due to alignment differences */ #if defined(CONFIG_X86_64) case FS_IOC_RESVSP_32: case FS_IOC_RESVSP64_32: @@ -995,23 +1003,8 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, #else case FS_IOC_RESVSP: case FS_IOC_RESVSP64: - error = ioctl_preallocate(f.file, compat_ptr(arg)); - goto out_fput; -#endif - - case FICLONE: - goto do_ioctl; - case FICLONERANGE: - case FIDEDUPERANGE: - case FS_IOC_FIEMAP: - case FIGETBSZ: goto found_handler; - - case FIBMAP: - case FIONREAD: - if (S_ISREG(file_inode(f.file)->i_mode)) - break; - /*FALL THROUGH*/ +#endif default: if (f.file->f_op->compat_ioctl) { From patchwork Tue Jul 30 19:25:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066661 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 7F0C9174A for ; Tue, 30 Jul 2019 19:28:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 766F228396 for ; Tue, 30 Jul 2019 19:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74B69284C5; Tue, 30 Jul 2019 19:28:34 +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 2004D2867C for ; Tue, 30 Jul 2019 19:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387766AbfG3T22 (ORCPT ); Tue, 30 Jul 2019 15:28:28 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:33433 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfG3T22 (ORCPT ); Tue, 30 Jul 2019 15:28:28 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MfpjF-1iYSFh2Mgb-00gKk2; Tue, 30 Jul 2019 21:28:20 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , "Yan, Zheng" , stable@vger.kernel.org, Jeff Layton , Sage Weil , Ilya Dryomov , ceph-devel@vger.kernel.org Subject: [PATCH v5 07/29] ceph: fix compat_ioctl for ceph_dir_operations Date: Tue, 30 Jul 2019 21:25:18 +0200 Message-Id: <20190730192552.4014288-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:OFNJPOAxGGQ88UZpH506xX65QSClANbkeR8AXnNFg+lHh90Gp1y Km41PW8pur9V06yneCdcMZ9hh6d7J9oJdH/kEeWqHVzsG8RfrRQSupk+d4DtS4KyFBYLPBk rLbLRcJlpLJWSeIcWqGypgZFvJWpty+odggTjE26mYnYSO+ZtQlFYfaJz+zO9Ttf4G3JFIk GArX7xpL2XyXJhbP6c1FA== X-UI-Out-Filterresults: notjunk:1;V03:K0:7ixz1WNaE9E=:uKu7zALGZzh9Pb/581lnUp nEk/LWN5HTdg5wgAzCfGiVw/W98p50xEGd/MYkeFR/+jqdAlXWazfuGBWuoHj/4eQJfnvWJ5r 4mVE7cUYfbuFFpZ+Vp+MldVtItnygDJl4pYCuOWCGYep5VqwG1vaLk4kGIj91MRla4R3f//mN Ao3WW5mslyMD18Z+FIV50rXswB9VoGR4WQw7RTJUHetuBsHa07aPDlSRcY/uP2lOEkmZ2p2kN YFsUfeib4Gt9qLDT4OI0fyD7SvU9ZELhn5Q+RJk1rv4DxktrrUern2aMCavVNcat0Izyxz5jq GMZzq2Gc9G3qdZ5NGD9I2nQA1qYLsPlr1ZOybe2mG6r69qiwGnCV/aEFfehF147d8NBcZkIb3 aQn1oI+qSDtExttzQKmjqV8Cr9PvYZTBV5+kXOQa5HjTdQj+ECe82bjd/+/D4fByztqZlwqjJ yQWn6RZ4myWQG6fv/KYq0Ws3eHzP/9STmpTiTh4zQzz+GWGVHzFcIqvkP5VA5rr75q95jzPn7 394M+z/wTyOYXLfcXkUOAxu/+lXElKeFl6hsPOtRAxIMidDR1Z/OJV5ACHotfEjWCHTQns1H4 qhefIVICQQS3pBpDC9mbTC83KPjxxgwOMdmWfzc0d5sS2vlzQRcDh+o9GP6ad992ZzONHzn+f 9bot1snjzctzXYFC/KfkjepJfrF4h+GLon35W3nYgIqFb8ZzPKescF3M7t1zHlnqoJ2JrpJIz Mx8EeqifWwxcXLRP7OQCYd9H/5ANh8rYYo1wNg== 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 ceph_ioctl function is used both for files and directories, but only the files support doing that in 32-bit compat mode. For consistency, add the same compat handler to the dir operations as well, and use a handler that applies the appropriate compat_ptr() conversion. Reviewed-by: "Yan, Zheng" Cc: stable@vger.kernel.org Signed-off-by: Arnd Bergmann --- fs/ceph/dir.c | 1 + fs/ceph/file.c | 2 +- fs/ceph/super.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 4ca0b8ff9a72..401c17d36b71 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1808,6 +1808,7 @@ const struct file_operations ceph_dir_fops = { .open = ceph_open, .release = ceph_release, .unlocked_ioctl = ceph_ioctl, + .compat_ioctl = ceph_compat_ioctl, .fsync = ceph_fsync, .lock = ceph_lock, .flock = ceph_flock, diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 685a03cc4b77..99712b6b1ad5 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -2138,7 +2138,7 @@ const struct file_operations ceph_file_fops = { .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, .unlocked_ioctl = ceph_ioctl, - .compat_ioctl = ceph_ioctl, + .compat_ioctl = ceph_compat_ioctl, .fallocate = ceph_fallocate, .copy_file_range = ceph_copy_file_range, }; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index d2352fd95dbc..0aebccd48fa0 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -1108,6 +1109,15 @@ extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); /* ioctl.c */ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); +static inline long +ceph_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ +#ifdef CONFIG_COMPAT + return ceph_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +#else + return -ENOTTY; +#endif +} /* export.c */ extern const struct export_operations ceph_export_ops; From patchwork Tue Jul 30 19:25:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066663 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 BEAE1746 for ; Tue, 30 Jul 2019 19:28:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4C142624D for ; Tue, 30 Jul 2019 19:28:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A92452857E; Tue, 30 Jul 2019 19:28:35 +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 6434E2624D for ; Tue, 30 Jul 2019 19:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388142AbfG3T2e (ORCPT ); Tue, 30 Jul 2019 15:28:34 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:36231 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388077AbfG3T23 (ORCPT ); Tue, 30 Jul 2019 15:28:29 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MmDVA-1iaRGm0ZTE-00iDU7; Tue, 30 Jul 2019 21:28:28 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 08/29] compat_ioctl: drop FIOQSIZE table entry Date: Tue, 30 Jul 2019 21:25:19 +0200 Message-Id: <20190730192552.4014288-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:tUvdG1WMQobt5AAVoouIKZHvzqLCLOJu7/p0P8VqNr8Q4WdBz3u x9m3YoSJEYiv52BuOBkOjncNMevqvr5QDHiEg+Df3/e4bpAEqHnD52lNtIU3YJS1F9YSnLT 2letDyNZOrAvdVibRaIkUy3PYV/m+exEWX2s/m1LGQ3NQ00oYwmTCMlMrynAwcw0vYgTVg/ mj6s2uRwwrGmSNOTOyofg== X-UI-Out-Filterresults: notjunk:1;V03:K0:BJlrIcF/JbQ=:Efes81chANaDychKC03WyL ShjLXXDKvBA8H6L5bJ0EH6teIdPt8ChiZNoUa1R+EntI/VyGW56jGeFu6HXsze7vGiSJkwZW9 JnPZnqcPzet59EfIQbkS1AAliGssb7Jbf8Spk2ZmDQ1YMBQUMxE/+MIfpK5S7FihYCQIwazIE v2toAc5AxmKeo/ASieJaOzF/0GGYh4Eq9jypevX/k6jENzvpADkDnf/pv1znOIHaijUxumlcV asUF19W0vl/W0t04DITeX5l5SSaoQQvZepXhjpssBHO7Wk8sasVodJHN6GxpN11qA41tVsY/M SV0kTB355qQzSXxijtv3wM4SZVPLe0IcPCkPL3ej4ehVbRA4C6A8tkXp3UcfF4czGN3HI2Mdz a7Ic3v79wdTYcuoCxo0hkEjL13ZxxUB6EkGt66Be5XhrbyU/qF/bjELurRN/2jXF8t6/7nUCS llnQKs5Jd3kg3j7drVCXTafuFxKK6TvO2mHER0fDi0oaclbMQ2PYeFw6H718SCricQY9N6ueK EFkS7fMTxsPW4xPqukqtvir2qhL992LUdW1GghMZ3K2W80yjNonvxaVMJj8ueoiOTcvvRINNP r604w3hfil1lDcnN3v6wqsX/8md13Q0wQaazfw8qv7F3clX6MGT+SRuk0irxfvJLczfySFtcR ysoRf6EVn2VQHRUAWvZfbk2vNOec57v9FaDBBKRdMT0u6Esipw7HqYFYGyvAworL/PAYlDXrT 2i3lqWbF3CzGmiyk7XZ4EJAbdJNYm7NfHVp+AA== 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 This is already handled by the compat_ioctl() function itself. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 399287b277dd..9ea1c4981332 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -528,8 +528,6 @@ 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 /* md calls this on random blockdevs */ IGNORE_IOCTL(RAID_VERSION) From patchwork Tue Jul 30 19:25:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066667 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 C8436746 for ; Tue, 30 Jul 2019 19:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE9781FFE5 for ; Tue, 30 Jul 2019 19:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2E82285F0; Tue, 30 Jul 2019 19:29:37 +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 00814212BE for ; Tue, 30 Jul 2019 19:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388305AbfG3T33 (ORCPT ); Tue, 30 Jul 2019 15:29:29 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:49951 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729034AbfG3T31 (ORCPT ); Tue, 30 Jul 2019 15:29:27 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MYvoW-1hoENq0aOG-00UpSh; Tue, 30 Jul 2019 21:29:18 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Guillaume Nault , Michal Ostrowski , "David S. Miller" , Dmitry Kozlov , James Chapman , netdev@vger.kernel.org Subject: [PATCH v5 09/29] compat_ioctl: pppoe: fix PPPOEIOCSFWD handling Date: Tue, 30 Jul 2019 21:25:20 +0200 Message-Id: <20190730192552.4014288-10-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:3YXTtGVjvpHiqeCSgT+9dwkwT822H+B7oH9lghcw9plt4dom0iE APQkOwjcwtwA3EKmsHcKETdhVjH7U6qPghQVH8AZD73UW0YodpccvoLppADXJ5ua0U3gHbz pj2gWLsvaOpaxRCSvemm85ntiKZkBw6aPO1ZxSEyUWWy3oFhJ2OXK1FO5OgH4DGEpa7t6Io JGSWJ/Suw7ZFDaYXufyDg== X-UI-Out-Filterresults: notjunk:1;V03:K0:7bjc6xE+V9o=:5Jy3Ds5CnF6lbkmYIWon+8 VoPUEGuLfFP6+g82eDgc74ZtMgzYBUN2pNg5h5b9tVz/IW2RR+MqKHX5DxolRwft7Arm9q24n icqB+kYc+TTLgZQOUKyrW1grWqxiPcEOK204r2ehaf7MSsAbD3zu00zUI1Y2tc9W+0j41FMEZ VtepcnXY5sb5H4d7NJFV0XAVePIKpHHT3GPxOYHMULrrW3xlLiq5X5SGYLH105WTiWd64qMcr aJkUFKIbMX2yecLDvNXADhDHXLo9FcIru3qkCd2EHIModI7ct/0J1V/3deYSNvr0/QB4xlAAC YXFk/Cz/3TUXxJbLDeXajddrZMTkOhZjcYRmftQDkGEHym5w4t5UhJkCRtgCcEN//VdMrDUZ4 KVX9qaArA6wl2ppj9f7Gf0QoX5GgPpepYEYbTWjlF47dgVKCpMGcE+v7OPLF39X98J0GSoamF KbCas1y+oTM6SBeG5k+smo5E+X+epIOAa8puearSXgMSgJwJg9hU+ZHNpqtu1xYtw42LUvF+z zxf+rNxURxhszo4dyACuIWYzVZ+hBfI8DoLqkM+RPbLTvqPio3h5dCR6t9BMuDEcCJ+Hh78Vz +rowUD1wk8DeyfRM0sS8eZhuijBiuYa684MwafhxlhwLqFcUqNlXgSTsrlLraNeBlYXT3WHYs EkYpWQ06PvhhGNTRLhP2g1HTd8pojlqFlRaRNgNEacCiMbT3PR0SKWavM/GsOS4GZyMc0S3C7 s9C7umPsuUJ3viU5wTiR/UUCzcrSxGZCSZ5QYQ== 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 Support for handling the PPPOEIOCSFWD ioctl in compat mode was added in linux-2.5.69 along with hundreds of other commands, but was always broken sincen only the structure is compatible, but the command number is not, due to the size being sizeof(size_t), or at first sizeof(sizeof((struct sockaddr_pppox)), which is different on 64-bit architectures. Guillaume Nault adds: And the implementation was broken until 2016 (see 29e73269aa4d ("pppoe: fix reference counting in PPPoE proxy")), and nobody ever noticed. I should probably have removed this ioctl entirely instead of fixing it. Clearly, it has never been used. Fix it by adding a compat_ioctl handler for all pppoe variants that translates the command number and then calls the regular ioctl function. All other ioctl commands handled by pppoe are compatible between 32-bit and 64-bit, and require compat_ptr() conversion. This should apply to all stable kernels. Acked-by: Guillaume Nault Signed-off-by: Arnd Bergmann --- drivers/net/ppp/pppoe.c | 3 +++ drivers/net/ppp/pppox.c | 13 +++++++++++++ drivers/net/ppp/pptp.c | 3 +++ fs/compat_ioctl.c | 3 --- include/linux/if_pppox.h | 3 +++ net/l2tp/l2tp_ppp.c | 3 +++ 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 1d902ecb4aa8..a44dd3c8af63 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -1115,6 +1115,9 @@ static const struct proto_ops pppoe_ops = { .recvmsg = pppoe_recvmsg, .mmap = sock_no_mmap, .ioctl = pppox_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = pppox_compat_ioctl, +#endif }; static const struct pppox_proto pppoe_proto = { diff --git a/drivers/net/ppp/pppox.c b/drivers/net/ppp/pppox.c index 5ef422a43d70..08364f10a43f 100644 --- a/drivers/net/ppp/pppox.c +++ b/drivers/net/ppp/pppox.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -98,6 +99,18 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) EXPORT_SYMBOL(pppox_ioctl); +#ifdef CONFIG_COMPAT +int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) +{ + if (cmd == PPPOEIOCSFWD32) + cmd = PPPOEIOCSFWD; + + return pppox_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); +} + +EXPORT_SYMBOL(pppox_compat_ioctl); +#endif + static int pppox_create(struct net *net, struct socket *sock, int protocol, int kern) { diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index a8e52c8e4128..734de7de03f7 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c @@ -623,6 +623,9 @@ static const struct proto_ops pptp_ops = { .recvmsg = sock_no_recvmsg, .mmap = sock_no_mmap, .ioctl = pppox_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = pppox_compat_ioctl, +#endif }; static const struct pppox_proto pppox_pptp_proto = { diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9ea1c4981332..cec3ec0a1727 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -589,9 +589,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) -/* PPPOX */ -COMPATIBLE_IOCTL(PPPOEIOCSFWD) -COMPATIBLE_IOCTL(PPPOEIOCDFWD) /* Big A */ /* sparc only */ /* Big Q for sound/OSS */ diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 8b728750a625..69e813bcb947 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -80,6 +80,9 @@ extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp); extern void unregister_pppox_proto(int proto_num); extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); +extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); + +#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t) /* PPPoX socket states */ enum { diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 1d0e5904dedf..c54cb59593ef 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -1681,6 +1681,9 @@ static const struct proto_ops pppol2tp_ops = { .recvmsg = pppol2tp_recvmsg, .mmap = sock_no_mmap, .ioctl = pppox_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = pppox_compat_ioctl, +#endif }; static const struct pppox_proto pppol2tp_proto = { From patchwork Tue Jul 30 19:25:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066681 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 DE438746 for ; Tue, 30 Jul 2019 19:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1DA528699 for ; Tue, 30 Jul 2019 19:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D00422876D; Tue, 30 Jul 2019 19:30:13 +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 28230285C6 for ; Tue, 30 Jul 2019 19:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728843AbfG3TaI (ORCPT ); Tue, 30 Jul 2019 15:30:08 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:37817 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728677AbfG3TaI (ORCPT ); Tue, 30 Jul 2019 15:30:08 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mvs2R-1iC0D41RtH-00su5I; Tue, 30 Jul 2019 21:29:49 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Amir Goldstein , Dave Chinner , "Darrick J. Wong" , Jan Kara , David Howells , Jens Axboe , Matthew Wilcox , Phillip Potter Subject: [PATCH v5 10/29] compat_ioctl: add compat_ptr_ioctl() Date: Tue, 30 Jul 2019 21:25:21 +0200 Message-Id: <20190730192552.4014288-11-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:oaGT+dgCZ7eW61FvI0TZ9DdaBUodVzKQE6fy+DvsydsjtaA9t5t YNnIgO4VmLAEqquIOxEvpgquoRzqJpizCxZLxmHRWNeM82CA74cvT8w4AqLlGT2jwBI2T41 9zXvcLKmuHlP0UV9NQfQRrVJ7XM9SRVtuvqO8+DHZpMZJB36p/mrh7jnkrETr//v+3RYnxW bcsdG1mf3FtsarekW2Dsw== X-UI-Out-Filterresults: notjunk:1;V03:K0:3P75hwXu32Y=:yg4yB85JnCIIeA3T5b7w+z 6edHtMRI89PheXd23dSpuey5gLS/R1d2ABuxzHKIwHjEhrFYDahUTXurS8tMXtubp9Y+EMfDa O/WyXfyNDKIqf+1SyfAkVR8qJpOg260mRzQBVSNoPb0pTO5f2rmRltb+tVDR0IRgtD0Hw7OwM 4THx1WA1mjP9gXRp1yTZ2agisqmmhMYrXZtpewerRiL3kPC75uSBfLxhhTz31JNtVVBsfENQn 7sO2iYl0U28Uw8YQkGSRw3sL+3YjRlQeE7tHjW+fg0vzVfSnBGWlcXgfGGqL0vn8MzJTd3c+x l18NehHDl1xDZE3+eOLtPwyEsFh7cGk/pa/kiK2DzsoasnRo3hT9pEf00MyfVBmXVroK+UHzQ phV2wnJdmv+VaCew4+UB3umKmMbcZtVy989/CFjTXeYT+f8aAbQLPA+rRm9YpeXd211906qvS rNkFoRMRsZWqMGiT5I4+R8/30DHI+W9683aWBb95oXm0iVkBv0O3NqhMiPUaanDOnKhshNiWj LflYrLMjDaVuVCUOOqXd/hRL5g5op6Q/nAUbLYwZix7XTce480XJZlCuhAwTRpR/RIkjtWOee TN2PQ1PYgH7mm53aF6Fk+ske/686btFFgeJhPKueLW7L4vse0dey3vesME7UrbK7yy6ArTSjC gOj3z4V1pI1J6Pho3O8VSXxSOKI82ota2xMpDjOr4Y4SmEmkZ445sUuQEv/gdQrrvYSxTz9zz sNiXQB23GT/IK2Y1LyUUyZHHE1gCwquDBjZFkw== 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 Many drivers have ioctl() handlers that are completely compatible between 32-bit and 64-bit architectures, except for the argument that is passed down from user space and may have to be passed through compat_ptr() in order to become a valid 64-bit pointer. Using ".compat_ptr = compat_ptr_ioctl" in file operations should let us simplify a lot of those drivers to avoid #ifdef checks, and convert additional drivers that don't have proper compat handling yet. On most architectures, the compat_ptr_ioctl() just passes all arguments to the corresponding ->ioctl handler. The exception is arch/s390, where compat_ptr() clears the top bit of a 32-bit pointer value, so user space pointers to the second 2GB alias the first 2GB, as is the case for native 32-bit s390 user space. The compat_ptr_ioctl() function must therefore be used only with ioctl functions that either ignore the argument or pass a pointer to a compatible data type. If any ioctl command handled by fops->unlocked_ioctl passes a plain integer instead of a pointer, or any of the passed data types is incompatible between 32-bit and 64-bit architectures, a proper handler is required instead of compat_ptr_ioctl. Signed-off-by: Arnd Bergmann --- v3: add a better description v2: use compat_ptr_ioctl instead of generic_compat_ioctl_ptrarg, as suggested by Al Viro --- fs/ioctl.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/fs.h | 7 +++++++ 2 files changed, 42 insertions(+) diff --git a/fs/ioctl.c b/fs/ioctl.c index 9d26251f34a9..812061ba667a 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -748,3 +749,37 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) { return ksys_ioctl(fd, cmd, arg); } + +#ifdef CONFIG_COMPAT +/** + * compat_ptr_ioctl - generic implementation of .compat_ioctl file operation + * + * This is not normally called as a function, but instead set in struct + * file_operations as + * + * .compat_ioctl = compat_ptr_ioctl, + * + * On most architectures, the compat_ptr_ioctl() just passes all arguments + * to the corresponding ->ioctl handler. The exception is arch/s390, where + * compat_ptr() clears the top bit of a 32-bit pointer value, so user space + * pointers to the second 2GB alias the first 2GB, as is the case for + * native 32-bit s390 user space. + * + * The compat_ptr_ioctl() function must therefore be used only with ioctl + * functions that either ignore the argument or pass a pointer to a + * compatible data type. + * + * If any ioctl command handled by fops->unlocked_ioctl passes a plain + * integer instead of a pointer, or any of the passed data types + * is incompatible between 32-bit and 64-bit architectures, a proper + * handler is required instead of compat_ptr_ioctl. + */ +long compat_ptr_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + if (!file->f_op->unlocked_ioctl) + return -ENOIOCTLCMD; + + return file->f_op->unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +EXPORT_SYMBOL(compat_ptr_ioctl); +#endif diff --git a/include/linux/fs.h b/include/linux/fs.h index 56b8e358af5c..07b032e58032 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1702,6 +1702,13 @@ int vfs_mkobj(struct dentry *, umode_t, extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); +#ifdef CONFIG_COMPAT +extern long compat_ptr_ioctl(struct file *file, unsigned int cmd, + unsigned long arg); +#else +#define compat_ptr_ioctl NULL +#endif + /* * VFS file helper functions. */ From patchwork Tue Jul 30 19:25:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066683 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 37F28746 for ; Tue, 30 Jul 2019 19:30:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D8F5285C6 for ; Tue, 30 Jul 2019 19:30:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2195028899; Tue, 30 Jul 2019 19:30:30 +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 21B842675C for ; Tue, 30 Jul 2019 19:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729502AbfG3TaY (ORCPT ); Tue, 30 Jul 2019 15:30:24 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:42825 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728677AbfG3TaY (ORCPT ); Tue, 30 Jul 2019 15:30:24 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MWRmF-1hrFJ01JoR-00XqWy; Tue, 30 Jul 2019 21:30:13 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Alexandre Belloni , Alessandro Zummo , linux-rtc@vger.kernel.org Subject: [PATCH v5 11/29] compat_ioctl: move rtc handling into rtc-dev.c Date: Tue, 30 Jul 2019 21:25:22 +0200 Message-Id: <20190730192552.4014288-12-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:d77hhp7zdr4Mxs5LfGspS4fJC4TxkPxLEyr8Cil+VykRxcBWuTW TiEV+ZkGDDQjN0eoeWNQV26oetW73nZ4k3h3cVQzL/M/iXYnRSfMqp9psj6cxuymYTjhLLb 9YAY7/KCdTBbqfqq6Bx8KNShnXiAO7Gzq1WXYfL+hRnn9TRxBykqB/3+3PjtA00bEYtRLUB sgUfMymRqN8lscNz+nlFQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:tSkF7sAe+LU=:vRuTXpfzW/j8Qg+dzfheV4 bIlPu+VH0r8m6RUEVhfz/nXcQsVBAgm160eMMva+w7wVHDwPGF1JUKU5sBYr9alb0WxD0JUV8 xqcuKCmDsv3aGA56XK3RfQhW0ejPHlXjM7TFGLPVr86x3hQzkU99RQHBUdYISiURQfX0UGi7V ySIMjKd+afIgYEKzr17aexN8R0tRin4H2p0kft5sY2fy6hWlJhLO3fC5XEbKyhBnfRE18UBRT iyvqtjOHerPeGgCgqYb4hTHhQ4V5VGoVCZUjsLAxEpFMkcYyWlo6YKtf8NzGg71cLn0oAGSYA YdSkhEAWljo1PZJwYf9/xVQOi9Ls6GdxjFP8bufYXpkxHgKw6fmMowoOE2HlbF+YDB8TZYfZ8 AJCl7wn77OG4THdJFWXNWNvezvAge/svcj9eU7TJJXTYNX8HF8ntBptqxiryqcSgUWh6JtnBB OZx6WoQ63DnGCIYCqiicY+39IKarm3BlpBNet1hquGMPnUMPeqHy3sNiWzIqOHBBZio7jgAWE H5FCwa58jex9tcLZdZ8BgeZDwBIPF3gFUnUNbZ1rfRfB4grTL7L023KXkXR4iqU4KgkVZI1Wf B+Tu/lLe1XzTXpCIdQVughIr7S2ciDTYU0sZ0LaGPlyJHztUzW4wIj38QddKTZ/H7ZBrZQCHP scbeSalR/CZ9FxVE4WzxsjCeuHMaprxbgfG8l9k3NmjP8Oh312ztnOZBL+mfBIb2UCffYqfgh 6XflRZyIVeM6sM1TuS3O0mwnP3+/dllSZm89uw== 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 We no longer need the rtc compat handling to be in common code, now that all drivers are either moved to the rtc-class framework, or (rarely) exist in drivers/char for architectures without compat mode (m68k, alpha and ia64, respectively). I checked the list of ioctl commands in drivers, and the ones that are not already handled are all compatible, again with the one exception of m68k driver, which implements RTC_PLL_GET and RTC_PLL_SET, but has no compat mode. Since the ioctl commands are either compatible or differ in both structure and command code between 32-bit and 64-bit, we can merge the compat handler into the native one and just implement the two common compat commands (RTC_IRQP_READ, RTC_IRQP_SET) there. The result is a slight change in behavior, as a native 64-bit process will now also handle the 32-bit commands (RTC_IRQP_SET32/RTC_IRQP_SET). The old conversion handler also deals with RTC_EPOCH_READ and RTC_EPOCH_SET, which are not handled in rtc-dev.c but only in a single device driver (rtc-vr41xx), so I'm adding the compat version in the same place. I don't expect other drivers to need those commands in the future. Acked-by: Alexandre Belloni Signed-off-by: Arnd Bergmann --- v2: merge compat handler into ioctl function to avoid the compat_alloc_user_space() roundtrip, based on feedback from Al Viro. --- drivers/rtc/dev.c | 13 +++++++++- drivers/rtc/rtc-vr41xx.c | 10 ++++++++ fs/compat_ioctl.c | 53 ---------------------------------------- 3 files changed, 22 insertions(+), 54 deletions(-) diff --git a/drivers/rtc/dev.c b/drivers/rtc/dev.c index 84feb2565abd..1dc5063f78c9 100644 --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -357,10 +358,19 @@ static long rtc_dev_ioctl(struct file *file, mutex_unlock(&rtc->ops_lock); return rtc_update_irq_enable(rtc, 0); +#ifdef CONFIG_64BIT +#define RTC_IRQP_SET32 _IOW('p', 0x0c, __u32) +#define RTC_IRQP_READ32 _IOR('p', 0x0b, __u32) + case RTC_IRQP_SET32: + err = rtc_irq_set_freq(rtc, arg); + break; + case RTC_IRQP_READ32: + err = put_user(rtc->irq_freq, (unsigned int __user *)uarg); + break; +#endif case RTC_IRQP_SET: err = rtc_irq_set_freq(rtc, arg); break; - case RTC_IRQP_READ: err = put_user(rtc->irq_freq, (unsigned long __user *)uarg); break; @@ -434,6 +444,7 @@ static const struct file_operations rtc_dev_fops = { .read = rtc_dev_read, .poll = rtc_dev_poll, .unlocked_ioctl = rtc_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = rtc_dev_open, .release = rtc_dev_release, .fasync = rtc_dev_fasync, diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index c75230562c0d..79f27de545af 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c @@ -4,6 +4,7 @@ * * Copyright (C) 2003-2008 Yoichi Yuasa */ +#include #include #include #include @@ -66,6 +67,10 @@ static void __iomem *rtc2_base; #define rtc2_read(offset) readw(rtc2_base + (offset)) #define rtc2_write(offset, value) writew((value), rtc2_base + (offset)) +/* 32-bit compat for ioctls that nobody else uses */ +#define RTC_EPOCH_READ32 _IOR('p', 0x0d, __u32) +#define RTC_EPOCH_SET32 _IOW('p', 0x0e, __u32) + static unsigned long epoch = 1970; /* Jan 1 1970 00:00:00 */ static DEFINE_SPINLOCK(rtc_lock); @@ -179,6 +184,11 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long switch (cmd) { case RTC_EPOCH_READ: return put_user(epoch, (unsigned long __user *)arg); +#ifdef CONFIG_64BIT + case RTC_EPOCH_READ32: + return put_user(epoch, (unsigned int __user *)arg); + case RTC_EPOCH_SET32: +#endif case RTC_EPOCH_SET: /* Doesn't support before 1900 */ if (arg < 1900) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index cec3ec0a1727..47da220f95b1 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -436,37 +435,6 @@ static int mt_ioctl_trans(struct file *file, #define HCIUARTSETFLAGS _IOW('U', 203, int) #define HCIUARTGETFLAGS _IOR('U', 204, int) -#define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) -#define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) -#define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) -#define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) - -static int rtc_ioctl(struct file *file, - unsigned cmd, void __user *argp) -{ - unsigned long __user *valp = compat_alloc_user_space(sizeof(*valp)); - int ret; - - if (valp == NULL) - return -EFAULT; - switch (cmd) { - case RTC_IRQP_READ32: - case RTC_EPOCH_READ32: - ret = do_ioctl(file, (cmd == RTC_IRQP_READ32) ? - RTC_IRQP_READ : RTC_EPOCH_READ, - (unsigned long)valp); - if (ret) - return ret; - return convert_in_user(valp, (unsigned int __user *)argp); - case RTC_IRQP_SET32: - return do_ioctl(file, RTC_IRQP_SET, (unsigned long)argp); - case RTC_EPOCH_SET32: - return do_ioctl(file, RTC_EPOCH_SET, (unsigned long)argp); - } - - return -ENOIOCTLCMD; -} - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -503,21 +471,6 @@ COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI) /* Big V (don't complain on serial console) */ IGNORE_IOCTL(VT_OPENQRY) IGNORE_IOCTL(VT_GETMODE) -/* Little p (/dev/rtc, /dev/envctrl, etc.) */ -COMPATIBLE_IOCTL(RTC_AIE_ON) -COMPATIBLE_IOCTL(RTC_AIE_OFF) -COMPATIBLE_IOCTL(RTC_UIE_ON) -COMPATIBLE_IOCTL(RTC_UIE_OFF) -COMPATIBLE_IOCTL(RTC_PIE_ON) -COMPATIBLE_IOCTL(RTC_PIE_OFF) -COMPATIBLE_IOCTL(RTC_WIE_ON) -COMPATIBLE_IOCTL(RTC_WIE_OFF) -COMPATIBLE_IOCTL(RTC_ALM_SET) -COMPATIBLE_IOCTL(RTC_ALM_READ) -COMPATIBLE_IOCTL(RTC_RD_TIME) -COMPATIBLE_IOCTL(RTC_SET_TIME) -COMPATIBLE_IOCTL(RTC_WKALM_SET) -COMPATIBLE_IOCTL(RTC_WKALM_RD) /* * These two are only for the sbus rtc driver, but * hwclock tries them on every rtc device first when @@ -897,12 +850,6 @@ static long do_ioctl_trans(unsigned int cmd, case MTIOCPOS32: return mt_ioctl_trans(file, cmd, argp); #endif - /* Not implemented in the native kernel */ - case RTC_IRQP_READ32: - case RTC_IRQP_SET32: - case RTC_EPOCH_READ32: - case RTC_EPOCH_SET32: - return rtc_ioctl(file, cmd, argp); } /* From patchwork Tue Jul 30 19:50:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066719 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 7300713A0 for ; Tue, 30 Jul 2019 19:53:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6717428647 for ; Tue, 30 Jul 2019 19:53:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AB2D288A2; Tue, 30 Jul 2019 19:53:18 +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 1F8EF288B9 for ; Tue, 30 Jul 2019 19:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbfG3TxH (ORCPT ); Tue, 30 Jul 2019 15:53:07 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:52963 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725209AbfG3TxH (ORCPT ); Tue, 30 Jul 2019 15:53:07 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M2ep5-1hwguM3SiF-004Dqv; Tue, 30 Jul 2019 21:52:33 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jarkko Sakkinen , Jason Gunthorpe , Jiri Kosina , Stefan Hajnoczi , linux-integrity@vger.kernel.org, linux1394-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, devel@driverdev.osuosl.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, ceph-devel@vger.kernel.org Subject: [PATCH v5 12/29] compat_ioctl: move drivers to compat_ptr_ioctl Date: Tue, 30 Jul 2019 21:50:28 +0200 Message-Id: <20190730195227.742215-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:f4kyacZkBh7d2L8DvfG/VWglDWmV1r6PyMvHlDfoj4C7ggclB67 iYy8MoHZ4ZjuI6LNLyJEN3yiNqmQw5XpLccLKCY831oDCsExHVnyRsQw8RhuXBWAupdrWGU 2uujPAjsUE4qQ22u48yyaIJueGs1R4h2CIxPvTzi5pGqdRk3Jl1MaQfXUJiC/aGxUwrOT6G Ape/7iXHD3yCgh14Z37RA== X-UI-Out-Filterresults: notjunk:1;V03:K0:O3QlaSg0p94=:2DC89ChFTfzqSY3IIwQ7UN xd3l5T4yi05idZGMcAom12BDjEwRndOWlluV3dv9kwnrIlv6FXxgCAuZpK+r6w6IQ8DJ+hd/w eNe2JmIEZ0O947bREIbVnghXzoDsNhb/k4GhdagSKBJMuiKSx6FvgiCloXsk+MwE9wIF8Mi8t OaiDAO5is7ZrdpajoFOJwfkd/HGzdP/XXH0zGWsGIpATl1gEHU2U0R8/o5JwK/BiMH4N/hpi9 6Pj6G5XUeVMuuAVNYoIMUwa4DTtFhMb0zdxPoAqLkvrC0cOcVK5kDtyzLkXHb19krCEnxSvH9 xSAisf/onUmQT/aR/R2k7HCF5D8v8yqpvJgY8KCvRKjjNdq/Kehh1Ev6C68pyOXzG96g7wos6 m8eLeJowf0dLdiTflRagoHdVMRg/jBLl0ARN0j0/nXPtR+IjdkjADW7zvFhLYkXqZkbL5DGhY tH7TvoRuR3rY4Q072FzD+A+IfBe+cg9OzyaQLv7A47rkwZZlyIXqh5fQBWBCOINljdNv17lpE Osp7k4bcfZGhUKqYJjtxf9uvbBwIv1Yi7fZP4oPbCp6V98KGd8KP6Pg34UbofokiwizyBakGd F9QmeKEOX806mM2gvmP5CExg1+AicT9AOnlvsd+AmokRI3klpronJMiCiYfxMqcru9NgTaX5q ZAj1xkW+A+XM9qrwKrEzGxwWmAk9LM/hcMi2xrgFVqwXsrbQdASKOLuLxgrfEYaJwdL3zbVNf V8Futwfot9Yamgna+5pt17t5UNBev1eV66UBeg== 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 Each of these drivers has a copy of the same trivial helper function to convert the pointer argument and then call the native ioctl handler. We now have a generic implementation of that, so use it. Acked-by: Greg Kroah-Hartman Acked-by: Michael S. Tsirkin Reviewed-by: Jarkko Sakkinen Reviewed-by: Jason Gunthorpe Reviewed-by: Jiri Kosina Reviewed-by: Stefan Hajnoczi Signed-off-by: Arnd Bergmann Acked-by: David S. Miller Reviewed-by: Cornelia Huck --- drivers/char/ppdev.c | 12 +--------- drivers/char/tpm/tpm_vtpm_proxy.c | 12 +--------- drivers/firewire/core-cdev.c | 12 +--------- drivers/hid/usbhid/hiddev.c | 11 +-------- drivers/hwtracing/stm/core.c | 12 +--------- drivers/misc/mei/main.c | 22 +---------------- drivers/mtd/ubi/cdev.c | 36 +++------------------------- drivers/net/tap.c | 12 +--------- drivers/staging/pi433/pi433_if.c | 12 +--------- drivers/usb/core/devio.c | 16 +------------ drivers/vfio/vfio.c | 39 +++---------------------------- drivers/vhost/net.c | 12 +--------- drivers/vhost/scsi.c | 12 +--------- drivers/vhost/test.c | 12 +--------- drivers/vhost/vsock.c | 12 +--------- fs/ceph/dir.c | 2 +- fs/ceph/file.c | 2 +- fs/ceph/super.h | 9 ------- fs/fat/file.c | 13 +---------- 19 files changed, 22 insertions(+), 248 deletions(-) diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index f0a8adca1eee..c4d5cc4a1d3e 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -670,14 +670,6 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } -#ifdef CONFIG_COMPAT -static long pp_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static int pp_open(struct inode *inode, struct file *file) { unsigned int minor = iminor(inode); @@ -786,9 +778,7 @@ static const struct file_operations pp_fops = { .write = pp_write, .poll = pp_poll, .unlocked_ioctl = pp_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = pp_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = pp_open, .release = pp_release, }; diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c index 2f6e087ec496..91c772e38bb5 100644 --- a/drivers/char/tpm/tpm_vtpm_proxy.c +++ b/drivers/char/tpm/tpm_vtpm_proxy.c @@ -670,20 +670,10 @@ static long vtpmx_fops_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vtpmx_fops_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vtpmx_fops_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vtpmx_fops = { .owner = THIS_MODULE, .unlocked_ioctl = vtpmx_fops_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vtpmx_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 1da7ba18d399..c777088f5828 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1646,14 +1646,6 @@ static long fw_device_op_ioctl(struct file *file, return dispatch_ioctl(file->private_data, cmd, (void __user *)arg); } -#ifdef CONFIG_COMPAT -static long fw_device_op_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - return dispatch_ioctl(file->private_data, cmd, compat_ptr(arg)); -} -#endif - static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) { struct client *client = file->private_data; @@ -1795,7 +1787,5 @@ const struct file_operations fw_device_ops = { .mmap = fw_device_op_mmap, .release = fw_device_op_release, .poll = fw_device_op_poll, -#ifdef CONFIG_COMPAT - .compat_ioctl = fw_device_op_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 55b72573066b..70009bd76ac1 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -842,13 +842,6 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return r; } -#ifdef CONFIG_COMPAT -static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - return hiddev_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations hiddev_fops = { .owner = THIS_MODULE, .read = hiddev_read, @@ -858,9 +851,7 @@ static const struct file_operations hiddev_fops = { .release = hiddev_release, .unlocked_ioctl = hiddev_ioctl, .fasync = hiddev_fasync, -#ifdef CONFIG_COMPAT - .compat_ioctl = hiddev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index e55b902560de..0fbc994900fd 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -839,23 +839,13 @@ stm_char_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return err; } -#ifdef CONFIG_COMPAT -static long -stm_char_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - return stm_char_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#else -#define stm_char_compat_ioctl NULL -#endif - static const struct file_operations stm_fops = { .open = stm_char_open, .release = stm_char_release, .write = stm_char_write, .mmap = stm_char_mmap, .unlocked_ioctl = stm_char_ioctl, - .compat_ioctl = stm_char_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = no_llseek, }; diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index f894d1f8a53e..4ea7feb4ec2d 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -532,24 +532,6 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) return rets; } -/** - * mei_compat_ioctl - the compat IOCTL function - * - * @file: pointer to file structure - * @cmd: ioctl command - * @data: pointer to mei message structure - * - * Return: 0 on success , <0 on error - */ -#ifdef CONFIG_COMPAT -static long mei_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long data) -{ - return mei_ioctl(file, cmd, (unsigned long)compat_ptr(data)); -} -#endif - - /** * mei_poll - the poll function * @@ -905,9 +887,7 @@ static const struct file_operations mei_fops = { .owner = THIS_MODULE, .read = mei_read, .unlocked_ioctl = mei_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = mei_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = mei_open, .release = mei_release, .write = mei_write, diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 1b77fff9f892..cc9a28cf9d82 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -1078,36 +1078,6 @@ static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd, return err; } -#ifdef CONFIG_COMPAT -static long vol_cdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - unsigned long translated_arg = (unsigned long)compat_ptr(arg); - - return vol_cdev_ioctl(file, cmd, translated_arg); -} - -static long ubi_cdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - unsigned long translated_arg = (unsigned long)compat_ptr(arg); - - return ubi_cdev_ioctl(file, cmd, translated_arg); -} - -static long ctrl_cdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - unsigned long translated_arg = (unsigned long)compat_ptr(arg); - - return ctrl_cdev_ioctl(file, cmd, translated_arg); -} -#else -#define vol_cdev_compat_ioctl NULL -#define ubi_cdev_compat_ioctl NULL -#define ctrl_cdev_compat_ioctl NULL -#endif - /* UBI volume character device operations */ const struct file_operations ubi_vol_cdev_operations = { .owner = THIS_MODULE, @@ -1118,7 +1088,7 @@ const struct file_operations ubi_vol_cdev_operations = { .write = vol_cdev_write, .fsync = vol_cdev_fsync, .unlocked_ioctl = vol_cdev_ioctl, - .compat_ioctl = vol_cdev_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; /* UBI character device operations */ @@ -1126,13 +1096,13 @@ const struct file_operations ubi_cdev_operations = { .owner = THIS_MODULE, .llseek = no_llseek, .unlocked_ioctl = ubi_cdev_ioctl, - .compat_ioctl = ubi_cdev_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; /* UBI control character device operations */ const struct file_operations ubi_ctrl_cdev_operations = { .owner = THIS_MODULE, .unlocked_ioctl = ctrl_cdev_ioctl, - .compat_ioctl = ctrl_cdev_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = no_llseek, }; diff --git a/drivers/net/tap.c b/drivers/net/tap.c index dd614c2cd994..bcdfb0d88753 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -1123,14 +1123,6 @@ static long tap_ioctl(struct file *file, unsigned int cmd, } } -#ifdef CONFIG_COMPAT -static long tap_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return tap_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations tap_fops = { .owner = THIS_MODULE, .open = tap_open, @@ -1140,9 +1132,7 @@ static const struct file_operations tap_fops = { .poll = tap_poll, .llseek = no_llseek, .unlocked_ioctl = tap_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = tap_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 40c6f4e7632f..313d22f6210f 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -928,16 +928,6 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) return 0; } -#ifdef CONFIG_COMPAT -static long -pi433_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - return pi433_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); -} -#else -#define pi433_compat_ioctl NULL -#endif /* CONFIG_COMPAT */ - /*-------------------------------------------------------------------------*/ static int pi433_open(struct inode *inode, struct file *filp) @@ -1094,7 +1084,7 @@ static const struct file_operations pi433_fops = { .write = pi433_write, .read = pi433_read, .unlocked_ioctl = pi433_ioctl, - .compat_ioctl = pi433_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = pi433_open, .release = pi433_release, .llseek = no_llseek, diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index b265ab5405f9..efea6cff66d4 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -2604,18 +2604,6 @@ static long usbdev_ioctl(struct file *file, unsigned int cmd, return ret; } -#ifdef CONFIG_COMPAT -static long usbdev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int ret; - - ret = usbdev_do_ioctl(file, cmd, compat_ptr(arg)); - - return ret; -} -#endif - /* No kernel lock - fine */ static __poll_t usbdev_poll(struct file *file, struct poll_table_struct *wait) @@ -2639,9 +2627,7 @@ const struct file_operations usbdev_file_operations = { .read = usbdev_read, .poll = usbdev_poll, .unlocked_ioctl = usbdev_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = usbdev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .mmap = usbdev_mmap, .open = usbdev_open, .release = usbdev_release, diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 388597930b64..c8482624ca34 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -1184,15 +1184,6 @@ static long vfio_fops_unl_ioctl(struct file *filep, return ret; } -#ifdef CONFIG_COMPAT -static long vfio_fops_compat_ioctl(struct file *filep, - unsigned int cmd, unsigned long arg) -{ - arg = (unsigned long)compat_ptr(arg); - return vfio_fops_unl_ioctl(filep, cmd, arg); -} -#endif /* CONFIG_COMPAT */ - static int vfio_fops_open(struct inode *inode, struct file *filep) { struct vfio_container *container; @@ -1275,9 +1266,7 @@ static const struct file_operations vfio_fops = { .read = vfio_fops_read, .write = vfio_fops_write, .unlocked_ioctl = vfio_fops_unl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vfio_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .mmap = vfio_fops_mmap, }; @@ -1556,15 +1545,6 @@ static long vfio_group_fops_unl_ioctl(struct file *filep, return ret; } -#ifdef CONFIG_COMPAT -static long vfio_group_fops_compat_ioctl(struct file *filep, - unsigned int cmd, unsigned long arg) -{ - arg = (unsigned long)compat_ptr(arg); - return vfio_group_fops_unl_ioctl(filep, cmd, arg); -} -#endif /* CONFIG_COMPAT */ - static int vfio_group_fops_open(struct inode *inode, struct file *filep) { struct vfio_group *group; @@ -1620,9 +1600,7 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep) static const struct file_operations vfio_group_fops = { .owner = THIS_MODULE, .unlocked_ioctl = vfio_group_fops_unl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vfio_group_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vfio_group_fops_open, .release = vfio_group_fops_release, }; @@ -1687,24 +1665,13 @@ static int vfio_device_fops_mmap(struct file *filep, struct vm_area_struct *vma) return device->ops->mmap(device->device_data, vma); } -#ifdef CONFIG_COMPAT -static long vfio_device_fops_compat_ioctl(struct file *filep, - unsigned int cmd, unsigned long arg) -{ - arg = (unsigned long)compat_ptr(arg); - return vfio_device_fops_unl_ioctl(filep, cmd, arg); -} -#endif /* CONFIG_COMPAT */ - static const struct file_operations vfio_device_fops = { .owner = THIS_MODULE, .release = vfio_device_fops_release, .read = vfio_device_fops_read, .write = vfio_device_fops_write, .unlocked_ioctl = vfio_device_fops_unl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vfio_device_fops_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .mmap = vfio_device_fops_mmap, }; diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1a2dd53caade..e158159671fa 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1751,14 +1751,6 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vhost_net_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_net_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static ssize_t vhost_net_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb->ki_filp; @@ -1794,9 +1786,7 @@ static const struct file_operations vhost_net_fops = { .write_iter = vhost_net_chr_write_iter, .poll = vhost_net_chr_poll, .unlocked_ioctl = vhost_net_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_net_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vhost_net_open, .llseek = noop_llseek, }; diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index a9caf1bc3c3e..0b949a14bce3 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -1727,21 +1727,11 @@ vhost_scsi_ioctl(struct file *f, } } -#ifdef CONFIG_COMPAT -static long vhost_scsi_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_scsi_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vhost_scsi_fops = { .owner = THIS_MODULE, .release = vhost_scsi_release, .unlocked_ioctl = vhost_scsi_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_scsi_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vhost_scsi_open, .llseek = noop_llseek, }; diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index 9e90e969af55..71954077df69 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -297,21 +297,11 @@ static long vhost_test_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vhost_test_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_test_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vhost_test_fops = { .owner = THIS_MODULE, .release = vhost_test_release, .unlocked_ioctl = vhost_test_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_test_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = vhost_test_open, .llseek = noop_llseek, }; diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 6a50e1d0529c..69c0350f622e 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -729,23 +729,13 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl, } } -#ifdef CONFIG_COMPAT -static long vhost_vsock_dev_compat_ioctl(struct file *f, unsigned int ioctl, - unsigned long arg) -{ - return vhost_vsock_dev_ioctl(f, ioctl, (unsigned long)compat_ptr(arg)); -} -#endif - static const struct file_operations vhost_vsock_fops = { .owner = THIS_MODULE, .open = vhost_vsock_dev_open, .release = vhost_vsock_dev_release, .llseek = noop_llseek, .unlocked_ioctl = vhost_vsock_dev_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = vhost_vsock_dev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice vhost_vsock_misc = { diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 401c17d36b71..811f45badc10 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1808,7 +1808,7 @@ const struct file_operations ceph_dir_fops = { .open = ceph_open, .release = ceph_release, .unlocked_ioctl = ceph_ioctl, - .compat_ioctl = ceph_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .fsync = ceph_fsync, .lock = ceph_lock, .flock = ceph_flock, diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 99712b6b1ad5..676e5aed7a58 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -2138,7 +2138,7 @@ const struct file_operations ceph_file_fops = { .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, .unlocked_ioctl = ceph_ioctl, - .compat_ioctl = ceph_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .fallocate = ceph_fallocate, .copy_file_range = ceph_copy_file_range, }; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 0aebccd48fa0..f7945e16ee09 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1109,15 +1109,6 @@ extern void ceph_readdir_cache_release(struct ceph_readdir_cache_control *ctl); /* ioctl.c */ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -static inline long -ceph_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ -#ifdef CONFIG_COMPAT - return ceph_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); -#else - return -ENOTTY; -#endif -} /* export.c */ extern const struct export_operations ceph_export_ops; diff --git a/fs/fat/file.c b/fs/fat/file.c index 4614c0ba5f1c..bdc4503c00a3 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c @@ -172,15 +172,6 @@ long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } } -#ifdef CONFIG_COMPAT -static long fat_generic_compat_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) - -{ - return fat_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); -} -#endif - static int fat_file_release(struct inode *inode, struct file *filp) { if ((filp->f_mode & FMODE_WRITE) && @@ -215,9 +206,7 @@ const struct file_operations fat_file_operations = { .mmap = generic_file_mmap, .release = fat_file_release, .unlocked_ioctl = fat_generic_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = fat_generic_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .fsync = fat_file_fsync, .splice_read = generic_file_splice_read, .splice_write = iter_file_splice_write, From patchwork Tue Jul 30 19:55:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066747 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 3A527746 for ; Tue, 30 Jul 2019 19:59:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B9B228870 for ; Tue, 30 Jul 2019 19:59:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EB2D288B8; Tue, 30 Jul 2019 19:59:57 +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 6479128870 for ; Tue, 30 Jul 2019 19:59:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbfG3T7g (ORCPT ); Tue, 30 Jul 2019 15:59:36 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:50821 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726438AbfG3T7f (ORCPT ); Tue, 30 Jul 2019 15:59:35 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MlNYj-1idxpR0fT3-00lq2h; Tue, 30 Jul 2019 21:58:28 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Jason Gunthorpe , Daniel Vetter , Mauro Carvalho Chehab , Greg Kroah-Hartman , David Sterba , Darren Hart , Jonathan Cameron , Bjorn Andersson , qat-linux@intel.com, linux-crypto@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org, sparclinux@vger.kernel.org, linux-scsi@vger.kernel.org, tee-dev@lists.linaro.org, linux-usb@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 13/29] compat_ioctl: move more drivers to compat_ptr_ioctl Date: Tue, 30 Jul 2019 21:55:29 +0200 Message-Id: <20190730195819.901457-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:KQUqUqBgZXK84qipVJwaeqta//BlZhUjlVWQ5Gx//kuw9hhHom8 X+1H8bc6fzWCwnWDRAE4IJ3pqdqmFI3hhOZFIpQFMbg9gyruWUhxE6KFC+H52nGdYOCuJgE FKLOChgo9hQtnYOaprg+VGYMmTiFvwkWA5fW1ZGm6hb16OHoOzesgwVKD/9dMT+ax04tubE etPGFMERNQ4wf+OqoWwIQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:paNFdAJVA1A=:nLjMCmfOZGXU5MF7JvwZU6 Nnqyunyf4/CyR9xuZwFf7zvbqFyHrkVgk1Akfs/OQ1g/iRTHv74b3NA0DnQryIdxTjbxXXtaL iRvHpoipq3Rm3k2yHEbuaVPYNzOOr2SN6k7riGfXVCOfflpilpv/1wU7i41xt+RVozeL5g9Sg 1OBjQUkPWbIGhIah3rsbiFVQnCzg6GDHuG1ksrEcDAzmegRVmW5zLaahJIPiZVviqdDwvhDpn 1sG3LaPmgNeA3TjSpVtTnePeaWcHnEn3bB+WH9D039hb4gBkR4hG4FyycnlXQR9S7Z8uW+fTc mtlIwaDMS33l7jW3K3CptcsT8cswSkKYZfrXlW4ZNq35+/VvXKKozJswZ76X3sTpnTKYaTndl U0iyypM3IywuwkVuV86/BmjG5VxoA58l/8DmU1U9VVcsDqUZcPn0dm4rg+PL4alFr5Bz8E4Ag WayuofUXsUWjjEh32+lIjnSsGuNuJlEXGbYIRKCHEN/g/k5avBCvaP/bqyHsvFd37nLRmxn1v X5xxVl7LjzK+qiIK1CCMbYqDwZkQ6PZAGmzWi+KBdIAerncTu8BI+m26N54CJoXm95j86kbQ7 wUoOj/9Fp/j4w1cwarz103GZ43NE1WoeGcwlEQetDcpqNq3xoimerHYq2Md3HhIILTtaViFY4 br5IvxSQMOuW3BQbqWgEWIILZQxRCp2AsfF5cqqpUFIpZknFefc50+GU8Hs8L2daqPUMWNuKW S9jKx+nC+h5UXPwXazQBr06LHtMv0/cW6nxI9g== 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 .ioctl and .compat_ioctl file operations have the same prototype so they can both point to the same function, which works great almost all the time when all the commands are compatible. One exception is the s390 architecture, where a compat pointer is only 31 bit wide, and converting it into a 64-bit pointer requires calling compat_ptr(). Most drivers here will never run in s390, but since we now have a generic helper for it, it's easy enough to use it consistently. I double-checked all these drivers to ensure that all ioctl arguments are used as pointers or are ignored, but are not interpreted as integer values. Acked-by: Jason Gunthorpe Acked-by: Daniel Vetter Acked-by: Mauro Carvalho Chehab Acked-by: Greg Kroah-Hartman Acked-by: David Sterba Acked-by: Darren Hart (VMware) Acked-by: Jonathan Cameron Acked-by: Bjorn Andersson Signed-off-by: Arnd Bergmann Acked-by: Dan Williams --- drivers/android/binder.c | 2 +- drivers/crypto/qat/qat_common/adf_ctl_drv.c | 2 +- drivers/dma-buf/dma-buf.c | 4 +--- drivers/dma-buf/sw_sync.c | 2 +- drivers/dma-buf/sync_file.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- drivers/hid/hidraw.c | 4 +--- drivers/iio/industrialio-core.c | 2 +- drivers/infiniband/core/uverbs_main.c | 4 ++-- drivers/media/rc/lirc_dev.c | 4 +--- drivers/mfd/cros_ec_dev.c | 4 +--- drivers/misc/vmw_vmci/vmci_host.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvme/host/core.c | 2 +- drivers/pci/switch/switchtec.c | 2 +- drivers/platform/x86/wmi.c | 2 +- drivers/rpmsg/rpmsg_char.c | 4 ++-- drivers/sbus/char/display7seg.c | 2 +- drivers/sbus/char/envctrl.c | 4 +--- drivers/scsi/3w-xxxx.c | 4 +--- drivers/scsi/cxlflash/main.c | 2 +- drivers/scsi/esas2r/esas2r_main.c | 2 +- drivers/scsi/pmcraid.c | 4 +--- drivers/staging/android/ion/ion.c | 4 +--- drivers/staging/vme/devices/vme_user.c | 2 +- drivers/tee/tee_core.c | 2 +- drivers/usb/class/cdc-wdm.c | 2 +- drivers/usb/class/usbtmc.c | 4 +--- drivers/virt/fsl_hypervisor.c | 2 +- fs/btrfs/super.c | 2 +- fs/fuse/dev.c | 2 +- fs/notify/fanotify/fanotify_user.c | 2 +- fs/userfaultfd.c | 2 +- net/rfkill/core.c | 2 +- 34 files changed, 37 insertions(+), 55 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index dc1c83eafc22..79955e82544a 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -6043,7 +6043,7 @@ const struct file_operations binder_fops = { .owner = THIS_MODULE, .poll = binder_poll, .unlocked_ioctl = binder_ioctl, - .compat_ioctl = binder_ioctl, + .compat_ioctl = compat_ptr_ioctl, .mmap = binder_mmap, .open = binder_open, .flush = binder_flush, diff --git a/drivers/crypto/qat/qat_common/adf_ctl_drv.c b/drivers/crypto/qat/qat_common/adf_ctl_drv.c index abc7a7f64d64..ef0e482ee04f 100644 --- a/drivers/crypto/qat/qat_common/adf_ctl_drv.c +++ b/drivers/crypto/qat/qat_common/adf_ctl_drv.c @@ -68,7 +68,7 @@ static long adf_ctl_ioctl(struct file *fp, unsigned int cmd, unsigned long arg); static const struct file_operations adf_ctl_ops = { .owner = THIS_MODULE, .unlocked_ioctl = adf_ctl_ioctl, - .compat_ioctl = adf_ctl_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; struct adf_ctl_drv_info { diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index f45bfb29ef96..f6d9047b7a69 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -415,9 +415,7 @@ static const struct file_operations dma_buf_fops = { .llseek = dma_buf_llseek, .poll = dma_buf_poll, .unlocked_ioctl = dma_buf_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = dma_buf_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .show_fdinfo = dma_buf_show_fdinfo, }; diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c index 051f6c2873c7..51026cb08801 100644 --- a/drivers/dma-buf/sw_sync.c +++ b/drivers/dma-buf/sw_sync.c @@ -410,5 +410,5 @@ const struct file_operations sw_sync_debugfs_fops = { .open = sw_sync_debugfs_open, .release = sw_sync_debugfs_release, .unlocked_ioctl = sw_sync_ioctl, - .compat_ioctl = sw_sync_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index ee4d1a96d779..85b96757fc76 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c @@ -480,5 +480,5 @@ static const struct file_operations sync_file_fops = { .release = sync_file_release, .poll = sync_file_poll, .unlocked_ioctl = sync_file_ioctl, - .compat_ioctl = sync_file_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 26b15cc56c31..ea933d2444bb 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -49,7 +49,7 @@ static const char kfd_dev_name[] = "kfd"; static const struct file_operations kfd_fops = { .owner = THIS_MODULE, .unlocked_ioctl = kfd_ioctl, - .compat_ioctl = kfd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = kfd_open, .mmap = kfd_mmap, }; diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 006bd6f4f653..923edc650f46 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -468,9 +468,7 @@ static const struct file_operations hidraw_ops = { .release = hidraw_release, .unlocked_ioctl = hidraw_ioctl, .fasync = hidraw_fasync, -#ifdef CONFIG_COMPAT - .compat_ioctl = hidraw_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 524a686077ca..9dd687534035 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1610,7 +1610,7 @@ static const struct file_operations iio_buffer_fileops = { .owner = THIS_MODULE, .llseek = noop_llseek, .unlocked_ioctl = iio_ioctl, - .compat_ioctl = iio_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static int iio_check_unique_scan_index(struct iio_dev *indio_dev) diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 11c13c1381cf..d6d2f6c0cd01 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c @@ -1135,7 +1135,7 @@ static const struct file_operations uverbs_fops = { .release = ib_uverbs_close, .llseek = no_llseek, .unlocked_ioctl = ib_uverbs_ioctl, - .compat_ioctl = ib_uverbs_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static const struct file_operations uverbs_mmap_fops = { @@ -1146,7 +1146,7 @@ static const struct file_operations uverbs_mmap_fops = { .release = ib_uverbs_close, .llseek = no_llseek, .unlocked_ioctl = ib_uverbs_ioctl, - .compat_ioctl = ib_uverbs_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static int ib_uverbs_get_nl_info(struct ib_device *ibdev, void *client_data, diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index f078f8a3aec8..9a8c1cf54ac4 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -720,9 +720,7 @@ static const struct file_operations lirc_fops = { .owner = THIS_MODULE, .write = ir_lirc_transmit_ir, .unlocked_ioctl = ir_lirc_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ir_lirc_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .read = ir_lirc_read, .poll = ir_lirc_poll, .open = ir_lirc_open, diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 41dccced5026..db1eefcd770b 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -239,9 +239,7 @@ static const struct file_operations fops = { .release = ec_device_release, .read = ec_device_read, .unlocked_ioctl = ec_device_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ec_device_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static void cros_ec_class_release(struct device *dev) diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c index 833e2bd248a5..903e321e8e87 100644 --- a/drivers/misc/vmw_vmci/vmci_host.c +++ b/drivers/misc/vmw_vmci/vmci_host.c @@ -961,7 +961,7 @@ static const struct file_operations vmuser_fops = { .release = vmci_host_close, .poll = vmci_host_poll, .unlocked_ioctl = vmci_host_unlocked_ioctl, - .compat_ioctl = vmci_host_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice vmci_host_miscdev = { diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 798c5c4aea9c..6ca142d833ab 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -1229,7 +1229,7 @@ static const struct file_operations nvdimm_bus_fops = { .owner = THIS_MODULE, .open = nd_open, .unlocked_ioctl = bus_ioctl, - .compat_ioctl = bus_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; @@ -1237,7 +1237,7 @@ static const struct file_operations nvdimm_fops = { .owner = THIS_MODULE, .open = nd_open, .unlocked_ioctl = dimm_ioctl, - .compat_ioctl = dimm_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8f3fbe5ca937..be07bd1f6654 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2813,7 +2813,7 @@ static const struct file_operations nvme_dev_fops = { .owner = THIS_MODULE, .open = nvme_dev_open, .unlocked_ioctl = nvme_dev_ioctl, - .compat_ioctl = nvme_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static ssize_t nvme_sysfs_reset(struct device *dev, diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index 8c94cd3fd1f2..66610f04d76d 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c @@ -1025,7 +1025,7 @@ static const struct file_operations switchtec_fops = { .read = switchtec_dev_read, .poll = switchtec_dev_poll, .unlocked_ioctl = switchtec_dev_ioctl, - .compat_ioctl = switchtec_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static void link_event_work(struct work_struct *work) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 784cea8572c2..d9a0dd94ee62 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -913,7 +913,7 @@ static const struct file_operations wmi_fops = { .read = wmi_char_read, .open = wmi_char_open, .unlocked_ioctl = wmi_ioctl, - .compat_ioctl = wmi_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static int wmi_dev_probe(struct device *dev) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index eea5ebbb5119..507bfe163883 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -290,7 +290,7 @@ static const struct file_operations rpmsg_eptdev_fops = { .write_iter = rpmsg_eptdev_write_iter, .poll = rpmsg_eptdev_poll, .unlocked_ioctl = rpmsg_eptdev_ioctl, - .compat_ioctl = rpmsg_eptdev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static ssize_t name_show(struct device *dev, struct device_attribute *attr, @@ -451,7 +451,7 @@ static const struct file_operations rpmsg_ctrldev_fops = { .open = rpmsg_ctrldev_open, .release = rpmsg_ctrldev_release, .unlocked_ioctl = rpmsg_ctrldev_ioctl, - .compat_ioctl = rpmsg_ctrldev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static void rpmsg_ctrldev_release_device(struct device *dev) diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 971fe074d7c9..fad936eb845f 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c @@ -156,7 +156,7 @@ static long d7s_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static const struct file_operations d7s_fops = { .owner = THIS_MODULE, .unlocked_ioctl = d7s_ioctl, - .compat_ioctl = d7s_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = d7s_open, .release = d7s_release, .llseek = noop_llseek, diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index a63d5e402ff2..12d66aa61ede 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c @@ -715,9 +715,7 @@ static const struct file_operations envctrl_fops = { .owner = THIS_MODULE, .read = envctrl_read, .unlocked_ioctl = envctrl_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = envctrl_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = envctrl_open, .release = envctrl_release, .llseek = noop_llseek, diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 2b1e0d503020..fb6444d0409c 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1049,9 +1049,7 @@ static int tw_chrdev_open(struct inode *inode, struct file *file) static const struct file_operations tw_fops = { .owner = THIS_MODULE, .unlocked_ioctl = tw_chrdev_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = tw_chrdev_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .open = tw_chrdev_open, .release = NULL, .llseek = noop_llseek, diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index b1f4724efde2..6927654792b0 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -3585,7 +3585,7 @@ static const struct file_operations cxlflash_chr_fops = { .owner = THIS_MODULE, .open = cxlflash_chr_open, .unlocked_ioctl = cxlflash_chr_ioctl, - .compat_ioctl = cxlflash_chr_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; /** diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index fdbda5c05aa0..80c5a235d193 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -613,7 +613,7 @@ static int __init esas2r_init(void) /* Handle ioctl calls to "/proc/scsi/esas2r/ATTOnode" */ static const struct file_operations esas2r_proc_fops = { - .compat_ioctl = esas2r_proc_ioctl, + .compat_ioctl = compat_ptr_ioctl, .unlocked_ioctl = esas2r_proc_ioctl, }; diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 71ff3936da4f..12c4487cb9f6 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -3973,9 +3973,7 @@ static const struct file_operations pmcraid_fops = { .open = pmcraid_chr_open, .fasync = pmcraid_chr_fasync, .unlocked_ioctl = pmcraid_chr_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = pmcraid_chr_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 92c2914239e3..1663c163edca 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -567,9 +567,7 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) static const struct file_operations ion_fops = { .owner = THIS_MODULE, .unlocked_ioctl = ion_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ion_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static int debug_shrink_set(void *data, u64 val) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 6a33aaa1a49f..fd0ea4dbcb91 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -494,7 +494,7 @@ static const struct file_operations vme_user_fops = { .write = vme_user_write, .llseek = vme_user_llseek, .unlocked_ioctl = vme_user_unlocked_ioctl, - .compat_ioctl = vme_user_unlocked_ioctl, + .compat_ioctl = compat_ptr_ioctl, .mmap = vme_user_mmap, }; diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 0f16d9ffd8d1..37d22e39fd8d 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -675,7 +675,7 @@ static const struct file_operations tee_fops = { .open = tee_open, .release = tee_release, .unlocked_ioctl = tee_ioctl, - .compat_ioctl = tee_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static void tee_release_device(struct device *dev) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index a7824a51f86d..3234dc539873 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -724,7 +724,7 @@ static const struct file_operations wdm_fops = { .release = wdm_release, .poll = wdm_poll, .unlocked_ioctl = wdm_ioctl, - .compat_ioctl = wdm_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 4942122b2346..bbd0308b13f5 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -2220,9 +2220,7 @@ static const struct file_operations fops = { .release = usbtmc_release, .flush = usbtmc_flush, .unlocked_ioctl = usbtmc_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = usbtmc_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .fasync = usbtmc_fasync, .poll = usbtmc_poll, .llseek = default_llseek, diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c index 93d5bebf9572..1b0b11b55d2a 100644 --- a/drivers/virt/fsl_hypervisor.c +++ b/drivers/virt/fsl_hypervisor.c @@ -706,7 +706,7 @@ static const struct file_operations fsl_hv_fops = { .poll = fsl_hv_poll, .read = fsl_hv_read, .unlocked_ioctl = fsl_hv_ioctl, - .compat_ioctl = fsl_hv_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; static struct miscdevice fsl_hv_misc_dev = { diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 78de9d5d80c6..f4f792b7379d 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2305,7 +2305,7 @@ static const struct super_operations btrfs_super_ops = { static const struct file_operations btrfs_ctl_fops = { .open = btrfs_control_open, .unlocked_ioctl = btrfs_control_ioctl, - .compat_ioctl = btrfs_control_ioctl, + .compat_ioctl = compat_ptr_ioctl, .owner = THIS_MODULE, .llseek = noop_llseek, }; diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ea8237513dfa..5bb93a3c397e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2354,7 +2354,7 @@ const struct file_operations fuse_dev_operations = { .release = fuse_dev_release, .fasync = fuse_dev_fasync, .unlocked_ioctl = fuse_dev_ioctl, - .compat_ioctl = fuse_dev_ioctl, + .compat_ioctl = compat_ptr_ioctl, }; EXPORT_SYMBOL_GPL(fuse_dev_operations); diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 91006f47e420..3f494c8eaf2b 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -523,7 +523,7 @@ static const struct file_operations fanotify_fops = { .fasync = NULL, .release = fanotify_release, .unlocked_ioctl = fanotify_ioctl, - .compat_ioctl = fanotify_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index ccbdbd62f0d8..6ec18e0492e6 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1920,7 +1920,7 @@ static const struct file_operations userfaultfd_fops = { .poll = userfaultfd_poll, .read = userfaultfd_read, .unlocked_ioctl = userfaultfd_ioctl, - .compat_ioctl = userfaultfd_ioctl, + .compat_ioctl = compat_ptr_ioctl, .llseek = noop_llseek, }; diff --git a/net/rfkill/core.c b/net/rfkill/core.c index f9b08a6d8dbe..c4be6a94ba97 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -1311,7 +1311,7 @@ static const struct file_operations rfkill_fops = { .release = rfkill_fop_release, #ifdef CONFIG_RFKILL_INPUT .unlocked_ioctl = rfkill_fop_ioctl, - .compat_ioctl = rfkill_fop_ioctl, + .compat_ioctl = compat_ptr_ioctl, #endif .llseek = no_llseek, }; From patchwork Tue Jul 30 19:55:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066753 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 06536746 for ; Tue, 30 Jul 2019 20:00:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC6A228541 for ; Tue, 30 Jul 2019 20:00:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB38A288B8; Tue, 30 Jul 2019 20:00:01 +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 B695628541 for ; Tue, 30 Jul 2019 19:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726870AbfG3T7d (ORCPT ); Tue, 30 Jul 2019 15:59:33 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:36377 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbfG3T7d (ORCPT ); Tue, 30 Jul 2019 15:59:33 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N63mC-1iPTLI09aS-016Nh4; Tue, 30 Jul 2019 21:59:08 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Andrew Donnellan , Felipe Balbi , Frederic Barrat , Andrew Donnellan , Frank Haverkamp , Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" , linuxppc-dev@lists.ozlabs.org, megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v5 14/29] compat_ioctl: use correct compat_ptr() translation in drivers Date: Tue, 30 Jul 2019 21:55:30 +0200 Message-Id: <20190730195819.901457-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730195819.901457-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730195819.901457-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:NR2XEl6+AoboPzHACO6k3v5xd19rmW+nghDi36gUHs44bTK8aTX j4qhcD2DWMgm3+w5BQbm37jRIwRUO1gaZlXowaZzD69dFljMBUlpDumVE2ajIdx5obcNlti nAmFEkrJj+t317mLhm+zRAyT+KpWBS/M4DUVEBLFC8zstuJ6l7ocOS0FIwjCL5iNxhFm2a0 dHq1Q5oHD7ND7iQ6+MUZw== X-UI-Out-Filterresults: notjunk:1;V03:K0:u33HB7XxxV8=:vLsaGE+sfhIAM14qUsuw0R +928w3h7E05CCYPEkSRuA9fqKtOyNwXWQf+p7/tNW+MbXN+zfzd98K6FgXQvN7HqGZ7l/cJVO JYmjVrCW6JjQ/bx80HforgEaK0mOIZUzFIRQ/TLVMAuN9dc/NEsBmwm9QDG0DzXQnCBLQtHYq o2ceQvd0dOCKrFoZ6XOd4P6ZA990RYgAioOtooOQBwbdqfXPYn/RK1LVesjyEvXnQAV0mi890 nnlbNvW9ICG1DfrcBajqCHDlwX1UBQgEvFc8zImPXkPoS2NbrmfLov5E4AmZaWkC6raNUXvhD Kch/xpLw8RD+2ZVqKo7BeKyiF8/8tmKxrr2RYsrh5pgp4cBhm+/R+s5lPcV64TL9GTmvidnc3 9KqCKNPCCpOiKUTKKfUdQDXV/3wECFOqCit1j2UETF4UJtghNlWzy1ZMFHsbiiSDjW3mXOCwZ NNq4R6a1JUzd8PJh2Ome6hqH1Ri8lXo59BqX+eN0DCWqLsBYkw+FGwuBIlD5fswQCWfLHTk1C SQ+plLlsSxrF/0j5RX6k/mPhEP87QEn8+m1mKE3E4/Teza5RHj5j9g96VfE4KDvzbZvKy6hzt Tkd2BSD0TBYVSl98UGIIxZpxnyromDQzXVdEMCIcHKkgBapCnnYU45+eZsAr19gGMzOwuZVfB oeNJZp3eYYD5yY/Rd96ta1kQXMzAhg4JqRHvoGjEcmXwLbdm3zgEHwwTj6RQkuCsECNphdXNe AUXjEEHJwlCwYBkjK7uS+5IN7jXnZSNGBDs5vQ== 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 A handful of drivers all have a trivial wrapper around their ioctl handler, but don't call the compat_ptr() conversion function at the moment. In practice this does not matter, since none of them are used on the s390 architecture and for all other architectures, compat_ptr() does not do anything, but using the new compat_ptr_ioctl() helper makes it more correct in theory, and simplifies the code. I checked that all ioctl handlers in these files are compatible and take either pointer arguments or no argument. Acked-by: Al Viro Acked-by: Greg Kroah-Hartman Acked-by: Andrew Donnellan Acked-by: Felipe Balbi Signed-off-by: Arnd Bergmann --- drivers/misc/cxl/flash.c | 8 +------- drivers/misc/genwqe/card_dev.c | 23 +---------------------- drivers/scsi/megaraid/megaraid_mm.c | 28 +--------------------------- drivers/usb/gadget/function/f_fs.c | 12 +----------- 4 files changed, 4 insertions(+), 67 deletions(-) diff --git a/drivers/misc/cxl/flash.c b/drivers/misc/cxl/flash.c index 4d6836f19489..cb9cca35a226 100644 --- a/drivers/misc/cxl/flash.c +++ b/drivers/misc/cxl/flash.c @@ -473,12 +473,6 @@ static long device_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return -EINVAL; } -static long device_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - return device_ioctl(file, cmd, arg); -} - static int device_close(struct inode *inode, struct file *file) { struct cxl *adapter = file->private_data; @@ -514,7 +508,7 @@ static const struct file_operations fops = { .owner = THIS_MODULE, .open = device_open, .unlocked_ioctl = device_ioctl, - .compat_ioctl = device_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .release = device_close, }; diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 0e34c0568fed..040a0bda3125 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -1215,34 +1215,13 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd, return rc; } -#if defined(CONFIG_COMPAT) -/** - * genwqe_compat_ioctl() - Compatibility ioctl - * - * Called whenever a 32-bit process running under a 64-bit kernel - * performs an ioctl on /dev/genwqe_card. - * - * @filp: file pointer. - * @cmd: command. - * @arg: user argument. - * Return: zero on success or negative number on failure. - */ -static long genwqe_compat_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) -{ - return genwqe_ioctl(filp, cmd, arg); -} -#endif /* defined(CONFIG_COMPAT) */ - static const struct file_operations genwqe_fops = { .owner = THIS_MODULE, .open = genwqe_open, .fasync = genwqe_fasync, .mmap = genwqe_mmap, .unlocked_ioctl = genwqe_ioctl, -#if defined(CONFIG_COMPAT) - .compat_ioctl = genwqe_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .release = genwqe_release, }; diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index 59cca898f088..e83163c66884 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c @@ -41,10 +41,6 @@ static int mraid_mm_setup_dma_pools(mraid_mmadp_t *); static void mraid_mm_free_adp_resources(mraid_mmadp_t *); static void mraid_mm_teardown_dma_pools(mraid_mmadp_t *); -#ifdef CONFIG_COMPAT -static long mraid_mm_compat_ioctl(struct file *, unsigned int, unsigned long); -#endif - MODULE_AUTHOR("LSI Logic Corporation"); MODULE_DESCRIPTION("LSI Logic Management Module"); MODULE_LICENSE("GPL"); @@ -68,9 +64,7 @@ static wait_queue_head_t wait_q; static const struct file_operations lsi_fops = { .open = mraid_mm_open, .unlocked_ioctl = mraid_mm_unlocked_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = mraid_mm_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, .owner = THIS_MODULE, .llseek = noop_llseek, }; @@ -224,7 +218,6 @@ mraid_mm_unlocked_ioctl(struct file *filep, unsigned int cmd, { int err; - /* inconsistent: mraid_mm_compat_ioctl doesn't take the BKL */ mutex_lock(&mraid_mm_mutex); err = mraid_mm_ioctl(filep, cmd, arg); mutex_unlock(&mraid_mm_mutex); @@ -1228,25 +1221,6 @@ mraid_mm_init(void) } -#ifdef CONFIG_COMPAT -/** - * mraid_mm_compat_ioctl - 32bit to 64bit ioctl conversion routine - * @filep : file operations pointer (ignored) - * @cmd : ioctl command - * @arg : user ioctl packet - */ -static long -mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, - unsigned long arg) -{ - int err; - - err = mraid_mm_ioctl(filep, cmd, arg); - - return err; -} -#endif - /** * mraid_mm_exit - Module exit point */ diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 213ff03c8a9f..7037ec33c424 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1351,14 +1351,6 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, return ret; } -#ifdef CONFIG_COMPAT -static long ffs_epfile_compat_ioctl(struct file *file, unsigned code, - unsigned long value) -{ - return ffs_epfile_ioctl(file, code, value); -} -#endif - static const struct file_operations ffs_epfile_operations = { .llseek = no_llseek, @@ -1367,9 +1359,7 @@ static const struct file_operations ffs_epfile_operations = { .read_iter = ffs_epfile_read_iter, .release = ffs_epfile_release, .unlocked_ioctl = ffs_epfile_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = ffs_epfile_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; From patchwork Tue Jul 30 19:55:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066757 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 B58EA14DB for ; Tue, 30 Jul 2019 20:00:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6181285D4 for ; Tue, 30 Jul 2019 20:00:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99B1E28899; Tue, 30 Jul 2019 20:00:27 +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 A3783285D4 for ; Tue, 30 Jul 2019 20:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbfG3UAW (ORCPT ); Tue, 30 Jul 2019 16:00:22 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:45527 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfG3UAW (ORCPT ); Tue, 30 Jul 2019 16:00:22 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1M8yU2-1hycp60PiA-0067YS; Tue, 30 Jul 2019 21:59:58 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , "David S. Miller" , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , =?utf-8?q?Kai_M=C3=A4kisara?= , "James E.J. Bottomley" , "Martin K. Petersen" , linux-ide@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH v5 15/29] compat_ioctl: move tape handling into drivers Date: Tue, 30 Jul 2019 21:55:31 +0200 Message-Id: <20190730195819.901457-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730195819.901457-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730195819.901457-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:DjrExkZ5Ld377ZFAs9oLXBHkumN5MdCfTEPVek3qN/4rrIuaXAt BnjcZ5NsP0owf4pQBbSs9TJbdzHbypdHesdhu4fMrLY1n4NqqsDCL9PDIN6RHJ5byrGBJ1u xP+EhKW2rvyx9h9pGpKTCm9IIzI8J5uMMlF8qSmuzL8b90UbqIOT3MxrqUTLcJiOe1wcytL 2ieKIGf/kZgvsxEGaKIMQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:GlW61MzzTkA=:Yq5B7sCgMqvFsp0nnDg/Vv dBq3ju5H3Brp13aspISufSCltMAEzFT2CiWkN+D/jJ0FcTwazNSIZbSDeuObYoFjJfjIo4OIA QYgei3C3m2gJeiaJIGu0iiszWR6cUDIfvsc13TiGyz113a8bqG4cr+nHqhObZ5D6yMwTDIEaP JNNZDtMFMsnT6lEVzoi4TFaOsOnXNIk8W+kMqOsdvD4wAs/kO4IYWl8Uqei7MBAOgmB749FFD lJMU6DCf0TJooPH+pOWp42M2xAA1DyjgVgzm6gVgo3xR8BGqBZI6nSHl1UeDl3+ebbdT7KemE ObvxVuRFYSPKyfNbxWP37meStqU8j2wX0J8BWYQKMxWkan7fKgqzKJ9SIZFozk9dPIE1Jn2i9 eJJAM8aCRehUdWeuqTKFjCBdrf8OXy0+KyGUdCaREVIpVNb7oDpfnE8UY5PcA2AP6mweQmoEc 3Tvoofg+ovfoxeDiu50pWdDAoci77jFK2wSgCTkzaViGLeZx/Vpt4K3m2lmpnfxblGRa7x/PU 8SjTAJ18d+L0eE8FmwdjT37hXHaJuOJgkVCZ+2RGtVck2/IN52GC3N4li26lvu3TBGYjbHMzs jsOaETcUOWC2a1gx/ENbPbVDlNES+NR9AJLMOcqkqV64Dsw10HPdeTbdcJz8odA8seriVHiCm 9Bk+LxFf16xF5B2oAjQxKQ5MsCycgIw1UmjmotqpPdbmgZr8lyXtG/gZZxoW6aYJbc4u90Hef VVn4Zz39Lwx8fGyq560Hut3TeKnctYDbwYzdJw== 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. Using an in_compat_syscall() check, the caller does not have to keep track of whether this was called through .unlocked_ioctl() or .compat_ioctl(). Signed-off-by: Arnd Bergmann Acked-by: Heiko Carstens --- drivers/ide/ide-tape.c | 27 ++++++++++--- drivers/s390/char/tape_char.c | 41 +++++++------------- drivers/scsi/st.c | 28 +++++++++----- fs/compat_ioctl.c | 73 ----------------------------------- include/linux/mtio.h | 59 ++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 115 deletions(-) create mode 100644 include/linux/mtio.h diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index db1a65f4b490..3e7482695f77 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 @@ -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); 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); default: if (tape->chrdev_dir == IDETAPE_DIR_READ) ide_tape_discard_merge_buffer(drive, 1); @@ -1432,6 +1429,22 @@ static long idetape_chrdev_ioctl(struct file *file, 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); + mutex_unlock(&ide_tape_mutex); + return ret; +} + /* * Do a mode sense page 0 with block descriptor and if it succeeds set the tape * block size with the reported value. @@ -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 ea4253939555..8abb42923307 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) { 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); } 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); } /* 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); 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)); + mutex_unlock(&device->mutex); + return rc; } #endif /* CONFIG_COMPAT */ diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index e3266a64a477..9e3fff2de83e 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -22,6 +22,7 @@ static const char *verstr = "20160209"; #include +#include #include #include #include @@ -3800,14 +3801,11 @@ 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); + retval = put_user_mtget(p, &mt_status); + if (retval) goto out; - } 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)) { @@ -3821,9 +3819,7 @@ 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); goto out; } mutex_unlock(&STp->lock); @@ -3857,14 +3853,26 @@ 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) { + void __user *p = compat_ptr(arg); struct scsi_tape *STp = file->private_data; struct scsi_device *sdev = STp->device; int ret = -ENOIOCTLCMD; + + /* argument conversion is handled using put_user_mtpos/put_user_mtget */ + switch (cmd_in) { + case MTIOCTOP: + return st_ioctl(file, MTIOCTOP, (unsigned long)p); + case MTIOCPOS32: + return st_ioctl(file, MTIOCPOS, (unsigned long)p); + case MTIOCGET32: + return st_ioctl(file, MTIOCGET, (unsigned long)p); + } + 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 47da220f95b1..b65eef3d4787 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -361,73 +360,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd, return do_ioctl(file, PPPIOCSCOMPRESS, (unsigned long) odata); } -#ifdef CONFIG_BLOCK -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 */ #define HCIUARTSETPROTO _IOW('U', 200, int) #define HCIUARTGETPROTO _IOR('U', 201, int) @@ -479,8 +411,6 @@ IGNORE_IOCTL(VT_GETMODE) */ COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ -/* Little m */ -COMPATIBLE_IOCTL(MTIOCTOP) #ifdef CONFIG_BLOCK /* md calls this on random blockdevs */ IGNORE_IOCTL(RAID_VERSION) @@ -846,9 +776,6 @@ static long do_ioctl_trans(unsigned int cmd, return sg_ioctl_trans(file, cmd, argp); case SG_GET_REQUEST_TABLE: return sg_grt_trans(file, cmd, argp); - case MTIOCGET32: - case MTIOCPOS32: - return mt_ioctl_trans(file, cmd, argp); #endif } diff --git a/include/linux/mtio.h b/include/linux/mtio.h new file mode 100644 index 000000000000..fa2783fd37d1 --- /dev/null +++ b/include/linux/mtio.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MTIO_COMPAT_H +#define _LINUX_MTIO_COMPAT_H + +#include +#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) +{ + 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 (in_compat_syscall()) + 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) +{ + if (in_compat_syscall()) + return put_user(k->mt_blkno, (u32 __user *)u); + else + return put_user(k->mt_blkno, (long __user *)u); +} + +#endif From patchwork Tue Jul 30 19:55:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066763 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 E65C9746 for ; Tue, 30 Jul 2019 20:00:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D610728722 for ; Tue, 30 Jul 2019 20:00:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C64C228782; Tue, 30 Jul 2019 20:00:38 +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 67F5328722 for ; Tue, 30 Jul 2019 20:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727089AbfG3UAb (ORCPT ); Tue, 30 Jul 2019 16:00:31 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:53185 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbfG3UAb (ORCPT ); Tue, 30 Jul 2019 16:00:31 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MLAF0-1hbZdd1VJq-00IAlM; Tue, 30 Jul 2019 22:00:15 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Bartlomiej Zolnierkiewicz , "David S. Miller" , Mikulas Patocka , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH v5 16/29] compat_ioctl: move ATYFB_CLK handling to atyfb driver Date: Tue, 30 Jul 2019 21:55:32 +0200 Message-Id: <20190730195819.901457-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730195819.901457-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730195819.901457-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:0ZxSBrz/L44EWNzbRv73eLZ9rL3i0WOjEqW3ByO+yWHlG5mb1W7 uZYyt/mHnDhNF5/3cHikieXcTxoRI9SKCP3A6kV/mnrd3IZNBwdIIPy5ag5HJSr5fmja9AP ngK564Niy37kfuJ33rToKE5tPXHU8NZustU3CCj6664tSYM2jhcIpvCic+w3qXngEh036DL 3Q9yzWdV07Rb2faSlGosA== X-UI-Out-Filterresults: notjunk:1;V03:K0:9fZ+4C+PBKw=:dsFl5vdmzgFilRAMPDWfF8 n1bCvRStU4hPhqCc9cfPEQEwarWf8HuJUn5UZqPeQUVRZUSvzeoa0e/b/Bsdr6kPYtLQKDl86 hT0/hqP4pYp89gNPZqPYDKtqfDKRGn8FwLqHG3d0b/6kCiUetQ79BjTleg50jEeJz4CwzczDP JCscKWrDAXqGeqY9ir13K18HEIbm9ZCC2jja+6XO2UuVrcNWbxyZOVA0mpW1TDcAouEAAODx6 FGzi5u2ASC6nj3JWICwb7QbXkXIABd/zYsxjRWyiXvckzthwJmC+0xCYYWDpEy22z/qaJ5HLR pzbkaCrc97F5plaH+udhDlF1ev7aIpuh+guFDlq+k9be8Wdy3HZcmWQdbTNrhK+5Hrf1CpKXK yDvyHEwWnRgXoTtKRIg3s+do7xpeNgpsYH7pg42vb29baat8FJHwRVJgyQJAwx6dehVRECiD0 M1JwtDP78bzH0wITzb79yHNP9ldb3jOEgSljUAOl1GSLReyTZqs8CnI0I/WswLpKdi3ontffL W/zpL4zEinmxkerkcEg9r68QlJXVFC35/Qz27JPLg2fBd5rClltlnZR/l/lDbvUumzfLHevLV jWoWTj8c5+cTswTNznndye5ftcUhx7F0e5Zh9kj2acOdhrSqbOaEGIZxiosbuziS4ZaB6Y31D iTj6VRNq5x2O/ACd1YiEDpugSWVpPRY+fdQOmx7Bxy/Te+e15vcQbVWUN0sQWnT4M98daRpks 5SrWZpLrM0rNjYM8gtXpWszwMTjxd512fD0deQ== 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 two obscure ioctl commands, in a driver that only has compatible commands, so just let the driver handle this itself. Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Arnd Bergmann --- drivers/video/fbdev/aty/atyfb_base.c | 12 +++++++++++- fs/compat_ioctl.c | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 72bcfbe42e49..63bc76a1b2f9 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -48,7 +48,7 @@ ******************************************************************************/ - +#include #include #include #include @@ -235,6 +235,13 @@ static int atyfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); static int atyfb_blank(int blank, struct fb_info *info); static int atyfb_ioctl(struct fb_info *info, u_int cmd, u_long arg); +#ifdef CONFIG_COMPAT +static int atyfb_compat_ioctl(struct fb_info *info, u_int cmd, u_long arg) +{ + return atyfb_ioctl(info, cmd, (u_long)compat_ptr(arg)); +} +#endif + #ifdef __sparc__ static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma); #endif @@ -290,6 +297,9 @@ static struct fb_ops atyfb_ops = { .fb_pan_display = atyfb_pan_display, .fb_blank = atyfb_blank, .fb_ioctl = atyfb_ioctl, +#ifdef CONFIG_COMPAT + .fb_compat_ioctl = atyfb_compat_ioctl, +#endif .fb_fillrect = atyfb_fillrect, .fb_copyarea = atyfb_copyarea, .fb_imageblit = atyfb_imageblit, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index b65eef3d4787..a4e8fb7da968 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -696,8 +696,6 @@ COMPATIBLE_IOCTL(CAPI_CLR_FLAGS) COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT) COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT) /* 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) From patchwork Tue Jul 30 19:55:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066767 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 40E8F746 for ; Tue, 30 Jul 2019 20:00:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33A7E237F1 for ; Tue, 30 Jul 2019 20:00:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27A7128671; Tue, 30 Jul 2019 20:00:53 +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 4F73C237F1 for ; Tue, 30 Jul 2019 20:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbfG3UAl (ORCPT ); Tue, 30 Jul 2019 16:00:41 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:48805 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfG3UAk (ORCPT ); Tue, 30 Jul 2019 16:00:40 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MnJUy-1ibTt43Pkq-00jM8M; Tue, 30 Jul 2019 22:00:38 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Karsten Keil , netdev@vger.kernel.org Subject: [PATCH v5 17/29] compat_ioctl: move isdn/capi ioctl translation into driver Date: Tue, 30 Jul 2019 21:55:33 +0200 Message-Id: <20190730195819.901457-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730195819.901457-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730195819.901457-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:tpmLoTqdinjnsl+Tzj0InbA5QBGlwzwLt6rMTmYy+504j0UdEId QiG5+wHtN39MzCfP630K+xBuXw775V5yZ5sxRh47GZLly6s15o8/DAi6Y0gaHsGzGXDiLxz WyfcighW8bpWmVwTes1xUXGC8fBfCOUkHMel1RFnxFfIqmwMocdRr75MepWyxvo4NtPz1uy 58VOEpE9Vynvyxcxr+5/g== X-UI-Out-Filterresults: notjunk:1;V03:K0:1fvi13ynrwg=:EHvBJHlSTgn7k/EsrSt6fp AiTI9iMa5W7w7GWQ/w8GCd5qRlGwtNTGgKSfh3mX7jAnd4LOFP50HK4WCSE+olcuJr8W4lmJp y7sSrbK4lFtuQVZ6mGSGBzcPuv+6jXzchqzS5yVw0jIHXXHD2nArG6OHpurpdX0Q+otz1X3Os cm/w7nHlQFtAhQdbsNjozKZA7lnHoqmF0TyXD3m+ids0RGsj1ex/LRNeEKuTfsaVJqR9bW4B2 WisznjgEQMmY+Fz4lynYHt5zIuNEMToB/sYVElQHcFUS5qf4vdK9guFzJfS8bkuvJVh5Nsy7h bL7YS6KFilyWoah7E1QPFLxOedCCvSQpHbpOxn2x9E+pYpEAHrUDyYzylIX7g54h2MEgGJnhx Zax2+mVOvgn2GPkbaFyBI6Da9jsT5ZORR+qbrcYt6RUDJe55nF6dL7Rfv/zDpRWO/Gh+e1xRf 0IVESsJtR50iffijWNNPVqc7D5LdLV+YMRHpUyVSBDyY4m477WufxZD1UgyEm6I7uMwWIPAYV dNP+aFRJmFHPYQExuYojVqMR+Lj4x6PyXhhQKMrqAGII6MwIqHR5F8kuBHsiHXuOIKO3FVt2Z phT8iQZbMAgeMYbtBMEml73VQa1uuynXo/0mlt+xk2mKRflv0zjlBYLZ+VU3fuYvA+y2ORxh5 n5OsHQbXIbCef/uUk4Q256vP21YVjNPgiB94EWFi9J76flLnfjq2eifgX0k8IlLPBNvBpmFnB GZYjtUueFsiKdhts1qHeRb7aCajurnSRY3FHAg== 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 has some ioctl commands that are correctly listed in fs/compat_ioctl.c. We can trivially move all of those into the corresponding file 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 +++++++++++++++++++++++++++++++ fs/compat_ioctl.c | 17 ----------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 3c3ad42f22bf..3b72fd8104db 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/fs/compat_ioctl.c b/fs/compat_ioctl.c index a4e8fb7da968..f3b4179d6dff 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -44,9 +44,6 @@ #include #include -#include -#include - #ifdef CONFIG_BLOCK #include #include @@ -681,20 +678,6 @@ COMPATIBLE_IOCTL(RFCOMMRELEASEDEV) COMPATIBLE_IOCTL(RFCOMMGETDEVLIST) COMPATIBLE_IOCTL(RFCOMMGETDEVINFO) COMPATIBLE_IOCTL(RFCOMMSTEALDLC) -/* 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) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) From patchwork Tue Jul 30 19:55:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066769 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 47B4F746 for ; Tue, 30 Jul 2019 20:01:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AA2C28541 for ; Tue, 30 Jul 2019 20:01:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EB2C28782; Tue, 30 Jul 2019 20:01:24 +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 CAD2628541 for ; Tue, 30 Jul 2019 20:01:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727248AbfG3UBI (ORCPT ); Tue, 30 Jul 2019 16:01:08 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:45393 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbfG3UBI (ORCPT ); Tue, 30 Jul 2019 16:01:08 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mk0e8-1icaLz2Q9Y-00kT86; Tue, 30 Jul 2019 22:00:59 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Marcel Holtmann , Johan Hedberg , "David S. Miller" , Mauro Carvalho Chehab , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 18/29] compat_ioctl: move rfcomm handlers into driver Date: Tue, 30 Jul 2019 21:55:34 +0200 Message-Id: <20190730195819.901457-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730195819.901457-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730195819.901457-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:KNUY+ou8651nO/evqeLR4khDAmABirIr+RCPLbKFzTO6f5smDMh 1tpV8P1jpGNB6ALSmigGLUZLlFHyaaEDufHC/sMHAsJQX00Y4thd3ENOiqljWbJEzD/B0jP 3FZ1Vg0T8Sp9hiGsegZTX8CUT8bO/ryYKyoVmUdgOtjtrOaEj5ukTDZE/2SQcPjIz+yJF4Z cNqFP1tMWqkXErX4a1fsg== X-UI-Out-Filterresults: notjunk:1;V03:K0:+6CEOpAQoyc=:LyOCzZSE4+jayuS467Z4/c 8st+rNurhs1J6i/XBZ+oNNjgNY4fpj2tE22ZLfhBHQ32BjcQW9V/jq1YJHVnAiBSI9+h+nOmV NDfSJ7o3PxNaRCTDKlxhEu8+Gt6T8I0VhW2i7nIhHADGVDjQgfZFhr0GMXtEMywH4CrVC9ryN 0FlHEExe6sXeQrloA038UPeg4eY926SX11JLvMSMIL3wBKbFopNUg9I2BZC9L8itzGJXyE5Az axZfI73Q0ig0PDsLru5Oxso8qza4lo525zyJtq68YgX3c7i0Rq68nsYfR0LlyX+xqG/bCeHPh jf/gj9aYU87g1Kp3zxJD/QaE5CRBbUgHlWtA0fiEBhfMRoGwfI98J4N1bzGcFWRnNcZy/naLy 2qgf3nX9cZWQ3ztX5zm+ub6qfBG/4xjpaDJfx9Q/2tp0MkVfXJ1YbLjjHYTTKch7T8QWOwCDR HCcFUUfen+3iIXFWtxKKs04DiMsnR1LPbf2NjuC0p2ZbzZhHYqwSUC/A9b72DoXyabCctaS+C GnnL3526Z5SEMHHDWT5SxJM4q/rHqwm/rylEBsp6YakLo44c5xbf+1AjFioUVkvqLlQGZ2djo X5uHtMn6/g3qBnxLWcN95L+F6szxHsCa3jWYKdLja7aaj/61jPLNBslLL55QLSQxprFwS54Py 1y9Tdb5ip6RbxKkA1xY3HwjTSAU/glEcypMCehY5sHzVrLYJDzMAUU/3xUk83Ufz1R9GrhJas CGivUsGxb3i8IkbfD9eVTXzNvDmq68u3F8vEsw== 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 All these ioctl commands are compatible, so we can handle them with a trivial wrapper in rfcomm/sock.c and remove the listing in fs/compat_ioctl.c. Signed-off-by: Arnd Bergmann Acked-by: Marcel Holtmann --- fs/compat_ioctl.c | 6 ------ net/bluetooth/rfcomm/sock.c | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index f3b4179d6dff..8dbef92b10fd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -42,7 +42,6 @@ #include #include -#include #ifdef CONFIG_BLOCK #include @@ -673,11 +672,6 @@ COMPATIBLE_IOCTL(HCIUARTGETPROTO) COMPATIBLE_IOCTL(HCIUARTGETDEVICE) COMPATIBLE_IOCTL(HCIUARTSETFLAGS) COMPATIBLE_IOCTL(HCIUARTGETFLAGS) -COMPATIBLE_IOCTL(RFCOMMCREATEDEV) -COMPATIBLE_IOCTL(RFCOMMRELEASEDEV) -COMPATIBLE_IOCTL(RFCOMMGETDEVLIST) -COMPATIBLE_IOCTL(RFCOMMGETDEVINFO) -COMPATIBLE_IOCTL(RFCOMMSTEALDLC) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 90bb53aa4bee..b4eaf21360ef 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -24,7 +24,7 @@ /* * RFCOMM sockets. */ - +#include #include #include #include @@ -909,6 +909,13 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lon return err; } +#ifdef CONFIG_COMPAT +static int rfcomm_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) +{ + return rfcomm_sock_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int rfcomm_sock_shutdown(struct socket *sock, int how) { struct sock *sk = sock->sk; @@ -1042,7 +1049,10 @@ static const struct proto_ops rfcomm_sock_ops = { .gettstamp = sock_gettstamp, .poll = bt_sock_poll, .socketpair = sock_no_socketpair, - .mmap = sock_no_mmap + .mmap = sock_no_mmap, +#ifdef CONFIG_COMPAT + .compat_ioctl = rfcomm_sock_compat_ioctl, +#endif }; static const struct net_proto_family rfcomm_sock_family_ops = { From patchwork Tue Jul 30 19:55:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066771 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 B2A8D1399 for ; Tue, 30 Jul 2019 20:01:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4D04237F1 for ; Tue, 30 Jul 2019 20:01:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98ED828847; Tue, 30 Jul 2019 20:01:36 +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 37F49237F1 for ; Tue, 30 Jul 2019 20:01:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727346AbfG3UBa (ORCPT ); Tue, 30 Jul 2019 16:01:30 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:44405 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726859AbfG3UB3 (ORCPT ); Tue, 30 Jul 2019 16:01:29 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MzR0i-1iEV4S49z6-00vL3y; Tue, 30 Jul 2019 22:01:21 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Marcel Holtmann , Johan Hedberg , "David S. Miller" , Deepa Dinamani , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 19/29] compat_ioctl: move hci_sock handlers into driver Date: Tue, 30 Jul 2019 21:55:35 +0200 Message-Id: <20190730195819.901457-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730195819.901457-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730195819.901457-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:MRkTCynjx8ZKieEaweTLO5hE+mPqZVxegMLXPvi77ZFI1txQjJ9 mTrIRI4m4fTqEgGSmmFN3Usqtf2R5hhD0UTDT/QRPC8IcYkJNc9RCybcAKzU9ok26pVCy5x ntkofHM1zI0tSnU5pRTvXGNm9jz6ODVkgpTv3FlyEqRYcF0gPPf0Zg4bNFKh5M/3p95jW3c NJpqqqWo8sTvCujeLhHJQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:imcKfvdmqYo=:DzN1SJA2kycqmDkWZRU/Nc NsiVwWKpUTSbb/mjgweqnGJqA8PbLpXcIVI0DnYKLcstHKQqUM9bO1645MdEsaq35cznVPvnq X9McomuGyhOeQ4PuSbktBrAlw0vSZNecfiZbb3tG7c3h22XpzdplbFOuxv3KhygMonfVWHRom q/lMAAoIWhR0QRDN3FJ7HuxgNRTr7sSsYzWLch8LnunYDT7RAzT8SXZWWJJLACkpr027DVyBm huvqteZ6Pd8c2x4Aggmq/hFTmsM3Zq9uPsl9lo935UhlkRild7uIT9VuPcWYPtlV2L+eoAnCS Pnlb4AdR2HlsodyDTCQeCcjUgzEHDub1fnFtoonfOdpw5bf22CbPFFcrFmFO6jrDrYeNuxmva ix3kaBzwtWdlwkm57P4mrdU6RkeO/B74i4gO1svQDK7My2+U8l3oD1c/ow7kpQyLk77k0i8PK raIm0SZOwvPAT/xC4YctG+JWo6dvw1nCt4x+GcshvZNS0bvVb+U671bBLfumJqbGql+jqSWvQ /7zT8QpcC5SMTxfJAGBChF6BIceVc3gKJCROeL+dXVKfyE9cBEhQZzVlSdphRCpuoFKPt8eLv Td5m7QCdZ+W8eXpu6wquobqfUhHJ12/2yxsqKSKfFpO3/Ag/TBXOKTuHKnVHNpVkmEiFU+2Mc lCLkOH5UiTCy359HjqQDgB2hX4PkesHavNc/hE3CnlZzRMAiUOuQi3br5MXWsqjDFmO5MYGw7 47iC//C6Eal1Nx6VmsgdHZTfqrEtec8LChFJ6w== 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 All these ioctl commands are compatible, so we can handle them with a trivial wrapper in hci_sock.c and remove the listing in fs/compat_ioctl.c. A few of the commands pass integer arguments instead of pointers, so for correctness skip the compat_ptr() conversion here. Signed-off-by: Arnd Bergmann Acked-by: Marcel Holtmann --- fs/compat_ioctl.c | 24 ------------------------ net/bluetooth/hci_sock.c | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 8dbef92b10fd..9302157d1471 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -40,9 +40,6 @@ #include "internal.h" -#include -#include - #ifdef CONFIG_BLOCK #include #include @@ -646,27 +643,6 @@ COMPATIBLE_IOCTL(RNDADDENTROPY) COMPATIBLE_IOCTL(RNDZAPENTCNT) COMPATIBLE_IOCTL(RNDCLEARPOOL) /* Bluetooth */ -COMPATIBLE_IOCTL(HCIDEVUP) -COMPATIBLE_IOCTL(HCIDEVDOWN) -COMPATIBLE_IOCTL(HCIDEVRESET) -COMPATIBLE_IOCTL(HCIDEVRESTAT) -COMPATIBLE_IOCTL(HCIGETDEVLIST) -COMPATIBLE_IOCTL(HCIGETDEVINFO) -COMPATIBLE_IOCTL(HCIGETCONNLIST) -COMPATIBLE_IOCTL(HCIGETCONNINFO) -COMPATIBLE_IOCTL(HCIGETAUTHINFO) -COMPATIBLE_IOCTL(HCISETRAW) -COMPATIBLE_IOCTL(HCISETSCAN) -COMPATIBLE_IOCTL(HCISETAUTH) -COMPATIBLE_IOCTL(HCISETENCRYPT) -COMPATIBLE_IOCTL(HCISETPTYPE) -COMPATIBLE_IOCTL(HCISETLINKPOL) -COMPATIBLE_IOCTL(HCISETLINKMODE) -COMPATIBLE_IOCTL(HCISETACLMTU) -COMPATIBLE_IOCTL(HCISETSCOMTU) -COMPATIBLE_IOCTL(HCIBLOCKADDR) -COMPATIBLE_IOCTL(HCIUNBLOCKADDR) -COMPATIBLE_IOCTL(HCIINQUIRY) COMPATIBLE_IOCTL(HCIUARTSETPROTO) COMPATIBLE_IOCTL(HCIUARTGETPROTO) COMPATIBLE_IOCTL(HCIUARTGETDEVICE) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index d32077b28433..5d0ed28c0d3a 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -23,7 +23,7 @@ */ /* Bluetooth HCI sockets. */ - +#include #include #include #include @@ -1054,6 +1054,22 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, return err; } +#ifdef CONFIG_COMPAT +static int hci_sock_compat_ioctl(struct socket *sock, unsigned int cmd, + unsigned long arg) +{ + switch (cmd) { + case HCIDEVUP: + case HCIDEVDOWN: + case HCIDEVRESET: + case HCIDEVRESTAT: + return hci_sock_ioctl(sock, cmd, arg); + } + + return hci_sock_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { @@ -1974,6 +1990,9 @@ static const struct proto_ops hci_sock_ops = { .sendmsg = hci_sock_sendmsg, .recvmsg = hci_sock_recvmsg, .ioctl = hci_sock_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = hci_sock_compat_ioctl, +#endif .poll = datagram_poll, .listen = sock_no_listen, .shutdown = sock_no_shutdown, From patchwork Tue Jul 30 20:01:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066773 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 50F93746 for ; Tue, 30 Jul 2019 20:01:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4471728847 for ; Tue, 30 Jul 2019 20:01:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38C3A2884B; Tue, 30 Jul 2019 20:01: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 D1AD1237F1 for ; Tue, 30 Jul 2019 20:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727401AbfG3UBu (ORCPT ); Tue, 30 Jul 2019 16:01:50 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:53131 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbfG3UBu (ORCPT ); Tue, 30 Jul 2019 16:01:50 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MYNW8-1hokhs3crS-00VLjo; Tue, 30 Jul 2019 22:01:46 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 20/29] compat_ioctl: remove HCIUART handling Date: Tue, 30 Jul 2019 22:01:25 +0200 Message-Id: <20190730200145.1081541-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730192552.4014288-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:noHB01zjETkbsqArpq8t35RXjwvYROuKxnK7CTrTSdVMP/m6xIA Bg6Y8fOZDoSMksrI/4s5Y65kcjgyeCRuqHwupI/dW8LyVCXDqegBf8PvswAgWNsRC87YYii QNWYIwgnUzezFv6mLd9ZS3tWXosJS2wgX3+8rGrTAdfvm4ShmeLdDO4X85++sXTeEAv5AEt vFnaf8hLe7XHH4XDb3k1w== X-UI-Out-Filterresults: notjunk:1;V03:K0:80bHOsZlkj8=:vWtIK+qyk1I0xKHajkNfGR Fgy6NWqO1IxhILt0eRVd999Fa5T0+ny7p1/janZSqpGwxW3hniU1yvf7fgtnAAvK9EqcZB2el Z7vQM3ZH0eAN20ebceBIA2c/2EeDiGPCpYTL+RN1QGaHFAG+wPp2rgc+wrgLrfYPiRLE45IQR L61ICWAqJ/jziTWMrQKbJFCoxX8nVbi+5p6U0FdzzCH+hJD5GuQX+YF3Xikn4WwhENzvUmq3c IP+wJjCpYA2T7sLRrb/ikY1QhucNg1Dy3j+EP91LQfWg2hP0EKk5Wrk4Tuyr9iU4OKY/FmKHN N8AiBxBXLTlt2mah3erwmIl/Ghir8Uh8Oxn6hPpI+77ReGswB6b9SEkMMMwnL9rUtT21WF4q2 ry1raKZ0iMdJSluRevlacVy0vUCdQ07J6GT1u6bMtjcXagtdM55JNgrhJsYXP5ZHPUITZo4EO oEoAukOK2OUbsVMLEFktYYZpfWbhFGjTFhWicL0orAKo8J7yZRL6CPbGv29qt7eK6Y6su+7bc 5G8Ee5+PqxUP7L/8Q8ZkgHA6uEDqiJvenOJAsZhQFpwx5r1TqmGynk0qqj+ehIjc366lWO3go idf+U+I3HzZs013zdSPMqHFBm8uB+1V4oCDzffXnIz96b2MLZe6SJGp+X1rcktRVzSisOBT++ MaiUcCCVfJxRvsTqZdPMVpvXzH+Z03Vv9A0E8TLYsTYkclVK8jNV6t2y5V1AP5a0cGkyxwzvp /ua8DfFpBeazw/Y7E6fsbRp1Ukyr19i5YpcuEQ== 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 As of commit f0193d3ea73b ("change semantics of ldisc ->compat_ioctl()"), all hciuart ioctl commands are handled correctly in the driver, and we never need to go through the table here. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9302157d1471..758b8b934b70 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -353,13 +353,6 @@ static int ppp_scompress(struct file *file, unsigned int cmd, return do_ioctl(file, PPPIOCSCOMPRESS, (unsigned long) odata); } -/* Bluetooth ioctls */ -#define HCIUARTSETPROTO _IOW('U', 200, int) -#define HCIUARTGETPROTO _IOR('U', 201, int) -#define HCIUARTGETDEVICE _IOR('U', 202, int) -#define HCIUARTSETFLAGS _IOW('U', 203, int) -#define HCIUARTGETFLAGS _IOR('U', 204, int) - /* * simple reversible transform to make our table more evenly * distributed after sorting. @@ -642,12 +635,6 @@ COMPATIBLE_IOCTL(RNDGETPOOL) COMPATIBLE_IOCTL(RNDADDENTROPY) COMPATIBLE_IOCTL(RNDZAPENTCNT) COMPATIBLE_IOCTL(RNDCLEARPOOL) -/* Bluetooth */ -COMPATIBLE_IOCTL(HCIUARTSETPROTO) -COMPATIBLE_IOCTL(HCIUARTGETPROTO) -COMPATIBLE_IOCTL(HCIUARTGETDEVICE) -COMPATIBLE_IOCTL(HCIUARTSETFLAGS) -COMPATIBLE_IOCTL(HCIUARTGETFLAGS) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) From patchwork Tue Jul 30 20:01:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066775 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 061D61399 for ; Tue, 30 Jul 2019 20:02:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E77B628585 for ; Tue, 30 Jul 2019 20:02:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA11B28847; Tue, 30 Jul 2019 20:02:02 +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 8976F28585 for ; Tue, 30 Jul 2019 20:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727440AbfG3UB6 (ORCPT ); Tue, 30 Jul 2019 16:01:58 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:53607 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbfG3UB6 (ORCPT ); Tue, 30 Jul 2019 16:01:58 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1N4z2Y-1iJx7g20Oa-010r46; Tue, 30 Jul 2019 22:01:56 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 21/29] compat_ioctl: remove HIDIO translation Date: Tue, 30 Jul 2019 22:01:26 +0200 Message-Id: <20190730200145.1081541-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:cGLMrdz2ftVA7JM7GI8tQRavvjPNvWde0+oUJ+i1B0HZ6yecjDl tpiXJL8sYfaJuCRKfRXz2kWMjbiNPDzLshRoNOvpsI5eFVW2wOm9EHdXbMb99s0P+gvRZBb nChZVeLN5QFMRXcHWPZs2207CRJAZns19pR7cEktAnF/YMScucqPN5uc8znBlMl7QvIq5dq 4Qhuiud3G0zPCyBIJs9Cw== X-UI-Out-Filterresults: notjunk:1;V03:K0:sjyi9QjQeG8=:h9L/SUSxbtmHhFu4hoU0Ik cZEJ7xUKF7FcQig7cHJCMLOJXae4syoYA9HyUM71NdxsXTBsi3KvC7MeBvBsIfel+a+x6OZi8 +WfpN/s8v8Cylua7AXANPiKZJeTw5/w2i+r6v1mTIIaX04w00oBJ8eOQWuB7fbjSIcELpDSYs rYBTSMFqCs8V0XVteKBLQoGELzG/x8itnH9nl2ybe9b1XPARdw7uLYAJloboknNP7y0S6PWYH Vyb487r+4jWzFs9zyhlUNNQzWdvDQppYNykwR4qN51/f9h7XT+ligpn1CoJvRmN1ZT7qv11be eA9Mrclp759tTNdDkjdd8C0iwO+McpDyL5DZBpSXIr0+p0uGZYKO5N8SBXk5WAM7wZ663uTV3 pQPTf0ds/C7OweV/W8oVrfcoFi4sphwXluZjiFKF33K71Jlh0sTKjeb8JUd6ea5kst7kuIi51 AQwi0eUY4AiN3zy67s9jFirzcA/sggOCXIaZkPXs19+bXoessZEdt6g6lE2zL8ZhIiAdGPTZj cRqcyAFiEtNBH+N64HuU9ezNHLKqDruDrwnldbIvJ2jp03tprakSv7SjVNfibZCfXhw9sLeR4 c5h6IhhLLtsO0AJQ+YcChHqoMJyd6mOQCEuqKwH69tAuF1ciPp3ZMW7QZoE15XCQE4MenQQE9 n8c/HA/TKsu9zBSsTMJ1JzXEw6g4tgYdCn9Hp5sQHhXBb8DzXfZmroi+Rj3Uj4OpsDGK8YIlg k0bf1EQ+Hh03M0KqNn7TcgMsknAMD+9B4UOuyQ== 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 758b8b934b70..03da7934a351 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -640,23 +640,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 Tue Jul 30 20:01:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066791 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 52E21746 for ; Tue, 30 Jul 2019 20:04:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42B4528495 for ; Tue, 30 Jul 2019 20:04:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35A2928647; Tue, 30 Jul 2019 20:04:17 +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 6471928495 for ; Tue, 30 Jul 2019 20:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727813AbfG3UEP (ORCPT ); Tue, 30 Jul 2019 16:04:15 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:33557 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UEP (ORCPT ); Tue, 30 Jul 2019 16:04:15 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MkHEN-1icrZu462r-00khlH; Tue, 30 Jul 2019 22:02:40 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Takashi Iwai , Jeff Dike , Richard Weinberger , Anton Ivanov , Jaroslav Kysela , Takashi Iwai , linux-um@lists.infradead.org, alsa-devel@alsa-project.org Subject: [PATCH v5 22/29] compat_ioctl: remove translation for sound ioctls Date: Tue, 30 Jul 2019 22:01:27 +0200 Message-Id: <20190730200145.1081541-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:aXuX/8NsPMKeoKYlMNR2z5RGjKSqpECweZBiZM22EkHNIB+YNJK roZEQcRNgJFeE3COiMXAG752jJ7Pwegcj3a7bNuW9t0iID15W4PMdy5aOFboGkTUFwVOdJQ Il/pk0cihQRrOYDfnQBRLIDw8tu0syZ6MhHaFXgI2jQEAPc6Kcs3pEKVG6gGepFanMSFDe3 2efnh7Np0LQTMNOU6T2fA== X-UI-Out-Filterresults: notjunk:1;V03:K0:UwsMkfuEPjA=:HR5uCP3YcqZMWFruxX6YKi +I/1bNNN41LFMB5/SJOdzqhwU++iMD2dtgolrbhebpUDccoMGEnt2RzxbS5EMBZAzAEqio8cl Dkme+UOM0lqDYXk6w7f9dNpUnb9y8hF+13x5kwcOk67aYKYK540wWUU/cBlCFRRNxkFf2/jCv rLeQ/My+2vo47X0XswCHFhuTdsubEt/yAXvczvMOju6HgdVldmBWega5iz7riv3l9tBvOSxRp izyXWrN1fVAtwyU57Dl2ZK2wm52NYxrpKiWt39SqPnpvcx6pyQJS7UhGiZmWMgabTjGkbx17f /+DGDI09Fs2Vo5CjoagE9xl88huB2o/+W7WKgptZ24L3npd49KSnaGpk4LPi7Qa2X7MxX1XFO EiEebqL9s7SRWGyY2FJoPqSyqHDWSmtoRD32pcfPwHsXyujraQls5iWZU5FJgam3/s2tFFuik w/dVa+vLCc59mGVv0i/E4+MvLzwnJcLGxEE6uwgc0ceOzTi0+NUO5oBUoaqZyU67d+18/IR36 1bn384YqdWGPzppPeL28uWd5Cptr8ZB8mcVGaQs/2/Q8A3HJtRJsm7nyYHkvhLeYy2BTzsTHb kHMlUi0pNK6RmoLoazKLEfGF/TiRt67SN54CtSb43riZUxiBbZ6RqJslUdpGcH1nWT5kIEQXR bTigYzwsKQwA96EndRMl0UzR4SEEGKIVUr+sLc+r8gEtfVaL8lMTIc3NRDp9wfZ4JvOnWUwH+ Kr8tS9gDlLKDiMCfPxcRPlo+dqMzMhtR+zOOcA== 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. Reviewed-by: Takashi Iwai Signed-off-by: Arnd Bergmann --- arch/um/drivers/hostaudio_kern.c | 1 + fs/compat_ioctl.c | 158 ----------------------------- sound/core/oss/pcm_oss.c | 4 + sound/oss/dmasound/dmasound_core.c | 2 + 4 files changed, 7 insertions(+), 158 deletions(-) diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c index 7f9dbdbc4eb7..1bf139c3727a 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 = compat_ptr_ioctl, .mmap = NULL, .open = hostaudio_open, .release = hostaudio_release, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 03da7934a351..33f732979f45 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -51,8 +51,6 @@ #include #include -#include - #include @@ -458,162 +456,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) -/* 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 f57c610d7523..13db77771f0f 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2717,6 +2717,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..f802ea331e24 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 = compat_ptr_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 = compat_ptr_ioctl, .open = sq_open, .release = sq_release, }; From patchwork Tue Jul 30 20:01:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066777 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 148B9746 for ; Tue, 30 Jul 2019 20:03:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04137237F1 for ; Tue, 30 Jul 2019 20:03:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8F6A288D9; Tue, 30 Jul 2019 20:03:04 +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 95675237F1 for ; Tue, 30 Jul 2019 20:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbfG3UCv (ORCPT ); Tue, 30 Jul 2019 16:02:51 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:51369 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UCv (ORCPT ); Tue, 30 Jul 2019 16:02:51 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1M26j1-1hv2My1VVJ-002bV9; Tue, 30 Jul 2019 22:02:49 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 23/29] compat_ioctl: remove IGNORE_IOCTL() Date: Tue, 30 Jul 2019 22:01:28 +0200 Message-Id: <20190730200145.1081541-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ek1iGVz3z8rp0kwmTInwOrlxtyDELGcxvn7MnUHf2GpwA+Tcv27 81WjuZnzfJAamGZOR10JbBpBocLtRFeXA/abGHufm3IQpdMqAvM1JYiwQIhKQrCN7kBp1WK ep/uslTZF/sihlfaZw3tTQGAKnstpVMJdcHnyaWVnTi1rdykvbhMqgenBjfxo0w//+qzk+3 ZFvkPJdmHpCxrFw1zlkuA== X-UI-Out-Filterresults: notjunk:1;V03:K0:UmkzJ/W4nIU=:HLHpVhSqhr1vzrLA7vdU7r w60DltwgBt6R6ydZWyRzpQg/Fade+ac8bmRlXFnLwnSeS64HxrixyRs1Jq2N/IH7ZC8wNyiqL +oU3p8/fSPDULShz+7/mfXVZuUVreXAVpepOgYbqyAc0ty35hT/+PHzHYJ4aJyWl2j8RCHhXv a1WGzmbBlqRysnbl2Kg4yI5/GPpAOMLDE8dOq3kO0ewJiKN/X2QPXiN3uFlu3dUPC/nSClF7Q nYI3MvJUlwu6y3c0Q7KkCV1xR+Ut1WxG3kfzC4MqX6Gi8BxHvSkOunaBiKazkSq2VQtBLV7hO SQ19m6qBuznHxQDexVCpO/Gbk0CiflwsBfyyJETD6G4cALYkIXc6jVBOEj65dE/uGCRUgO7Pd 9u6SzCSmoVFUPTcUxU/AhMlOztHGTybo/Ox4EHP4ZZqzRDtjRXiopLolJTOVFJJFZon6exE9i 6peIRPf4nIm5Sy6yJtV163q+ipvmywcO48ozy4g2+EnbT1t+7EnUQ88yJ8Gc3oqU3kjrf9xbC WofKsy402JIx32VqTJARhFLxugnC/sbdvW5ZVvBSHHfazVmIwh7Ioo9B1bfW3eHTONrZcvJlv jfM5ppob2b3Nd1k4R+XWgg6GYLr4O99hVP3yzPk1/nQa+Ds4mIzFu557RtlR56K5nAO4I9Xv8 CaLlb62YMewgnEMb9FD8lVhgNkRfYldLfjuY8dEUp15u7l1Sl69DAmFSpNrPepJ32Vt6s5qAh vXoff6cMi0IxzQjYobnzwlzQAIAupfvizZeq6A== 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 33f732979f45..10dfe4d80bbd 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -56,11 +56,6 @@ #include -#ifdef CONFIG_SPARC -#include -#include -#endif - #define convert_in_user(srcptr, dstptr) \ ({ \ typeof(*srcptr) val; \ @@ -358,17 +353,7 @@ static int ppp_scompress(struct file *file, unsigned int cmd, #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 */ /* Little t */ COMPATIBLE_IOCTL(TIOCOUTQ) /* 'X' - originally XFS but some now in the VFS */ @@ -384,23 +369,7 @@ 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 - * running on sparc. On other architectures the entries - * are useless but harmless. - */ -COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */ -COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */ #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) @@ -487,31 +456,6 @@ COMPATIBLE_IOCTL(JSIOCGVERSION) COMPATIBLE_IOCTL(JSIOCGAXES) COMPATIBLE_IOCTL(JSIOCGBUTTONS) COMPATIBLE_IOCTL(JSIOCGNAME(0)) - -/* 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 Tue Jul 30 20:01:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066779 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 71232746 for ; Tue, 30 Jul 2019 20:03:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64621288AA for ; Tue, 30 Jul 2019 20:03:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 587F9288A2; Tue, 30 Jul 2019 20:03:27 +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 0B41828870 for ; Tue, 30 Jul 2019 20:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727569AbfG3UDS (ORCPT ); Tue, 30 Jul 2019 16:03:18 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:55395 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UDR (ORCPT ); Tue, 30 Jul 2019 16:03:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1N3Kc8-1iJOc03PN4-010Ipo; Tue, 30 Jul 2019 22:03:10 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , "Theodore Ts'o" Subject: [PATCH v5 24/29] compat_ioctl: remove /dev/random commands Date: Tue, 30 Jul 2019 22:01:29 +0200 Message-Id: <20190730200145.1081541-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ixl6q7ELY2CPbzKLyp5yiEj9Xp94vS2g2+D9pmZiqmQGtHrHVuh aP6VLFt1s3Angfhw3puQSSyPIQoMFC8JaAaLkWZaC0dvRz7VXG9RWpet+Nb76KQIPpekFKA Nd1b1kdnf+YNa3DAaG/jC8KTP1EdrF4cdI0wOPTlmx9eag5FHB2S6nJ0/Zmfkmri53ukm18 DiLPEdVaRaX0snXTmEcVA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Xy4izpXa1kI=:sVc73Mvr8CzeTr6AVkie+W Ki5UhfHTqiaYmzPJC1WgRAU3/qCbvvatP5Rs7Ptqozk94PUzdruutiYIu8Yi9TmHALz2GYGkM tWCINWkn8QZmmmY1adp3OP3ziuHeI6Y7j1IY5CT8OBjwJ65F31EsPmcDwlIvb12THeTsdBqdg +sR3BHARGMJmN+Pk2yX8sCHbu62H99NSWXNFWrdBywrciWeAskzBbkvkNhhqbOTysWybV2rvb Jg5icpjkAyglp/JalFGj6qKj3ikZTbpPklBn3O2jXQ4KhwqyO8z/3GPybItzr6wFuyErBcFGm R3vUXD7bvcgdguDkbTyCC64OufFxFDtbCXYXv+LYXsTmExt0mPMEoBNK5tHGpfF/dfFAGWNux 4Qbq3ohc8XRr1M1xAEzmKMPnOH/kLWJBTZu5yorCcBIKgUKE6jFPbiHqKvZzFL8oL7VFi97yI R1FVBHf6DWs4TVYLDbCz5Dw3NwFsm5SdnhyDOZI7Tt5pihusWjTSWUBkiZTi11NPXJN4o7+5q 3XyiNakD9nzjP895d/HTkGHbc/9gP321Wp72L0/3XDifndBv95EGeDMSd1C+1IdqSi5iFTBUV lDogv/dbn37ssdB2tuqcGkZjuHQp9HSlWXgvXGpaEyRms6ZeyE3MFHKENtke4SRU7fKkd2gP3 SVsPm7c6UYAs9ScsaUi/f0THXTBVcXst/zA3YoqdjISfz9Pso5sHTtRxACzRQiz5xfdOTDCOr Hnya4c5Mjdv08QPOAW4PHEVzM1OkdB+FnoX8Vw== 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 use the generic compat_ptr_ioctl() helper. Acked-by: Greg Kroah-Hartman 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 5d5ea4ce1442..355dc54576f2 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2106,6 +2106,7 @@ const struct file_operations random_fops = { .write = random_write, .poll = random_poll, .unlocked_ioctl = random_ioctl, + .compat_ioctl = compat_ptr_ioctl, .fasync = random_fasync, .llseek = noop_llseek, }; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 10dfe4d80bbd..398268604ab7 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -439,13 +439,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) /* Misc. */ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) From patchwork Tue Jul 30 20:01:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066781 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 8CBE31399 for ; Tue, 30 Jul 2019 20:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F8B4288D7 for ; Tue, 30 Jul 2019 20:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DF88288CF; Tue, 30 Jul 2019 20:03:28 +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 244D6288AA for ; Tue, 30 Jul 2019 20:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727585AbfG3UDX (ORCPT ); Tue, 30 Jul 2019 16:03:23 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:55617 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UDX (ORCPT ); Tue, 30 Jul 2019 16:03:23 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1Md6V3-1iSR7j2KDT-00aHcj; Tue, 30 Jul 2019 22:03:20 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 25/29] compat_ioctl: remove joystick ioctl translation Date: Tue, 30 Jul 2019 22:01:30 +0200 Message-Id: <20190730200145.1081541-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:PBzVUTDgE7wJQfrGtSAz4FWJFxvfeGVLHgVspKugDuJpPNyNSg6 aIb8z4u8Dl6N7U1LCbSPLatvjYO6m5KxqclHjqfHHpGX7qPhe4axSPrfdXiqTs3VeNscQfW suvKMgoaHrqpW9oAQQRf4rl85ALpc/fOJySaR2Zu074UfT8sJoIP+1siQt67/jaT4bimNjK 9lh/CIalQFhIKqK21ZjZw== X-UI-Out-Filterresults: notjunk:1;V03:K0:LwtAdHe03ms=:lgEEPBv8Dq2M3w4aUoQbPY fqOrImQzso9XGFHU+lEB9R7R0sOxb87x7XhzMHViJG/PjuFIyNBBJG2RdXJ6OaBH5Rh4dFCra 8V+C2XaDk+401ej/37bH3TdnsmvOPgIjFZbBPfKMgE3E9SVN+ioUb/06gWnuxYN19hLvojavm u1XrLp7A/J5GcKFQL/y83gfagv0KaSJI2wPteprezJVYKkxW209s4mdtbCvk3QUYngqGD73+o LmPtQyN3+PsVyY7Q5v+rV0Y1hNjab7iSAR2qq33nSKmAEhKErSgiAV2/6DQLz0aL/evFOBRDs 22Y10jsudGba8ac91APLwUhwWPy8ML4EDVUmJ3xedqsZGBrOU1mmi3T9xVKOOcVyRt8QLfkr5 Iq5u0kDgXKqt1Wq32/quhBYRasrnmUOGLs9FkWbJvFhjqVzv74N5ki5vyHYaSqihv079m+e7U iJsn4+B6hDuqTKHMsy4vin5lM9G8tLVWRSqKqHzBmPOhJHB/O+rMqiO96ECc9V0A8d2hd9jgM 7ymBta+aPm8wUwB5GyYR7Hpw9/whFFztMS4gJCGR9xGsjHmDBtANTvmLhLSWruZyPqk58piB2 AtWFNglDr7U1pA3zd4pK4cn6UiSxXHrLBSHbW0F2/9VDpkrr5y8cdvtcFcqL1qgfxBmu9MCOI cta/fZ48fS5s2VrJ1MqapcriN1CKPiYIhE6KxmV9CgzbplXr5D/S3hpLvAeLas69Swn8CdyFb vX0MoJFYXfAn13h0l7TEGQWq8HnBNL5kaWfCdQ== 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 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 398268604ab7..a214ae052596 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -11,8 +11,6 @@ * ioctls. */ -#include - #include #include #include @@ -444,11 +442,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)) }; /* From patchwork Tue Jul 30 20:01:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066783 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 BED71746 for ; Tue, 30 Jul 2019 20:03:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1ED728847 for ; Tue, 30 Jul 2019 20:03:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52BE28786; Tue, 30 Jul 2019 20:03:44 +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 3257B288AC for ; Tue, 30 Jul 2019 20:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727631AbfG3UDd (ORCPT ); Tue, 30 Jul 2019 16:03:33 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:37767 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UDd (ORCPT ); Tue, 30 Jul 2019 16:03:33 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1M3DBb-1hw8qa2rcL-003hxj; Tue, 30 Jul 2019 22:03:29 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 26/29] compat_ioctl: remove PCI ioctl translation Date: Tue, 30 Jul 2019 22:01:31 +0200 Message-Id: <20190730200145.1081541-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:v9FZV+VakiX60OB46V7uJhxqDwWJDs0ZF0/AuEeS9ByrDiL0T/N e2sim3m0z8WK8x/eFiNMq9rj0AznnULlv7fo84ZSn2NmiIMMIccwRjhvT0rzpq7hiHkJsWg /ufuB6FUgYzdUYLya+SRPXDGppz2g2D34X2JcDiGpxe49qF7Q/krOGVHB9946yug/T+/LD1 6Lr8CmmY2qksX4coh2epQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:2JlqnoLxaj0=:1QvYHx9ZmLRsNnJrZj9nh7 6drR+9DyW77oFWEP4HzC41pn8HXR0LzMy4NVMcVLcdQEJ/qUFL/qMNbx6ZSYqm30J1r5s42ru yi+UJa2fGQRJDFuhtyb/4yicJgygTQipevbaccleZX/Ek5LFvykBCb89LV+iJRLOpAhgpCj9t BWrEfv3m+DyfccoZb60HkJCMggK6qNw+SiZ2d5Ia3NzbDsBJZsgr0IeCgJR2OnOUpxU25mhSp F9rd9OQ/MoKQ1J5zTvaYt2UoPCkOEC+FuGYp34WGcKnnDn0OC/+czUTdNmQTcOdAE5VsLTDNM DU/NTAGHlOCulyY5HqLH9fDR0qyOaxDsS+m2Ti265090Vfz7T5Jxzc2JO0ys1py5eO1wWI6Lf bRGKXKEX6AKVRzYuqKidEGW2ctip+YJo0JwNJu+QPzeeHC1n7ty+8TYps8/Y2aI9kDyIYp0XP CJLuleagsVT0l7Q8QBqriELnFosKXAh302cdMpuiPZxVstV9zOuNrzUp0mBev1jo6hOan5ikK pJGXSspR1HnPkn7leXCWyBnAr6G/OxHSC8h1lGzyMYHUmS5PG96bE25CdzyazcMvklwSCyObo yoy8I2RlcbBBQCLJJnvhMduvhllm0knHaYP9XpeYucs/wUp6fG5nU5QuBRzkfzgwHuzxmoF2j Q6fdVYwBNxPPZeB5Ay5/MpHd/3Ec/YSnuQROs29IG2kBbr5lY21Hn/NYDBxJCWi5gIp+ISMbM uLr4Xs83OMkc7T4RNwHS7MlZALC38UGYlTcwIA== 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 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a214ae052596..37f45644528a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -437,11 +436,6 @@ COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT) COMPATIBLE_IOCTL(WDIOC_SETPRETIMEOUT) COMPATIBLE_IOCTL(WDIOC_GETPRETIMEOUT) -/* Misc. */ -COMPATIBLE_IOCTL(PCIIOC_CONTROLLER) -COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO) -COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM) -COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE) }; /* From patchwork Tue Jul 30 20:01:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066785 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 9C310746 for ; Tue, 30 Jul 2019 20:03:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90C6828647 for ; Tue, 30 Jul 2019 20:03:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8528D2884B; Tue, 30 Jul 2019 20:03:45 +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 7586128647 for ; Tue, 30 Jul 2019 20:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727671AbfG3UDj (ORCPT ); Tue, 30 Jul 2019 16:03:39 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:48349 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UDj (ORCPT ); Tue, 30 Jul 2019 16:03:39 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1Md6V3-1iSR7y0CLz-00aHcj; Tue, 30 Jul 2019 22:03:37 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 27/29] compat_ioctl: remove /dev/raw ioctl translation Date: Tue, 30 Jul 2019 22:01:32 +0200 Message-Id: <20190730200145.1081541-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:W4sRNCmwCse+igQstofYbNjuY5tIEp4ixys4++ENhar1qkn8J4E As5oNaflN+7FC3Gd6vk+Rp0xB0KIaCBVZGKuE1EXgkSncFodiJ/cHTXzeNyoVwHI3sdfmKh BxFERihlEl8gh3GJoI2yjgIkVXqxHxPBJUXfNZ6+bPGY4d9zwJwvbu7VPvX8OZ2FqqQWpxi em3+zAolpmkXabnpvblbQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:grdhaW8stRg=:4WiG3W5aYSIYYfW7xWa6H0 vGwey/6NtgcXHYGepmBSIqxYjfQxlRlOJF39y3EngeivyfeVmT6ZmH5W8LVQpHZxwI9Nfykpu 4ncAzWXuuLPt7Th27VELsWVQAtfhL/bY+54ji4hnbtDaUBfIGvCqUkgVwPwWd+jz3DGSbW8Ou obhRBla3MSnaSUn/sa57a1GwnyK5nf44SQzXjQFNDtuHiyWb9pXJnZUzb25jWrHQYTn7K7A8t nTJpHxvYIdJ9M4KH61G11oFEKfWxyQ9cQYYtbJjIsKzL9+ua5zHxrQwn5Scr93RzE+xwABGVy JqVJeIaopS1lsKZZLXUlVdpd/RFNVRcqP6BLyWVJptN14kYoMSVw3z66TTD3nYVGXh+oSyekj rrMxQFDBGAanGmUsD/roPqOwImW78LdXiVMPXA7aOXeLZF6C11uCWFoKOOVaJ4CnRkj3YO6Iq TWs8MxOMaZBTjWne+aWBozUDgWqNZbvOv9WT8uVDkfpiB8+oVYQeTaMCo8yIeLiIdi9HoFMtC MtE5slB22mqW2nqXM74GKYxZPTR5sIxO9lduuyFu3YJBXH2f7IryM08MVdmwgR6X8NBQcd7yo kzzgntjTwIKKU95USU6qSKzy3XYqK55j20FZXivyCnNYlLaLq3IqTWVnU5R0XDOMYRBorKEQw Ua0+qZR9V6YGf6fjtqdZqSeKhXVJIDKxr5cqtEpw0qH+5tnQz6GJsMlagDOKQGK0q37QSb6SI AF850Dqb4f3Pro85qwqdj/EPPSoPssWQr7B0wA== 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 37f45644528a..6070481f2b6a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -422,9 +421,6 @@ COMPATIBLE_IOCTL(PPPIOCDISCONN) COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) -/* Raw devices */ -COMPATIBLE_IOCTL(RAW_SETBIND) -COMPATIBLE_IOCTL(RAW_GETBIND) /* Watchdog */ COMPATIBLE_IOCTL(WDIOC_GETSUPPORT) COMPATIBLE_IOCTL(WDIOC_GETSTATUS) From patchwork Tue Jul 30 20:01:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066787 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 58C401399 for ; Tue, 30 Jul 2019 20:03:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48893237F1 for ; Tue, 30 Jul 2019 20:03:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D30B28585; Tue, 30 Jul 2019 20:03:50 +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 DFDFB237F1 for ; Tue, 30 Jul 2019 20:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbfG3UDp (ORCPT ); Tue, 30 Jul 2019 16:03:45 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:35627 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UDp (ORCPT ); Tue, 30 Jul 2019 16:03:45 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mzhax-1iEm9m42rJ-00vdzz; Tue, 30 Jul 2019 22:03:44 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 28/29] compat_ioctl: remove last RAID handling code Date: Tue, 30 Jul 2019 22:01:33 +0200 Message-Id: <20190730200145.1081541-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:L6ghPT0z7Y64xcTrCXUwnubCk3tmV8ywCSmxsndG9GsSB7RCFPl lckirD4eRCqbNpeLeNl2vKkQTOZatiw1ZlX8Xm9sz3/HBZA/9BThKF5aDKVVeKe0NyheuJJ Eg4rk9FdVe3NWiv0wBYqp+kBjGJyE4suFOiFPfur3St6zEPnBaDdTKBj0wOCmv48JMv3y02 JYWkL98cEij07OHO1QqFw== X-UI-Out-Filterresults: notjunk:1;V03:K0:/J/7zPuSG+c=:VrZh1nk9oIzE1LsTcZlAj9 Ag6fmxC/BGicuB7U0DdL7Dlf+OGipXMinKQ4khSlAXJCDZyLhmw66VmIwnwPSqda+ARRUjS5J fpbXjJpv+rDImwQIojhyw0T5GF+zdsBkEC3KByCFPPOtuKanyErT95It4ufnKVt7GRHur1UJD 0XGZzVK/TuYHs7zGWTlJ9SjckN/VAhFUtmjYEGPag1NdVpDYvH9llsRgiuLGXslJP1XYzuQy4 GTjKpJio97eE405TeIYoIGcAfkhjLCW84+t4C/8Ti1t3YjIq5x0rVANbuL91uPII+fGVZhKcV J4qly6jCQPjSjeCXm9Yq0d9pYd+WJH/A+1rKXrUL2vX+JKrtWPK/hoNo5BIS95qw7BTX12WAy 2i0ATVUMrgor5Yf0iOaliZo0xiH+IBB3jgAtmaG3M3LY7O6LXk7E5Wp3TsbhqeNkRA0Gp/51o WN5tAYSYW5Cx9HQm6kgcrsAef0AFVY7UciNfxEqbsblvPqQkM66jkWEHoG7XkImoIkypGfXlI 4ZfKM8lGxUYSRLj8Z2XGcS7ltgExzYIUPX2GZ6NZDe9HkfrI749sSfd+lpYF6zvIKxFlPn4dd SQ8wBdTXTcGwJY7ezY2jiAlSWaSa3IW7q8kXYB8JoObxiBSp4IN2rE1Jb0mqWd6YkqYdjRyQo kqui+ZwJwYY3y6R3wZEMD/t4XFj6oDZnNeKLg1RPiLJcTR+w+/xaZezOutSxoUU43Qx7lTl08 3LYiLKYmdAdPnY7nxfloMBQGiGDhGe1kh+DN9w== 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 | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6070481f2b6a..1ed32cca2176 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -462,19 +462,6 @@ static long do_ioctl_trans(unsigned int cmd, #endif } - /* - * These take an integer instead of a pointer as 'arg', - * so we must not do a compat_ptr() translation. - */ - switch (cmd) { - /* RAID */ - case HOT_REMOVE_DISK: - case HOT_ADD_DISK: - case SET_DISK_FAULTY: - case SET_BITMAP_FILE: - return vfs_ioctl(file, cmd, arg); - } - return -ENOIOCTLCMD; } From patchwork Tue Jul 30 20:01:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11066789 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 0521C1399 for ; Tue, 30 Jul 2019 20:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECB68237F1 for ; Tue, 30 Jul 2019 20:03:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E10D628647; Tue, 30 Jul 2019 20:03:56 +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 8F0C9237F1 for ; Tue, 30 Jul 2019 20:03:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727748AbfG3UDw (ORCPT ); Tue, 30 Jul 2019 16:03:52 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:47489 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfG3UDw (ORCPT ); Tue, 30 Jul 2019 16:03:52 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MFK8N-1i8DfT26g5-00FkfH; Tue, 30 Jul 2019 22:03:50 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH v5 29/29] compat_ioctl: remove unused convert_in_user macro Date: Tue, 30 Jul 2019 22:01:34 +0200 Message-Id: <20190730200145.1081541-10-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190730200145.1081541-1-arnd@arndb.de> References: <20190730192552.4014288-1-arnd@arndb.de> <20190730200145.1081541-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:UPHnmaxQO2Y5UPjFxToRbWqVgMBmWu69lOVcBLM59CbYK+TCCtk iXAL+WGyqVxND7dGZvj3prqCvzu+zKPkck1Y19QGgPFfYZKw/1a19odfItMh+3Xs7fk20ih KmzNO5tvoX1a2eonX0BqH09rjq6NlGlMujBwXAL6X862s+Rf1an9ITfEdxlm4gfufZMGn+w 8Qs8oUnx83kAYmE6uccPg== X-UI-Out-Filterresults: notjunk:1;V03:K0:8BsgjV30L1s=:7g7Z6TZ7orqgEjViPiUUIW pQ+vmo7sdb3mi3EDA8aGDQkEkx1UheLDituizs76GJw+v/VWNY9Lg8/pL/ca+AsxcHYCKDLJ5 7oK6vWEPjf7aqoEpbKKKfHR7uJeJ4pGHMIcN1f7h2veYqD2aZPC3V8N+DnOZiQjgZp8JYecTK MCUXDF3GzFJblnKEWQfr0ckbWQh2LyK4gvl01WmmWfMp4e3YueaT6bWWvzeeiDgDV7alEmv6G lTeI1OMwweQetjIry0nKLkVOLT0lcrWjnp2g+hrThGrQkBtPrgQF1A7VRMhlWeyKDgyY129na LemT5BUDGA+fp1Q084pdR5yDHpqPFqHZH+fqAsJ4RW3NvaqiX9VY8gs4rKPpJ16p+v4UN9jRd vhESgtItrUDm1+1F/Rp7hB6NR1KmaZJ3/k8U4VXfqofaGL1+QDS9987yYOoRK9Rnm3ODdU5b6 FJHOLPALtXHpWhnEsiVu6c/BXRuSMNK21tU6oI7mE7cH3zZe+58oHQs2O53w7z77kayiYH/Eo fonUwuIO8hjF56fze0YkgUEV4GPW4bG0+uIySxFSbqS6t2YnQJKVX7zItCTv7NzcmgR0imOJy M1J5T3p/bcywTehZizolm1PwPSo8rKuUiKIogMbJMEskSt9/H3kRtTYGNVkuayI4NS28MeQXh vVui0n2TB6SDM2zUTVQdbbxEhOoW8QlKGLXR6LvFZnyUZQavfcUeLwpJ2IQ7Qb8W4oD5N6JOG +b9uwCsZ8qG8eJ6IQAUi2y4lYGkHUw/05idSiA== 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 last users are all gone, so let's remove the macro as well. Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 1ed32cca2176..1e740f4406d3 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -52,13 +52,6 @@ #include -#define convert_in_user(srcptr, dstptr) \ -({ \ - typeof(*srcptr) val; \ - \ - get_user(val, srcptr) || put_user(val, dstptr); \ -}) - static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int err;