PROBLEM: monotonic clock going backwards on ppc64
tglx at linutronix.de
Sat Mar 2 10:59:33 AEDT 2019
On Sat, 2 Mar 2019, Michael Ellerman wrote:
> > The problem seems to be in vDSO code in arch/powerpc/kernel/vdso64/gettimeofday.S.
> You're right, the wall-to-monotonic offset (wtom_clock_sec) is a signed
> 32-bit value, so that seems like it's going to have problems.
> If I do `date -s 2037-1-1` I see:
> [ 26.024061] update_vsyscall: tk->wall_to_monotonic.tv_sec -2114341175
> [ 26.042633] update_vsyscall: vdso_data->wtom_clock_sec -2114341175
> Which looks sane.
> But then 2040-1-1 shows:
> [ 32.617020] update_vsyscall: tk->wall_to_monotonic.tv_sec -2208949168
> [ 32.632642] update_vsyscall: vdso_data->wtom_clock_sec 2086018128
> ie. the larger negative offset has overflowed and become positive.
> But then when we go back to 2037 we get a negative offset again and
> monotonic time appears to go backward and things are unhappy.
> I don't know this code well, but the patch below *appears* to work. I'll
> have a closer look on Monday.
Looks about right. The core hands in the 64bit offset already.
More information about the Linuxppc-dev