diff options
author | John Stultz <john.stultz@linaro.org> | 2012-03-02 07:11:09 +0100 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2012-03-16 02:17:53 +0100 |
commit | a939e817aa7e199d2fff05a67cb745be32dd5c2d (patch) | |
tree | f55d3554476ce03c7fe6731284221a177e896d6b /kernel/time | |
parent | ntp: Fix integer overflow when setting time (diff) | |
download | linux-a939e817aa7e199d2fff05a67cb745be32dd5c2d.tar.xz linux-a939e817aa7e199d2fff05a67cb745be32dd5c2d.zip |
time: x86: Fix race switching from vsyscall to non-vsyscall clock
When switching from a vsyscall capable to a non-vsyscall capable
clocksource, there was a small race, where the last vsyscall
gettimeofday before the switch might return a invalid time value
using the new non-vsyscall enabled clocksource values after the
switch is complete.
This is due to the vsyscall code checking the vclock_mode once
outside of the seqcount protected section. After it reads the
vclock mode, it doesn't re-check that the sampled clock data
that is obtained in the seqcount critical section still matches.
The fix is to sample vclock_mode inside the protected section,
and as long as it isn't VCLOCK_NONE, return the calculated
value. If it has changed and is now VCLOCK_NONE, fall back
to the syscall gettime calculation.
v2:
* Cleanup checks as suggested by tglx
* Also fix same issue present in gettimeofday path
CC: Andy Lutomirski <luto@amacapital.net>
CC: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time')
0 files changed, 0 insertions, 0 deletions