aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/vsyscall_64.c
diff options
context:
space:
mode:
authorTony Breeds <tony@bakeyournoodle.com>2007-10-18 06:04:57 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:20 -0400
commit2c6221483169ddd4c04797cd7296ed4fe52fcdd7 (patch)
tree1db73f0bf60b036abe995350637a9a3e916c0ec2 /arch/x86/kernel/vsyscall_64.c
parent6212e3a388fdda3f19fa660ef5a30edf54d1dcfd (diff)
Fix discrepancy between VDSO based gettimeofday() and sys_gettimeofday().
On platforms that copy sys_tz into the vdso (currently only x86_64, soon to include powerpc), it is possible for the vdso to get out of sync if a user calls (admittedly unusual) settimeofday(NULL, ptr). This patch adds a hook for architectures that set CONFIG_GENERIC_TIME_VSYSCALL to ensure when sys_tz is updated they can also updatee their copy in the vdso. Signed-off-by: Tony Breeds <tony@bakeyournoodle.com> Cc: Andi Kleen <ak@suse.de> Cc: Tony Luck <tony.luck@intel.com> Acked-by: John Stultz <johnstul@us.ibm.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/kernel/vsyscall_64.c')
-rw-r--r--arch/x86/kernel/vsyscall_64.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 8a67e282cb5e..f24e8acdec91 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -64,6 +64,16 @@ struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data =
64 .sysctl_enabled = 1, 64 .sysctl_enabled = 1,
65}; 65};
66 66
67void update_vsyscall_tz(void)
68{
69 unsigned long flags;
70
71 write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags);
72 /* sys_tz has changed */
73 vsyscall_gtod_data.sys_tz = sys_tz;
74 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
75}
76
67void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) 77void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
68{ 78{
69 unsigned long flags; 79 unsigned long flags;
@@ -77,7 +87,6 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
77 vsyscall_gtod_data.clock.shift = clock->shift; 87 vsyscall_gtod_data.clock.shift = clock->shift;
78 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; 88 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
79 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; 89 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
80 vsyscall_gtod_data.sys_tz = sys_tz;
81 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; 90 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic;
82 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 91 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
83} 92}