linux-uconsole/kernel/time
Thomas Gleixner a191212af8 tick: Make oneshot broadcast robust vs. CPU offlining
commit c9b5a266b1 upstream.

In periodic mode we remove offline cpus from the broadcast propagation
mask. In oneshot mode we fail to do so. This was not a problem so far,
but the recent changes to the broadcast propagation introduced a
constellation which can result in a NULL pointer dereference.

What happens is:

CPU0			CPU1
			idle()
			  arch_idle()
			    tick_broadcast_oneshot_control(OFF);
			      set cpu1 in tick_broadcast_force_mask
			  if (cpu_offline())
			     arch_cpu_dead()

cpu_dead_cleanup(cpu1)
 cpu1 tickdevice pointer = NULL

broadcast interrupt
  dereference cpu1 tickdevice pointer -> OOPS

We dereference the pointer because cpu1 is still set in
tick_broadcast_force_mask and tick_do_broadcast() expects a valid
cpumask and therefor lacks any further checks.

Remove the cpu from the tick_broadcast_force_mask before we set the
tick device pointer to NULL. Also add a sanity check to the oneshot
broadcast function, so we can detect such issues w/o crashing the
machine.

Reported-by: Prarit Bhargava <prarit@redhat.com>
Cc: athorlton@sgi.com
Cc: CAI Qian <caiqian@redhat.com>
Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1306261303260.4013@ionos.tec.linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-23 21:38:21 -07:00
..
alarmtimer.c alarmtimer: return EINVAL instead of ENOTSUPP if rtcdev doesn't exist 2013-12-04 10:55:49 -08:00
clockevents.c clockevents: Add module refcount 2013-12-08 07:29:27 -08:00
clocksource.c kernel-time: fix s/then/than/ spelling errors 2012-03-23 16:49:21 -07:00
jiffies.c time: Fix overflow when HZ is smaller than 60 2014-02-22 12:41:29 -08:00
Kconfig Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-05-15 14:05:17 -07:00
Makefile time: remove the timecompare code. 2012-11-01 11:41:35 -04:00
ntp.c ntp: Make periodic RTC update more reliable 2013-12-08 07:29:28 -08:00
ntp_internal.h ntp: Rework do_adjtimex to take timespec and tai arguments 2013-04-04 13:18:15 -07:00
posix-clock.c kernel: Fix files explicitly needing EXPORT_SYMBOL infrastructure 2011-10-31 19:30:05 -04:00
tick-broadcast.c tick: Make oneshot broadcast robust vs. CPU offlining 2014-03-23 21:38:21 -07:00
tick-common.c clockevents: Prefer CPU local devices over global devices 2013-12-08 07:29:27 -08:00
tick-internal.h clockevents: Get rid of the notifier chain 2013-12-08 07:29:27 -08:00
tick-oneshot.c clockevents: Make minimum delay adjustments configurable 2011-09-08 11:10:56 +02:00
tick-sched.c Revert "cpuidle: Quickly notice prediction failure for repeat mode" 2013-08-11 18:35:24 -07:00
timeconv.c time: add function to convert between calendar time and broken-down time for universal use 2009-09-24 07:20:56 -07:00
timekeeping.c timekeeping: Avoid possible deadlock from clock_was_set_delayed 2014-02-13 13:48:04 -08:00
timer_list.c timer_list: correct the iterator for timer_list 2013-09-07 22:09:58 -07:00
timer_stats.c locking, timer_stats: Annotate table_lock as raw 2011-09-13 11:12:00 +02:00