Commit caec4e8dc85e0644ec24aeb36285e1ba02da58cc
Committed by
Linus Torvalds
1 parent
bd197234b0
Exists in
master
and in
39 other branches
Fix signalfd interaction with thread-private signals
Don't let signalfd dequeue private signals off other threads (in the case of things like SIGILL or SIGSEGV, trying to do so would result in undefined behaviour on who actually gets the signal, since they are force unblocked). Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Davide Libenzi <davidel@xmailserver.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff
kernel/signal.c
... | ... | @@ -363,7 +363,13 @@ |
363 | 363 | */ |
364 | 364 | int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) |
365 | 365 | { |
366 | - int signr = __dequeue_signal(&tsk->pending, mask, info); | |
366 | + int signr = 0; | |
367 | + | |
368 | + /* We only dequeue private signals from ourselves, we don't let | |
369 | + * signalfd steal them | |
370 | + */ | |
371 | + if (tsk == current) | |
372 | + signr = __dequeue_signal(&tsk->pending, mask, info); | |
367 | 373 | if (!signr) { |
368 | 374 | signr = __dequeue_signal(&tsk->signal->shared_pending, |
369 | 375 | mask, info); |