]> git.baikalelectronics.ru Git - kernel.git/commit
posix-timers: Move rcu_head out of it union
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Tue, 30 Jul 2019 22:33:54 +0000 (00:33 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 1 Aug 2019 18:51:25 +0000 (20:51 +0200)
commitb885960016de2e866bcaa988077efcba4305f4b9
tree212e179aa54bd0b2427aa5d97864a334d9201b85
parent879d485e7e4a998bbf08c1c47d3f6d0f40d3d580
posix-timers: Move rcu_head out of it union

Timer deletion on PREEMPT_RT is prone to priority inversion and live
locks. The hrtimer code has a synchronization mechanism for this. Posix CPU
timers will grow one.

But that mechanism cannot be invoked while holding the k_itimer lock
because that can deadlock against the running timer callback. So the lock
must be dropped which allows the timer to be freed.

The timer free can be prevented by taking RCU readlock before dropping the
lock, but because the rcu_head is part of the 'it' union a concurrent free
will overwrite the hrtimer on which the task is trying to synchronize.

Move the rcu_head out of the union to prevent this.

[ tglx: Fixed up kernel-doc. Rewrote changelog ]

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190730223828.965541887@linutronix.de
include/linux/posix-timers.h
kernel/time/posix-timers.c