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] [day] [month] [year] [list]
Date:	Tue, 25 Aug 2009 07:13:40 GMT
From:	tip-bot for Hiroshi Shimamoto <h-shimamoto@...jp.nec.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
	johnstul@...ibm.com, schwidefsky@...ibm.com,
	h-shimamoto@...jp.nec.com, dwalker@...o99.com, tglx@...utronix.de,
	mingo@...e.hu
Subject: [tip:timers/core] timekeeping: Fix invalid getboottime() value

Commit-ID:  36d47481b3824b661b464077db95d447984df799
Gitweb:     http://git.kernel.org/tip/36d47481b3824b661b464077db95d447984df799
Author:     Hiroshi Shimamoto <h-shimamoto@...jp.nec.com>
AuthorDate: Tue, 25 Aug 2009 15:08:30 +0900
Committer:  Ingo Molnar <mingo@...e.hu>
CommitDate: Tue, 25 Aug 2009 09:09:02 +0200

timekeeping: Fix invalid getboottime() value

Don't use timespec_add_safe() with wall_to_monotonic, because
wall_to_monotonic has negative values which will cause overflow
in timespec_add_safe(). That makes btime in /proc/stat invalid.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@...jp.nec.com>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: John Stultz <johnstul@...ibm.com>
Cc: Daniel Walker <dwalker@...o99.com>
LKML-Reference: <4A937FDE.4050506@...jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>


---
 kernel/time/timekeeping.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 03cbeb3..fb0f46f 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -826,9 +826,11 @@ void update_wall_time(void)
  */
 void getboottime(struct timespec *ts)
 {
-	struct timespec boottime;
+	struct timespec boottime = {
+		.tv_sec = wall_to_monotonic.tv_sec + total_sleep_time.tv_sec,
+		.tv_nsec = wall_to_monotonic.tv_nsec + total_sleep_time.tv_nsec
+	};
 
-	boottime = timespec_add_safe(wall_to_monotonic, total_sleep_time);
 	set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ