[patch 00/26] alarmtimers/posixtimers: Bug fixes and spec conformity changes

Thomas Gleixner
2017-05-30T21:46:19Z

The syzkaller folks reported an RCU stall while fuzzing the posix timer
interface with CLOCK_ALARMTIMER_*.

While fixing this issue, I noticed that the posix timer implementation of
alarm timers lacks quite some of the features of the regular hrtimer based
posix timers.

That makes alarm timer bases posix timer not conform to the spec and also
the unconditional self rearming of those timer is suboptimal.

Instead of copying the posix timer hrtimer based mechanism over to alarm
timers with the risk of getting out of sync sooner than later, I decided to
add a few callbacks to the kclock struct which describes the different
posix timer clocks, so the existing and proven to be correct implementation
can be reused and we have only one implementation to maintain, aside of the
special magic which handles the CPU/PROCESS/THREAD clock ids.

Patch 1/2 are the bugfixes addressing the reported problem (#1) and a
similar one (#2) which I detected in review.

Patch 3-8 are cleanups which I put in front of the actual rework, including
the removal of unused and prone to be implemnted wrong posix timer
callbacks for the dynamic posix clocks.

Patch 9-20 prepare the code in posix-timer.c for sharing and reuse and the
remaining patches 21-26 switch the alarm timers over.

Passes LTP and GLIBC tests and a few other test cases I have around.

Thanks,

tglx
---
b/kernel/time/posix-timers.h | 13 +
include/asm-generic/siginfo.h | 2
include/linux/posix-clock.h | 22 --
include/linux/posix-timers.h | 117 ++++++-----
kernel/signal.c | 2
kernel/time/alarmtimer.c | 200 +++++++++-----------
kernel/time/posix-clock.c | 115 -----------
kernel/time/posix-cpu-timers.c | 36 +--
kernel/time/posix-timers.c | 410 ++++++++++++++++++++++-------------------
9 files changed, 429 insertions(+), 488 deletions(-)