From patchwork Thu Oct 1 14:12:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11811509 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 A34CA6CA for ; Thu, 1 Oct 2020 14:13:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 731A420872 for ; Thu, 1 Oct 2020 14:13:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 731A420872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8F8D28E0005; Thu, 1 Oct 2020 10:12:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 80A368E0001; Thu, 1 Oct 2020 10:12:57 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34E3C6B0072; Thu, 1 Oct 2020 10:12:57 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id DD7136B0071 for ; Thu, 1 Oct 2020 10:12:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7BB01181AE886 for ; Thu, 1 Oct 2020 14:12:56 +0000 (UTC) X-FDA: 77323547952.23.thing78_0308fd52719c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 560AC3760C for ; Thu, 1 Oct 2020 14:12:56 +0000 (UTC) X-Spam-Summary: 1,0,0,a052df58c05fb307,d41d8cd98f00b204,arnd@arndb.de,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1431:1437:1515:1535:1542:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3354:3865:3866:3867:3870:3871:3872:4250:4321:4605:5007:6119:6261:10004:11026:11473:11658:11914:12043:12160:12291:12296:12297:12438:12555:12663:12679:12683:12895:12986:13161:13229:13870:13894:14096:14181:14394:14721:21080:21324:21433:21451:21627:21795:21990:30051:30054,0,RBL:217.72.192.73:@arndb.de:.lbl8.mailshell.net-64.201.201.201 62.8.6.100;04yf4pawtjruanej1rhujzqpr7eu3op4789e36xbe34843yqer8jor8i96danib.s6ka4gyiz75zmci5imij9c5pmaqao8ssyqgrmmjw68betusf3c9c8wpkha1f7if.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:20,LUA_SUMMARY:none X-HE-Tag: thing78_0308fd52719c X-Filterd-Recvd-Size: 5298 Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 1 Oct 2020 14:12:55 +0000 (UTC) Received: from threadripper.lan ([46.223.126.90]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MvbJw-1kepec1eTe-00shEs; Thu, 01 Oct 2020 16:12:52 +0200 From: Arnd Bergmann To: Russell King , Christoph Hellwig Cc: Alexander Viro , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Arnd Bergmann , stable@vger.kernel.org Subject: [PATCH v3 03/10] ARM: oabi-compat: add epoll_pwait handler Date: Thu, 1 Oct 2020 16:12:26 +0200 Message-Id: <20201001141233.119343-4-arnd@arndb.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201001141233.119343-1-arnd@arndb.de> References: <20201001141233.119343-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:cWWCYuRJriYKt0llInUlGsi6sGZrKAuOlwaggzj3/coCoUzqfLK tdhpTdf+H1PnSpU5qTRkfZCY1eCG1Cjc26hA5rHMOatSmHap4G/tHtXis84Mc+nDdeUaSjS PlQBkFWU32fdiDbaBtMFwdhbryJMvp4bYkfA1tB83+ywMKEBtsP41yb1F5scXxc27obsYYl e2PBjElmQm1a2yMG97plw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1EcS5jnnr5c=:1nhTSp9Le4lI6Ga8UCr5JX ipyTMFNr/ZP7v+X4Nv+sXpevyJjaGWoU3bmRuRFg41lsTEICDGn80l+k1ld6seKph2+6q2K5+ bO9Kc4cwSs6KYjZ2k+XxJ8v7ThMQVqKLjWaNHd082KwpwKaqm2WD9OXB8PR6eB3VTG+U/fmci wYYlfW46pyc0F1RJGW2RW/0iud2hoOZQzFOnO3aEiv50e0+HSV+6mDhAT4d10Sc2elBtgfUnt i2JW60cF6AVPW4UpsI8PQ07ly1/EOe0NJ82Br6fqWl1Ts5OLWf6GJgpu0YngvC0VGa1anEcud IbX43EodVT/85TdzRFpvawl586wog/J/ico+QQrz9/hJppRGHWcxGqDqpeM4/eQQZL+2ehdSL WzQdmIeYblZCXeIWmpdvOzcoDPyx+eVnsv8Gjct0G5ibU6JD8129XNJe0FiqeEPNGwaBEolQ4 8FoffRKSXJ6obHkMZMlyPhjCVM+39A/2ljYk2fGfFlED5YbHhB4ktz0ctaDgehZ+BdIS71d/y crzTKNN7I5YHtfReJWyjg4LgFpgoMI3LppDnAwXFmLQAn6d3V1m9z+7jVrPEi9jY9BETXXmP1 u+17FAEZ+ICVJXW97PTALiByF5UQsDzfn68gPV+d2ihUq6WAqDN5k4h1ZNoz0BJfRoOKRWBO2 8vQObH3r/eEbkG47hp/76MVrYdp6B2VCvkXOTJVnp092ZbDmiHVv1VhuOPC2uOZBZLJdVWjOH +I7iC88PjghCZ/dX7e5ii0Lb5R7ZGFkt/WIAIwHGg+6lLckIAehVXLBmB3Q1Sc99unfuBq6PJ VHM/WoRyYYZ6w/XYDjLofdAonNAqxxzrfRwkIbNE/A9okryX3sbushKiYtKaRXzdQV77VmV X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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