From: Daniel Walker Date: Tue, 6 Mar 2007 09:42:11 +0000 (-0800) Subject: [PATCH] fix vsyscall settimeofday X-Git-Tag: v2.6.21-rc3~39 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90675a27fa3eb0e97f1d040b183cceb44316e669;p=linux-2.6 [PATCH] fix vsyscall settimeofday I've only seen this on x86_64. The vsyscall state only gets updated when a timer interrupts comes in. So if the time is set long before the next timer, there will be a period when a gettimeofday() won't reflect the correct time. I added an explicit update_vsyscall() during the settimeofday(), that way the vsyscall state doesn't get stale. Signed-off-by: Daniel Walker Cc: Thomas Gleixner Acked-by: Ingo Molnar Acked-by: John Stultz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/timer.c b/kernel/timer.c index ee0a2da4aa..797cccb864 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -862,6 +862,8 @@ int do_settimeofday(struct timespec *tv) clock->error = 0; ntp_clear(); + update_vsyscall(&xtime, clock); + write_sequnlock_irqrestore(&xtime_lock, flags); /* signal hrtimers about time change */