Two fixes for the generic VDSO code which missed 5.5:

 - Make the update to the coarse timekeeper unconditional. This is required
   because the coarse timekeeper interfaces in the VDSO do not depend on a
   VDSO capable clocksource. If the system does not have a VDSO capable
   clocksource and the update is depending on the VDSO capable clocksource,
   the coarse VDSO interfaces would operate on stale data forever.

 - Invert the logic of __arch_update_vdso_data() to avoid further head
   scratching. Tripped over this several times while analyzing the update
   problem above.
lib/vdso: Update coarse timekeeper unconditionally

The low resolution parts of the VDSO, i.e.:

  clock_gettime(CLOCK_*_COARSE), clock_getres(), time()

can be used even if there is no VDSO capable clocksource.

But if an architecture opts out of the VDSO data update then this
information becomes stale. This affects ARM when there is no architected
timer available. The lack of update causes userspace to use stale data
forever.

Make the update of the low resolution parts unconditional and only skip
the update of the high resolution parts if the architecture requests it.

Fixes: 44f57d788e7d ("timekeeping: Provide a generic update_vsyscall() implementation")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200114185946.765577901@linutronix.de

1 file changed