From patchwork Fri Dec 7 21:18:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 153212 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp981850ljp; Fri, 7 Dec 2018 13:18:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/X2lsr3F4TrihjIUEFgcmHjiufs9KdFAbalo83nl3OmYdPclyk+nwZa4ZeeazskaUP9Ove+ X-Received: by 2002:a17:902:3064:: with SMTP id u91mr3530713plb.325.1544217506862; Fri, 07 Dec 2018 13:18:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544217506; cv=none; d=google.com; s=arc-20160816; b=jgL9XbJuCvPzBrM90IorgB6dqXjUygxvRob/14Lf8yyN2KM5H13PqnNMkMvhEWFROm HHq/2sapRzTIQh97ddFIDJcINkE+sAw+2FyXaW0ncDWBshtoTj0qBrrpXspBIEPP66vx 2uuirpKMPScrTTRWqGtKrKzRdfZxH7m3fMn8A9bzupGqziryVPb1ZVrsHGmdy4RpdvGH YZI4VrQ3cRjlvLof9BElCVF6o3db2noXml5vYQ9teVxKBEB12QUDFJiWXzy91j2TaodU YcF4pDC1xURxcx0v9GsLSDlmS1YsVga3epcSBYs4rW5oABXrEYuX0xIqu0BRGni04jWp kFMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=IY0qpYJrGYW+/dtyvT6rfSUemJG59MXZpKq9Bi9rdJA=; b=G3IjNa/6H74/GNU2HYLzdyLSjRqmL8ckcWVTrX6LWm1Uq7pMW74pSHE4u0c41drCkW m6LVmE848wtabXg0WkL4V3Jpo7bRaQ5o3KT6QIqbr7nmHnvW3UJsIf9iTPeSJVA/u4Hi 2xZuDBls5F27e1hZM+nit1iuHyLuBuvnqRDZqHvjScvsMmGh5KKDJ6bR8Bm5sllQxV6X d3Eb1JLe4PTsu5T26DVfvkn/U0HvJ4JvpyaWR5dmlB7AhdjLUBvDyzMmxLiBAlgzgjvK sQELZ35QGAXqNNr/Bwg0mpaGVXTJBf37GheEakTkCkQ6uaOb6v/JuzhqFB33QbPEuM5I zEWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si3890310pls.16.2018.12.07.13.18.26; Fri, 07 Dec 2018 13:18:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726218AbeLGVSY (ORCPT + 31 others); Fri, 7 Dec 2018 16:18:24 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:56405 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbeLGVSU (ORCPT ); Fri, 7 Dec 2018 16:18:20 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MJV9M-1gkiXU0plQ-00Jp7U; Fri, 07 Dec 2018 22:18:12 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org Cc: linux-kernel@vger.kernel.org, Deepa Dinamani , John Stultz , Thomas Gleixner , linux-api@vger.kernel.org, Arnd Bergmann Subject: [PATCH 5/5] y2038: signal: Add compat_sys_rt_sigtimedwait_time64 Date: Fri, 7 Dec 2018 22:18:08 +0100 Message-Id: <20181207211808.328719-6-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181207211808.328719-1-arnd@arndb.de> References: <20181207211808.328719-1-arnd@arndb.de> X-Provags-ID: V03:K1:jaYEvBfisS0VH6w5saqRe9sT8/XD5lZ11dVe3XVzU/Ndgu+b6m/ 5f0AKwRVduUQJNEgwEsPlH1qf3xV07PTRj6bgLonKVxVhTvwXKjaTTEA74SzOUI88WlUGk4 DFvuQM4IUYcbVnhTuMZCrBwLvaZxJRCktBLK36xV/Piard5WrCAyioBdghpyNeu2eSTwoFi W3HCDot4zg0KIiunb8z4A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:/KDsyr0jmQw=:DqxU95dJYhhoXYeHZtYGXi g9Exk5h5cFbIecgVxX+9WCH07VLNbhZ1RyXnXiH4+Lw/uPt7So8SjfRvjZ37KSDMMMYDs0frx xvubZGF9wKeyRHsuLy5TPGRadoSCmAUprQAfKXENgZ6E84UxD4EQJh0XjOUEd5StKUO7aQPgm hgwqKiQuDzvXYl+Y83PH5fWO7VaD5C47yu6380li+xVe72uFYn92pK+giga4DTuYuRO8hURpg xz+f7xDUnGBD3RyiG1l88mujdC0cYtyiNbWQNBH0Vl1K0oeG8kZhQg92nIFxHeP+xCcXiTRbn QhAb/Zj6+B4c2gIZntpyHxZIP/hrImvH5rEc8bixo62C2LNJQ7JRXe68loV7oH+gpBqCfrmYJ 2xnkAuR0y+8LDaTQGNftp9XE/MyJKeE3NKT7tVr/UvHb5SC1h0TsCkQL/lZ6D9BWICFKuyO3H rhLIqHjV0jsjpf0fn5g8ueOuv1GY3jsiuT5nUALzxY8mEg1GSGWOlZ4biMizGKiCvkTnKeWdv kx3AGInoMpy6Ndqfc25+IDCPTDHRE0TjnjBFhywcmckzo10Eb1x4F9I6LkTBRIiOjg1ZnkBEf ff8BO9o20AmnzehQtNBJBQ3kKeQ/b9QuL9LHQ85GpxeNp6D21Tg48VdJKwvrIleRNVoGapBKY lD6JadOk5mCxaPRwvF1qL5fVrnhS9Bdx/b7xTzRF6uEsgptlYsgBE6uFS4mAjlfLerRRoXcrW cglDz0j240NbrKFgPvNZozatpUCdglVTXzsLww== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that 32-bit architectures have two variants of sys_rt_sigtimedwaid() for 32-bit and 64-bit time_t, we also need to have a second compat system call entry point on the corresponding 64-bit architectures. The traditional system call keeps getting handled by compat_sys_rt_sigtimedwait(), and this adds a new compat_sys_rt_sigtimedwait_time64() that differs only in the timeout argument type. The naming remains a bit asymmetric for the moment. Ideally we would want to have compat_sys_rt_sigtimedwait_time32() for the old version and compat_sys_rt_sigtimedwait() for the new one to mirror the names of the native entry points, but renaming the existing system call tables causes unnecessary churn. I would suggest renaming all such system calls together at a later point. Signed-off-by: Arnd Bergmann --- include/linux/compat.h | 3 +++ kernel/signal.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) -- 2.18.0 diff --git a/include/linux/compat.h b/include/linux/compat.h index 72969d303434..3bc5f218efd8 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -788,6 +788,9 @@ asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset, asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese, struct compat_siginfo __user *uinfo, struct old_timespec32 __user *uts, compat_size_t sigsetsize); +asmlinkage long compat_sys_rt_sigtimedwait_time64(compat_sigset_t __user *uthese, + struct compat_siginfo __user *uinfo, + struct __kernel_timespec __user *uts, compat_size_t sigsetsize); asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig, struct compat_siginfo __user *uinfo); /* No generic prototype for rt_sigreturn */ diff --git a/kernel/signal.c b/kernel/signal.c index be6744cd0a11..53e07d97ffe0 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3366,6 +3366,37 @@ SYSCALL_DEFINE4(rt_sigtimedwait_time32, const sigset_t __user *, uthese, #endif #ifdef CONFIG_COMPAT +COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait_time64, compat_sigset_t __user *, uthese, + struct compat_siginfo __user *, uinfo, + struct __kernel_timespec __user *, uts, compat_size_t, sigsetsize) +{ + sigset_t s; + struct timespec64 t; + kernel_siginfo_t info; + long ret; + + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (get_compat_sigset(&s, uthese)) + return -EFAULT; + + if (uts) { + if (get_timespec64(&t, uts)) + return -EFAULT; + } + + ret = do_sigtimedwait(&s, &info, uts ? &t : NULL); + + if (ret > 0 && uinfo) { + if (copy_siginfo_to_user32(uinfo, &info)) + ret = -EFAULT; + } + + return ret; +} + +#ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct compat_siginfo __user *, uinfo, struct old_timespec32 __user *, uts, compat_size_t, sigsetsize) @@ -3396,6 +3427,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, return ret; } #endif +#endif /** * sys_kill - send a signal to a process