From patchwork Fri Oct 30 15:49:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 320002 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1524781ilc; Fri, 30 Oct 2020 08:50:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAdwoK3DlKdGst0KJyeHpUOT/Ye/rC+KImoPo4It9a+ER6+Ho3AsdGBVct9eieGAJg3BLd X-Received: by 2002:a17:906:2657:: with SMTP id i23mr3293609ejc.14.1604073015136; Fri, 30 Oct 2020 08:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604073015; cv=none; d=google.com; s=arc-20160816; b=AdiwrsYCe4JMzLdMIXaMr3OEUjJ+OAfCMPj5Kd/S9I6X0/gfXLkWiysis0aa9UhqZ6 zdk9buQYe48+ShLs5gzQbwChLQAyyZwMv6kbHuLdjfhmVivrgE6PtZf1+yBxnRlBAAlz EjYVFk/M9oqUINFpIQXFIP9lyZIMkHXymoUckbYIYnMK5DQFiYVE7Cq0cUuor1cvb5V+ BoqoEq0ziSzcD1CjJ0I0wciH2Gnt61LjTsj6jCtrMkJ7lgt5TFKnkX0qzfIpvGF/pfQ4 I5WlTK0VmgpIP9UVyMI3+F6IAfKjbCo+kIfnSzEjBE/4ZPgxea9fbw4Byq82+ELK1YjC k+XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Sbfm57XDzq4N1uQNIukJsZdh4dZj2xD5w35PVOdzi1c=; b=IqA/6wBBkgA2aWwvNOYmhLbvAJKrn0Qx4UNHWCqqgNRpAlqYi2JdE1b3tq9mSJcFg8 fM8WNeKHfdaiF215tXEKh5q7ZA7VjZBX2rDVMHdBviRvU1Xg6wp99SBiMR7z8fCYa0Uf jLYIcDVUwFXAgqj7EM4FT5adkVpWj2WDEwOKcV9VSld9MWYZYLIEgNMmnVLAeI2wnS44 wPizW4PjNcMueh+I+ged0MEFrCp/B6M4HlM/OZds7DT6qDnastcqFXv75N05HSGVEWD/ g0iliGKqQLb+zvtQO8g1ZsIyMzeknakbL1ZGUT/1ewvOZX2LV+E9DBN943LAPf7pP97c BPDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rHMmLQWj; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga26si4513661ejc.292.2020.10.30.08.50.14; Fri, 30 Oct 2020 08:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rHMmLQWj; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727204AbgJ3Ptg (ORCPT + 15 others); Fri, 30 Oct 2020 11:49:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:42068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727195AbgJ3Ptf (ORCPT ); Fri, 30 Oct 2020 11:49:35 -0400 Received: from localhost.localdomain (HSI-KBW-46-223-126-90.hsi.kabel-badenwuerttemberg.de [46.223.126.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95439221EB; Fri, 30 Oct 2020 15:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604072974; bh=V6qzY14LfJ5Qyf+Zp/oXQxezqCq4VbzoDYPwNxOKOhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rHMmLQWj/hrKi5keJjlqsxQMjXZrNmlZKbjy2paFODhj+RqM7NouoGE8VKn2UoUkM rESg3IOM/PSjlrHek6TbvICXdfd2VegMQXfqY/RnZzQhXYViEg8hDoitR7Ygtfhc1T mukGs/RapqPzH4p9SMRx1iDhzwju+1vManV9j6Zs= From: Arnd Bergmann To: Russell King , Christoph Hellwig Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, viro@zeniv.linux.org.uk, linus.walleij@linaro.org, arnd@arndb.de, stable@vger.kernel.org Subject: [PATCH 3/9] ARM: oabi-compat: add epoll_pwait handler Date: Fri, 30 Oct 2020 16:49:13 +0100 Message-Id: <20201030154919.1246645-3-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201030154919.1246645-1-arnd@kernel.org> References: <20201030154519.1245983-1-arnd@kernel.org> <20201030154919.1246645-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann 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(-) -- 2.27.0 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 d056a548358e..330cf0aa04c4 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