From patchwork Fri Dec 7 21:18:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 153216 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp982164ljp; Fri, 7 Dec 2018 13:18:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/WHoiroSyiuZRzC1GKjsrOLoRujAJ2bQv0Gg6L/GnW9p5nWtBHVj0/wP7BhJl/O81AVLiNQ X-Received: by 2002:a17:902:4401:: with SMTP id k1mr3626046pld.307.1544217525290; Fri, 07 Dec 2018 13:18:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544217525; cv=none; d=google.com; s=arc-20160816; b=XEJ+6NIn46+anVbov3Ws1HOpCjwcdFEyJWMOfspGYRCkpcog36YVYZUyTlVlPDiL2I Ph8uu6PWmkN6v0/+CcibJChz6H1mEhViL4Av/JUBHJB1ATLSwi1GWU9ZgRR8LWOFR9Cs OopxbIcMWH9alCyFjWc3fj+V7Q75zV/cHewp2l9X05OMXELZsJtFdt9nnTeUfwZmF2JU nnfvMC05KFr60HFIiDvEKmRdLpgmYya37aFIKAZBktPYd1nkvNDXVzDQOnDMBkKA7xZ5 pa1pORxG446QQ2aW7boxa9+rxY2KZ2LiaRvXQAt+b4lZeUjFXD6gg0+G0SceFjiWe+TV 7eAg== 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=pr5ecYhHSFIsJkPVCC6kJspJ3eJH9Gxmc/N/Y+vp9s4=; b=f0wOpKCVzD4k/+KFBpCxAsnu7mMYp1DrXusO77+I9aUaeSwBBO7TvdiOoibTG/+Jtg zZxHehqg62Dlz/xSnhOtrfcWuypSYJqUmSI7mIX8WmLIheyQhyfUqlpT2FgW9B896qmm mI3P8AGha82hNYXdDJvNzoVJkacx3Pmx4TWRv4EMKG8wg5U9c53R1IdmcJ2Hw1FnYfWk XQPAZvMKKH2H62YzCP4h/nFVYpRriOM8BNYn7wuBVHekgGuNruHK2sOV2+Duncb04rFf wndGX2MxPrbpANfl+M1YP4l+GRDfqDCC9jiHuvSEftlSSJ64qpcTwSUpl5gxsGXm7hd1 F/1A== 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 n18si4080282pfj.30.2018.12.07.13.18.44; Fri, 07 Dec 2018 13:18:45 -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 S1726294AbeLGVSn (ORCPT + 31 others); Fri, 7 Dec 2018 16:18:43 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:51673 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726093AbeLGVSU (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 1Mw9Lw-1hN4Yp3l8m-00s3Tc; 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 4/5] y2038: signal: Add sys_rt_sigtimedwait_time32 Date: Fri, 7 Dec 2018 22:18:07 +0100 Message-Id: <20181207211808.328719-5-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:9/bXOgXlO7u0sJ91CfOocMwpttHH+17Xfkde7QGcqXCtXbRVlQA aCxKzXNfyUMgkD/nEzNaRk6f6zxGFgltNuujLCwBsz6QRGW9tEs58FnD/vunLWBOs7L5XDY CeVGkPbfnpP7YIlgQgFreUF/0MvL2y8MZgcMyDTqq+OV4WtBb7Pcq0RRVKniP69gIbUY227 tOGU9aTjSsfho46XO/L+Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:ZYi/Jb0Y4ww=:FOp45kB5zlBpwkxzYpmhaM J/hZGky1w0Q0yc97fAZMHtDHgOfYpkunNiuXthtUdUxJnEnbjAQVj5kJG7gvEYPyRaaJFUWs1 aQwDLMbC4pKzSmyR4OgfjfXQCS+Jlf+M4fRweMoXR4UlNy53hyY61zYZmtCgcwmDUd1Obx2cn NcBT6DrskLhQcL7EktWayR7xDHDlXX8XodcMjaVwXwxnpqTG7CLDulzVhQvTKb6cyavteR60y yax+3kEUBsdRKQvCB3Sm/Pnhy2RWFCVl2Ss9JRlAN4YHPVijV3n8WmDQXmvVhdbCKF15p5S+C lbKQf3rbApAJ0XcGeOEyD1l/ozkU/5n4nUp5ABH38CoJerpPlRq8tHlRdXVIcs4GgG64TrD9K BF6+UE01Xdb83HkjGWN7WV2SyfPv6JHAI3FwGn1hC/46XnfkCpEqzW4WdKaN1zkonbvkA8eOM f9TG8UaKlkdTD6FZq9rRcDxQCxJ2wRRdEmBF0YeU18t/HZ8H4HrBRwUZWbf0fUDlP+UF+/G25 p5Cb3H+OgtzliyO9OXeQjSMEbsvsc8kfmEWuvo/42pHVbcqtB5Nj+zIc+UqggR6iGDcXLfA+K Zxn5o+0fV4uaqsD3kZrsX5dNxoBltBp3Uo7bdR0iXi/oyF0OGxTZiXsJ2Wy/iS4WLMxxh9ntK FhNpbs4+H4pMTppNeLbCib8FGRmAjL/AVXWF7/T6i5M9HmUOFv0TFaHhYpfZdxVAuwOo8iuPA eNu7aFdDJNjhp16YPsTRHbq4d+9yaYj51fOfTQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once sys_rt_sigtimedwait() gets changed to a 64-bit time_t, we have to provide compatibility support for existing binaries. An earlier version of this patch reused the compat_sys_rt_sigtimedwait entry point to avoid code duplication, but this newer approach duplicates the existing native entry point instead, which seems a bit cleaner. Signed-off-by: Arnd Bergmann --- include/linux/syscalls.h | 4 ++++ kernel/signal.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) -- 2.18.0 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 03cda6793be3..251979d2e709 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -649,6 +649,10 @@ asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese, siginfo_t __user *uinfo, const struct __kernel_timespec __user *uts, size_t sigsetsize); +asmlinkage long sys_rt_sigtimedwait_time32(const sigset_t __user *uthese, + siginfo_t __user *uinfo, + const struct old_timespec32 __user *uts, + size_t sigsetsize); asmlinkage long sys_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t __user *uinfo); /* kernel/sys.c */ diff --git a/kernel/signal.c b/kernel/signal.c index 3c8ea7a328e0..be6744cd0a11 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3332,6 +3332,39 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, return ret; } +#ifdef CONFIG_COMPAT_32BIT_TIME +SYSCALL_DEFINE4(rt_sigtimedwait_time32, const sigset_t __user *, uthese, + siginfo_t __user *, uinfo, + const struct old_timespec32 __user *, uts, + size_t, sigsetsize) +{ + sigset_t these; + struct timespec64 ts; + kernel_siginfo_t info; + int ret; + + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (copy_from_user(&these, uthese, sizeof(these))) + return -EFAULT; + + if (uts) { + if (get_old_timespec32(&ts, uts)) + return -EFAULT; + } + + ret = do_sigtimedwait(&these, &info, uts ? &ts : NULL); + + if (ret > 0 && uinfo) { + if (copy_siginfo_to_user(uinfo, &info)) + ret = -EFAULT; + } + + return ret; +} +#endif + #ifdef CONFIG_COMPAT COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, struct compat_siginfo __user *, uinfo,