linux/kernel/time
Thomas Gleixner 93ad0fc088 posix-cpu-timers: Unbreak timer rearming
The recent commit which prevented a division by 0 issue in the alarm timer
code broke posix CPU timers as an unwanted side effect.

The reason is that the common rearm code checks for timer->it_interval
being 0 now. What went unnoticed is that the posix cpu timer setup does not
initialize timer->it_interval as it stores the interval in CPU timer
specific storage. The reason for the separate storage is historical as the
posix CPU timers always had a 64bit nanoseconds representation internally
while timer->it_interval is type ktime_t which used to be a modified
timespec representation on 32bit machines.

Instead of reverting the offending commit and fixing the alarmtimer issue
in the alarmtimer code, store the interval in timer->it_interval at CPU
timer setup time so the common code check works. This also repairs the
existing inconistency of the posix CPU timer code which kept a single shot
timer armed despite of the interval being 0.

The separate storage can be removed in mainline, but that needs to be a
separate commit as the current one has to be backported to stable kernels.

Fixes: 0e334db6bb ("posix-timers: Fix division by zero bug")
Reported-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190111133500.840117406@linutronix.de
2019-01-15 16:34:37 +01:00
..
alarmtimer.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
clockevents.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
clocksource.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
hrtimer.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
itimer.c time: Remove useless filenames in top level comments 2018-11-23 11:51:20 +01:00
jiffies.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
Kconfig clocksource: Provide clocksource_arch_init() 2018-10-04 23:00:24 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ntp_internal.h timekeeping/ntp: Constify some function arguments 2018-07-19 17:08:05 -07:00
ntp.c y2038: more syscalls and cleanups 2018-12-28 12:45:04 -08:00
posix-clock.c posix-clocks: Remove license boiler plate 2018-11-23 11:51:22 +01:00
posix-cpu-timers.c posix-cpu-timers: Unbreak timer rearming 2019-01-15 16:34:37 +01:00
posix-stubs.c posix-timers/stubs: Remove license boilerplate 2018-11-23 11:51:21 +01:00
posix-timers.c Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-12-25 15:44:08 -08:00
posix-timers.h posix-timers: Make forward callback return s64 2018-07-02 11:33:25 +02:00
sched_clock.c sched/clock: Remove license boilerplate 2018-11-23 11:51:22 +01:00
test_udelay.c time/debug: Remove license boilerplate 2018-11-23 11:51:21 +01:00
tick-broadcast-hrtimer.c time: Remove useless filenames in top level comments 2018-11-23 11:51:20 +01:00
tick-broadcast.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
tick-common.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
tick-internal.h Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME 2018-04-26 14:53:32 +02:00
tick-oneshot.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
tick-sched.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
tick-sched.h nohz: Gather tick_sched booleans under a common flag field 2018-04-09 11:54:57 +02:00
time.c y2038: more syscalls and cleanups 2018-12-28 12:45:04 -08:00
timeconst.bc time: Add SPDX license identifiers 2018-11-23 11:51:20 +01:00
timeconv.c time: Add SPDX license identifiers 2018-11-23 11:51:20 +01:00
timecounter.c time: Remove license boilerplate 2018-11-23 11:51:21 +01:00
timekeeping_debug.c timekeeping: Convert to DEFINE_SHOW_ATTRIBUTE 2018-12-11 18:13:35 -08:00
timekeeping_internal.h timekeeping/ntp: Constify some function arguments 2018-07-19 17:08:05 -07:00
timekeeping.c y2038: more syscalls and cleanups 2018-12-28 12:45:04 -08:00
timekeeping.h Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME 2018-04-26 14:53:32 +02:00
timer_list.c hrtimers/tick/clockevents: Remove sloppy license references 2018-11-23 11:51:21 +01:00
timer.c time: Add SPDX license identifiers 2018-11-23 11:51:20 +01:00