• O
    signalfd: fix interaction with posix-timers · 834d216e
    Oleg Nesterov 提交于
    dequeue_signal:
    
    	if (__SI_TIMER) {
    		spin_unlock(&tsk->sighand->siglock);
    		do_schedule_next_timer(info);
    		spin_lock(&tsk->sighand->siglock);
    	}
    
    Unless tsk == curent, this is absolutely unsafe: nothing prevents tsk from
    exiting. If signalfd was passed to another process, do_schedule_next_timer()
    is just wrong.
    
    Add yet another "tsk == current" check into dequeue_signal().
    
    This patch fixes an oopsable bug, but breaks the scheduling of posix timers
    if the shared __SI_TIMER signal was fetched via signalfd attached to another
    sub-thread. Mostly fixed by the next patch.
    Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: Davide Libenzi <davidel@xmailserver.org>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Michael Kerrisk <mtk-manpages@gmx.net>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: <stable@kernel.org>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    834d216e
signal.c 64.6 KB