From patchwork Mon Sep 7 15:36:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11761291 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 C6F5E92C for ; Mon, 7 Sep 2020 15:39:25 +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 9437521473 for ; Mon, 7 Sep 2020 15:39:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XYqd3+v9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9437521473 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=LsRglxFzTLKeyO9IeOTHnllz0IpS+76dkgPG1h3HF3o=; b=XYqd3+v9gtOQRIH1RM8jIlS1h eUJO324KDfVhv4rh/DitaUzlxeqx3HbWJhFANdSZkQNo1WpQbY4dD+MIawEBm8aCRGw01Lj6B/P7h RmDjmmyWbvAW8/Gm6DSsBqbm1qVEtt87HTAvpxF9IStCONxDa9Jaj1p0BZDIPAXjSEb0aDU1fTr5d ExPOcQqGowDS330yMIU8edPDDh5cBFIs1WBdXcIxbhXqenM5TvZUxn7F9e+OuNp+MbN+avU1vxRMV +Do9i1e6gHiW5Jlk8pQHwo4nYttewZUPU1losA3r9meERSIvT9TEvghzSGq2OkVso76VwNJnWJ/kQ nHdf2hJqA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFJDl-0003SD-Sp; Mon, 07 Sep 2020 15:38:17 +0000 Received: from mout.kundenserver.de ([212.227.17.24]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFJDj-0003RA-GO for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2020 15:38:16 +0000 Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPA (Nemesis) id 1MJV9S-1jzqjP0Umm-00Jnof; Mon, 07 Sep 2020 17:38:07 +0200 From: Arnd Bergmann To: Christoph Hellwig , Russell King Subject: [PATCH 3/9] ARM: oabi-compat: add epoll_pwait handler Date: Mon, 7 Sep 2020 17:36:44 +0200 Message-Id: <20200907153701.2981205-4-arnd@arndb.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200907153701.2981205-1-arnd@arndb.de> References: <20200907153701.2981205-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:mvJo34mtjWtAx5UFkxoUsY6BYLk5TxizfdfEI/T6x5LXUToj2Gs eq4jhvfQgCUKPTs9VI3GmZeo30Whz44Ox+rBSFU6/8DoOpbXTNq3BKOS7KvtD7vitnLMev4 ZFISkwZY/310lkDvmmlXoZ8nLNeLLkmUhcFehyL7d6y1wwXDF0+lOSnnoh0frh3q4KA+91I Lb4TvMtrLPcnWR4BAJPaQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:gCeswl9BfCM=:8DnlAUEq/JrLIRCAQnq+4c heUMcytFGL9tiFJ1xdsFSFtVUhbROAfIR6rz5QWmrlX/3jRXPCNlSpz54jhN+BO26VW+BgXX4 sEajACaStSEJHDlxXlIftijP6E2P1WvTsh4QJpXE0NXaY7EqkQSJTN8eKqm95HRCAKs8JtXNn QIqYB2FoU8lTDlAmZceNhMALXWsqt1acoJMqa4SLBSLs/Oc0VIjw92LA4Y71Z5BRtV4QyX9Q9 LK7V1PUXYbDpHBtekYajXnJb5MiV5Vr6g0xfZBzTZRgQqgbGskNa0zWu72ME8DN5I3yGd4NLk faAv2ObSfUAJO/SPcKKVSuca2j1J1Rt70kYxlAYxHhqE+RrHnfH4i1RP5rzkdI7D/OHmQnLAI Ohtt/1M7hr74cjMJHnkMB6mfI0viumKX3SZPeJwT1XAzTpJOYgYyd3DAhIx2hnzw+IKK/7P+5 5OyThGF+d2nW42AyaJLWVvWHeQ4l9VmypwDGz1rH4GhoUH/OwhkzDgOWDDHvL//VYqg9oro2W PXL4keqq9nxuAolkORV0VIoZEeZIoIYRHKiLDXBkSEN9jo6ULRdgjtos9M23J7ieZ9jNoRbVk q54xAsqfU3vb6T5eX9rD6xUaYqcCoMrsqlv8lvRWAsRFBDy5YSuC5dschGvUASIVSTVr6pLEF w2qHMs4qdTq7B/85diKoKdCjBAr0L+wotV6N/fM+LfIMgGy+u/XAdCOQP/wk0UHjlazDk4p5j cfqs5phJHeJ50WwvwITuO9J38rpQLs8qdm5dPb1fu50nskyoGxHYfJNM6Pwd2Qu/GD8Eyo479 M4npqU27DepXRo8YACxDghI5/x51i6lxG89ailOeiMPg84cUKupPvgidmWDMN9W+EPw++Jp X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_113815_746447_71D0FB73 X-CRM114-Status: GOOD ( 17.59 ) 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_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.17.24 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 -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.17.24 listed in wl.mailspike.net] 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, Mikael Pettersson , Arnd Bergmann , linus.walleij@linaro.org, kernel@vger.kernel.org, Russell King , stable@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Viro , Russell King , Christian Brauner , Andrew Morton , 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 Signed-off-by: Arnd Bergmann Reviewed-by: Christoph Hellwig --- arch/arm/kernel/sys_oabi-compat.c | 35 ++++++++++++++++++++++++++++--- arch/arm/tools/syscall.tbl | 2 +- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c index 0203e545bbc8..2ce3e8c6ca91 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,36 @@ 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