2.6.8.1: xtime value may become incorrect

From: Vladimir Grouzdev
Date: Mon Sep 27 2004 - 10:26:22 EST



The xtime value may become incorrect when the
update_wall_time(ticks) function is called with "ticks" > 1.
In such a case, the xtime variable is updated multiple times
inside the loop but it is normalized only once outside of
the loop.

This bug was reported at:

http://bugme.osdl.org/show_bug.cgi?id=3403

Patch to fix the problem:

diff -Nrca linux-2.6.8.1/kernel/timer.c linux-2.6.8.1-patched/kernel/timer.c
*** linux-2.6.8.1/kernel/timer.c 2004-08-14 12:56:00.000000000 +0200
--- linux-2.6.8.1-patched/kernel/timer.c 2004-09-27 16:24:48.000000000 +0200
***************
*** 776,788 ****
do {
ticks--;
update_wall_time_one_tick();
} while (ticks);
-
- if (xtime.tv_nsec >= 1000000000) {
- xtime.tv_nsec -= 1000000000;
- xtime.tv_sec++;
- second_overflow();
- }
}

static inline void do_process_times(struct task_struct *p,
--- 776,787 ----
do {
ticks--;
update_wall_time_one_tick();
+ if (xtime.tv_nsec >= 1000000000) {
+ xtime.tv_nsec -= 1000000000;
+ xtime.tv_sec++;
+ second_overflow();
+ }
} while (ticks);
}

static inline void do_process_times(struct task_struct *p,


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/