Skip to content

Commit

Permalink
x86_64: Add missing mask operation to vdso
Browse files Browse the repository at this point in the history
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: Andi Kleen <ak@suse.de>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andi Kleen authored and Linus Torvalds committed Sep 12, 2007
1 parent 99364df commit 95b0867
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86_64/vdso/vclock_gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ static long vdso_fallback_gettime(long clock, struct timespec *ts)

static inline long vgetns(void)
{
long v;
cycles_t (*vread)(void);
vread = gtod->clock.vread;
return ((vread() - gtod->clock.cycle_last) * gtod->clock.mult) >>
gtod->clock.shift;
v = (vread() - gtod->clock.cycle_last) & gtod->clock.mask;
return (v * gtod->clock.mult) >> gtod->clock.shift;
}

static noinline int do_realtime(struct timespec *ts)
Expand Down

0 comments on commit 95b0867

Please sign in to comment.