From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753928AbdFMWP2 (ORCPT ); Tue, 13 Jun 2017 18:15:28 -0400 Received: from terminus.zytor.com ([65.50.211.136]:51625 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752695AbdFMWP0 (ORCPT ); Tue, 13 Jun 2017 18:15:26 -0400 Date: Tue, 13 Jun 2017 15:11:53 -0700 From: tip-bot for Al Viro Message-ID: Cc: hpa@zytor.com, john.stultz@linaro.org, peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk Reply-To: john.stultz@linaro.org, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk In-Reply-To: <20170607084241.28657-15-viro@ZenIV.linux.org.uk> References: <20170607084241.28657-15-viro@ZenIV.linux.org.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] time: Move compat_time()/stime() to native Git-Commit-ID: b180db2c8ca6692a10b79631cadc18d03303d494 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: b180db2c8ca6692a10b79631cadc18d03303d494 Gitweb: http://git.kernel.org/tip/b180db2c8ca6692a10b79631cadc18d03303d494 Author: Al Viro AuthorDate: Wed, 7 Jun 2017 09:42:40 +0100 Committer: Thomas Gleixner CommitDate: Wed, 14 Jun 2017 00:00:45 +0200 time: Move compat_time()/stime() to native Signed-off-by: Al Viro Signed-off-by: Thomas Gleixner Cc: John Stultz Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170607084241.28657-15-viro@ZenIV.linux.org.uk --- kernel/compat.c | 40 ---------------------------------------- kernel/time/time.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/kernel/compat.c b/kernel/compat.c index 4544eb6..aa7b9a2 100644 --- a/kernel/compat.c +++ b/kernel/compat.c @@ -739,46 +739,6 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese, return ret; } -#ifdef __ARCH_WANT_COMPAT_SYS_TIME - -/* compat_time_t is a 32 bit "long" and needs to get converted. */ - -COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc) -{ - compat_time_t i; - struct timeval tv; - - do_gettimeofday(&tv); - i = tv.tv_sec; - - if (tloc) { - if (put_user(i,tloc)) - return -EFAULT; - } - force_successful_syscall_return(); - return i; -} - -COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr) -{ - struct timespec tv; - int err; - - if (get_user(tv.tv_sec, tptr)) - return -EFAULT; - - tv.tv_nsec = 0; - - err = security_settime(&tv, NULL); - if (err) - return err; - - do_settimeofday(&tv); - return 0; -} - -#endif /* __ARCH_WANT_COMPAT_SYS_TIME */ - #ifdef CONFIG_NUMA COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages, compat_uptr_t __user *, pages32, diff --git a/kernel/time/time.c b/kernel/time/time.c index 400662f..e5d4499 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -100,6 +100,47 @@ SYSCALL_DEFINE1(stime, time_t __user *, tptr) #endif /* __ARCH_WANT_SYS_TIME */ +#ifdef CONFIG_COMPAT +#ifdef __ARCH_WANT_COMPAT_SYS_TIME + +/* compat_time_t is a 32 bit "long" and needs to get converted. */ +COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc) +{ + struct timeval tv; + compat_time_t i; + + do_gettimeofday(&tv); + i = tv.tv_sec; + + if (tloc) { + if (put_user(i,tloc)) + return -EFAULT; + } + force_successful_syscall_return(); + return i; +} + +COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr) +{ + struct timespec tv; + int err; + + if (get_user(tv.tv_sec, tptr)) + return -EFAULT; + + tv.tv_nsec = 0; + + err = security_settime(&tv, NULL); + if (err) + return err; + + do_settimeofday(&tv); + return 0; +} + +#endif /* __ARCH_WANT_COMPAT_SYS_TIME */ +#endif + SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv, struct timezone __user *, tz) {