From patchwork Wed Apr 25 16:03:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 26969 Received: (qmail 58544 invoked by alias); 25 Apr 2018 16:04:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 58460 invoked by uid 89); 25 Apr 2018 16:04:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Hx-languages-length:1567 X-HELO: mout.kundenserver.de From: Arnd Bergmann To: y2038@lists.linaro.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, libc-alpha@sourceware.org, tglx@linutronix.de, netdev@vger.kernel.org, deepa.kernel@gmail.com, viro@zeniv.linux.org.uk, albert.aribaud@3adev.fr, Peter Zijlstra , Darren Hart , "Eric W. Biederman" , Dominik Brodowski Subject: [PATCH 17/17] y2038: signal: Add compat_sys_rt_sigtimedwait_time64 Date: Wed, 25 Apr 2018 18:03:11 +0200 Message-Id: <20180425160311.2718314-18-arnd@arndb.de> In-Reply-To: <20180425160311.2718314-1-arnd@arndb.de> References: <20180425160311.2718314-1-arnd@arndb.de> X-UI-Out-Filterresults: notjunk:1; V01:K0:WbVlpHaoNGg=:ZwReD+umxITXrp3SV90uTG 2wOE5mvsGkezl+JcfqILpWaKumCzXblvtd7NDNTzrFdob3t77cdrscxh6DwmMGYr2kLF174Mr 01HBaMIzLOQMmNlT+4b5BLC4I44vxo5KrPsKRJ/1hPN/7Ea7AAPM4Qr5oBtcpZCEdZvJfmWer CeX5h8Tpy2oFSPwvI3cSEaI0+nv9mo6ufoD/ER0fCumBGHFSpLtdOWL3BJjkTD5hpM3ExJnoO DH6XyF83pwvE62uziiZlk6T1f2vPrXcja7LbbEJvz77JnMZNN4lypZh2Lf0rWsArVvrIaB3N0 lArOTd4zTPyQdOwyK/BKlHvbn393DhW4zVNzLHPpP0nfwDKtlioGCtMJMKCGnxFZRFxg3iFTI 0aOtQbwy2yrgm6F9Fc5KFLHRGEe71hn2RR6hf6toFPO/JCUtVVKWkfZ9tVX0WrZ9YtBFMFCCX Zg9RjJTQjlhYxi4U7bu82V6QRhnqO612xLNr8DrBvymyLPhuyvYgGj1c/U68rBe4m8htYhEiR lK2s8BJm7jX+CMt9XZj9+ONGq4NRWSuw5SPZQUM2DtHWeltvDuMFJvoNhiRFzOd5/e6bogUHF vm43722rWpikKGmvx4Z/Sih/H8fwwxLiBa1eYHPflqATwcIOhe4UUQIWKm05SAbtQs4l9MP9A wTtxp1MMYnAJwY9MLwuzzw0eDGDw6lVd7C7G1ALcCq2XbmwtDIUO8/TpRd7gdo+2BbIk= 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. Signed-off-by: Arnd Bergmann --- kernel/signal.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/kernel/signal.c b/kernel/signal.c index 72609c6835fd..1927fcfa7077 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3249,6 +3249,38 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_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; + 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; +} +#endif + /** * sys_kill - send a signal to a process * @pid: the PID of the process