From patchwork Fri Sep 18 12:46:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11785011 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5641E6CB for ; Fri, 18 Sep 2020 12:53:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67DCB2311A for ; Fri, 18 Sep 2020 12:52:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yI+fezge" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67DCB2311A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IKY3LQJEBj+1z3MulwROITUTEMQxt6m6GjK5aPWhn0Y=; b=yI+fezgewKhGSb9/1x7oD4rYO 7nqb0FuHrKlxcU9+cUXaBXxWm3uac3/IJYl/8soB0iutvFn1NYSjRalLqFoZm6SGlIjzW7/IfKsMj G8xAWVn6eZE9Nijcn0BwwFN/2uIXU0CTlerao+X4B51AwGPTD66XMAnkp+yw3D0dcmw5voJmapsL5 Pp8/X0cvDIaFssAmX8TdncELptQX3gLYSkmqk5JJ9xdirX6PHYyJ1tfJA7Z6fGSl9KIy1CaVGycaY iJyCpgl8kkQQfmFMZHvyQSM4VSanLdpYOvpwhkIc9FTnr0RfgHFsOSGbWxX4PJnRkP0NkguDEkKyC tIPXDtRjg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJFqJ-0007sE-Hv; Fri, 18 Sep 2020 12:50:23 +0000 Received: from mout.kundenserver.de ([212.227.126.134]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJFmv-0006Di-7U for linux-arm-kernel@lists.infradead.org; Fri, 18 Sep 2020 12:47:02 +0000 Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MfYgC-1kyvGF0nzE-00g4ML; Fri, 18 Sep 2020 14:46:35 +0200 From: Arnd Bergmann To: Christoph Hellwig , Russell King , Alexander Viro Subject: [PATCH v2 3/9] ARM: oabi-compat: add epoll_pwait handler Date: Fri, 18 Sep 2020 14:46:18 +0200 Message-Id: <20200918124624.1469673-4-arnd@arndb.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200918124624.1469673-1-arnd@arndb.de> References: <20200918124624.1469673-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:k9iqebiHjZ3oX4maOmeQmQ79S0aPwKPwE2q75VUILRfCNExgNeO t0nF6W9/K5gbYqjtYvM4XiNKBdrX7ZFYKkzh1Fxlh6/il8JpWkY3ypnnne2K3+vI88uMf/n qjTCSjNLfgphnVaY0MT4mVePdlMdTJlatzEmPXHlWRCVNfUZ6DbTt1b1Dh0nOmmPcquU1tI S6QntlECa7NX6h38ahEOA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:XfkwJUmH3E4=:S60cqccaGmI+fr+LIINq+e sDHp87nP2o+HiNpcipd5cqxDft/QdzBStQvx4rdJIbhgsG3Z9YqLp+e0IzBqBycYmllyoxlC+ Lu6splyvjbeRGeABicNZcAia+DzbZWji3IESnk4Enqlm3I4HWz1XhMHGbepFYsZrCBZ4Cvnj9 rc6fETdbTjR+FAPREHNuIcL1kqsl0ivLBGngtWdX3EJr/vzZ3ENTveZA1yk+9WZHDjyRx/apv MJbeH5bbB6WxooA4NpCMwRbgIJdlocSUPiUQ7SC9NvZpGjdTTin1TmvCIS1/zGWe5ofM86sIC zCURttpBs5CH6gcyNOYCwfUO7Ed45rMupRQdBhg38GzuJbpFSl9A85ovWkBXRLF2n6IyGyJGp bJgEKRu6M7S3Gg0lVLRXVVxVqAiMV2e0B7Yf1ffd/5vYycbkP72ZhJfKPbgcE6naWGIQ0AfIb knBd7KxhSTqEzIqTmZHqEkcCCE1Dgi+nOwzsFLvscM3O+jFT5L2AmciwWsOpRu+3uHtNK9hE+ XvNiERzJYepOaCk7SVXbgLA3YkBGb2oVqxjnbiNtnmi0DLseUBsuygwR2LeGSruPcjvV1j4Jk 2AO/D9NyX0UEpYdKXmg8ki0/N8pfdEzLezVc+hATYQ/Kj6gAn+uol7nRpHKzgaFKri5e98hce oBX07m2UVBxgVuJNLrXCYYx/qLrewR8R5SSxaVNmjuv5SBDjFt1ZjpuocmHPNPzLqedINavQw ZHa1+B/i4so5uBmRR2P+xykrXvdaZoPpSIFGJp1bVMbLzl+9oNKv3fyzO4D3QN1ClVpJx2mZr u1erPP0OiCtf8yAPsWfI2hGTJnkOKyvFWqlMVUiMGt9mxmItPlpCLZgTwQ67tvgcmtYfztF X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200918_084653_794686_7EA177B1 X-CRM114-Status: GOOD ( 18.22 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.134 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.126.134 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The epoll_wait() syscall has a special version for OABI compat mode to convert the arguments to the EABI structure layout of the kernel. However, the later epoll_pwait() syscall was added in arch/arm in linux-2.6.32 without this conversion. Use the same kind of handler for both. Fixes: 369842658a36 ("ARM: 5677/1: ARM support for TIF_RESTORE_SIGMASK/pselect6/ppoll/epoll_pwait") Cc: stable@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Arnd Bergmann --- arch/arm/kernel/sys_oabi-compat.c | 37 ++++++++++++++++++++++++++++--- arch/arm/tools/syscall.tbl | 2 +- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c index 0203e545bbc8..a2b1ae01e5bf 100644 --- a/arch/arm/kernel/sys_oabi-compat.c +++ b/arch/arm/kernel/sys_oabi-compat.c @@ -264,9 +264,8 @@ asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd, return do_epoll_ctl(epfd, op, fd, &kernel, false); } -asmlinkage long sys_oabi_epoll_wait(int epfd, - struct oabi_epoll_event __user *events, - int maxevents, int timeout) +static long do_oabi_epoll_wait(int epfd, struct oabi_epoll_event __user *events, + int maxevents, int timeout) { struct epoll_event *kbuf; struct oabi_epoll_event e; @@ -299,6 +298,38 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, return err ? -EFAULT : ret; } +SYSCALL_DEFINE4(oabi_epoll_wait, int, epfd, + struct oabi_epoll_event __user *, events, + int, maxevents, int, timeout) +{ + return do_oabi_epoll_wait(epfd, events, maxevents, timeout); +} + +/* + * Implement the event wait interface for the eventpoll file. It is the kernel + * part of the user space epoll_pwait(2). + */ +SYSCALL_DEFINE6(oabi_epoll_pwait, int, epfd, + struct oabi_epoll_event __user *, events, int, maxevents, + int, timeout, const sigset_t __user *, sigmask, + size_t, sigsetsize) +{ + int error; + + /* + * If the caller wants a certain signal mask to be set during the wait, + * we apply it here. + */ + error = set_user_sigmask(sigmask, sigsetsize); + if (error) + return error; + + error = do_oabi_epoll_wait(epfd, events, maxevents, timeout); + restore_saved_sigmask_unless(error == -EINTR); + + return error; +} + struct oabi_sembuf { unsigned short sem_num; short sem_op; diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl index 171077cbf419..39a24bee7df8 100644 --- a/arch/arm/tools/syscall.tbl +++ b/arch/arm/tools/syscall.tbl @@ -360,7 +360,7 @@ 343 common vmsplice sys_vmsplice 344 common move_pages sys_move_pages 345 common getcpu sys_getcpu -346 common epoll_pwait sys_epoll_pwait +346 common epoll_pwait sys_epoll_pwait sys_oabi_epoll_pwait 347 common kexec_load sys_kexec_load 348 common utimensat sys_utimensat_time32 349 common signalfd sys_signalfd