Commit 95b08679 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

x86_64: Add missing mask operation to vdso

vdso vgetns() didn't mask the time source offset calculation, which
could lead to time problems with 32bit HPET.  Add the masking.

Thanks to Chuck Ebbert for tracking this down.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 99364df7
...@@ -34,10 +34,11 @@ static long vdso_fallback_gettime(long clock, struct timespec *ts) ...@@ -34,10 +34,11 @@ static long vdso_fallback_gettime(long clock, struct timespec *ts)
static inline long vgetns(void) static inline long vgetns(void)
{ {
long v;
cycles_t (*vread)(void); cycles_t (*vread)(void);
vread = gtod->clock.vread; vread = gtod->clock.vread;
return ((vread() - gtod->clock.cycle_last) * gtod->clock.mult) >> v = (vread() - gtod->clock.cycle_last) & gtod->clock.mask;
gtod->clock.shift; return (v * gtod->clock.mult) >> gtod->clock.shift;
} }
static noinline int do_realtime(struct timespec *ts) static noinline int do_realtime(struct timespec *ts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment