lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <71a52b361c23ab8f32e50bda927cdb07157ae582.1438170155.git.baolin.wang@linaro.org>
Date:	Fri,  8 Apr 2016 14:02:12 +0800
From:	Baolin Wang <baolin.wang@...aro.org>
To:	serge.hallyn@...onical.com, james.l.morris@...cle.com,
	serge@...lyn.com, john.stultz@...aro.org, tglx@...utronix.de
Cc:	pmoore@...hat.com, sds@...ho.nsa.gov, keescook@...omium.org,
	john.johansen@...onical.com, casey@...aufler-ca.com,
	agruenba@...hat.com, viro@...iv.linux.org.uk, neilb@...e.de,
	jann@...jh.net, broonie@...nel.org, christopher.s.hall@...el.com,
	pang.xunlei@...aro.org, harald@...ib.org, arnd@...db.de,
	baolin.wang@...aro.org, linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org
Subject: [RESEND PATCH v2 4/5] time: Introduce do_sys_settimeofday64()

The do_sys_settimeofday() function uses a timespec, which is not year
2038 safe on 32bit systems.

Thus this patch introduces do_sys_settimeofday64(), which allows us to
transition users of do_sys_settimeofday() to using 64bit time types.

Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
 include/linux/timekeeping.h |   15 +++++++++++++--
 kernel/time/time.c          |    8 ++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 657ea03..dc60400 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -11,8 +11,19 @@ extern int timekeeping_suspended;
  */
 extern void do_gettimeofday(struct timeval *tv);
 extern int do_settimeofday64(const struct timespec64 *ts);
-extern int do_sys_settimeofday(const struct timespec *tv,
-			       const struct timezone *tz);
+extern int do_sys_settimeofday64(const struct timespec64 *tv,
+				 const struct timezone *tz);
+static inline int do_sys_settimeofday(const struct timespec *tv,
+				      const struct timezone *tz)
+{
+	struct timespec64 ts64;
+
+	if (!tv)
+		return -EINVAL;
+
+	ts64 = timespec_to_timespec64(*tv);
+	return do_sys_settimeofday64(&ts64, tz);
+}
 
 /*
  * Kernel time accessors
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 85d5bb1..5d00da4 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -160,15 +160,15 @@ static inline void warp_clock(void)
  * various programs will get confused when the clock gets warped.
  */
 
-int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
+int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz)
 {
 	static int firsttime = 1;
 	int error = 0;
 
-	if (tv && !timespec_valid(tv))
+	if (tv && !timespec64_valid(tv))
 		return -EINVAL;
 
-	error = security_settime(tv, tz);
+	error = security_settime64(tv, tz);
 	if (error)
 		return error;
 
@@ -186,7 +186,7 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
 		}
 	}
 	if (tv)
-		return do_settimeofday(tv);
+		return do_settimeofday64(tv);
 	return 0;
 }
 
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ