]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
alarmtimer: Rate limit periodic intervals
authorThomas Gleixner <tglx@linutronix.de>
Tue, 30 May 2017 21:15:35 +0000 (23:15 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Sun, 25 Jun 2017 15:37:03 +0000 (10:37 -0500)
commitea441f4d490a7b7c5d41653a7ff35c8e86f83d87
tree7ef99de47221060da1b38e9c0a446f5dd5f44ad2
parent38a17a6da75470042207852282c51b02469b6bbc
alarmtimer: Rate limit periodic intervals

BugLink: http://bugs.launchpad.net/bugs/1700372
commit ff86bf0c65f14346bf2440534f9ba5ac232c39a0 upstream.

The alarmtimer code has another source of potentially rearming itself too
fast. Interval timers with a very samll interval have a similar CPU hog
effect as the previously fixed overflow issue.

The reason is that alarmtimers do not implement the normal protection
against this kind of problem which the other posix timer use:

  timer expires -> queue signal -> deliver signal -> rearm timer

This scheme brings the rearming under scheduler control and prevents
permanently firing timers which hog the CPU.

Bringing this scheme to the alarm timer code is a major overhaul because it
lacks all the necessary mechanisms completely.

So for a quick fix limit the interval to one jiffie. This is not
problematic in practice as alarmtimers are usually backed by an RTC for
suspend which have 1 second resolution. It could be therefor argued that
the resolution of this clock should be set to 1 second in general, but
that's outside the scope of this fix.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Kostya Serebryany <kcc@google.com>
Cc: syzkaller <syzkaller@googlegroups.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Link: http://lkml.kernel.org/r/20170530211655.896767100@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/time/alarmtimer.c