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-next>] [day] [month] [year] [list]
Date:	Mon, 17 Jan 2011 15:20:21 -0500
From:	"Shaffer, Scott" <scott.shaffer@...r.com>
To:	"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
CC:	"'tglx@...utronix.de'" <tglx@...utronix.de>,
	"'mingo@...e.hu'" <mingo@...e.hu>
Subject: [PATCH] fix bad delta time values in /proc/timer_list

elapsed times printed from /proc/timer_list are incorrect for the
CLOCK_REALTIME timer list.

print_timer() is passed monotonic nsecs as current time, but should
be passed monotonic nsecs + hrtimer_clock_base.offset for the
timer list it is printing.

This patch fixes CLOCK_REALTIME timer lists, and does not break
CLOCK_MONOTONIC timer lists.


This shows a thread's timer that is <10ms:

xunil2.ccur.com # grep -A 9 "cpu: 1" /proc/timer_list
cpu: 1
 clock 0:
  .base:       f67031d0
  .index:      0
  .resolution: 1 nsecs
  .get_time:   ktime_get_real
  .offset:     1294953310697580572 nsecs
active timers:
 #0: <f518ff3c>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, pthread_sleep2/7067
 # expires at 1295021767185712301-1295021767185712301 nsecs [in 1294953310698070434 to 1294953310698070434 nsecs]


With the patch below, that thread's timer looks like:

 #0: <f37d7f3c>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, pthread_sleep2/9403
 # expires at 1295022944770566772-1295022944770566772 nsecs [in 5305914 to 5305914 nsecs]


Signed-off-by: Scott Shaffer <scott.shaffer@...r.com>

--- a/kernel/time/timer_list.c	2011-01-04 19:50:19.000000000 -0500
+++ b/kernel/time/timer_list.c	2011-01-14 14:09:03.000000000 -0500
@@ -102,7 +102,8 @@ next_one:
 		tmp = *timer;
 		raw_spin_unlock_irqrestore(&base->cpu_base->lock, flags);
 
-		print_timer(m, timer, &tmp, i, now);
+		print_timer(m, timer, &tmp, i,
+			(now + ktime_to_ns(base->offset)));
 		next++;
 		goto next_one;
 	}
--
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