Skip to content
Snippets Groups Projects
Commit f8738c5c authored by Davide Libenzi's avatar Davide Libenzi Committed by Linus Torvalds
Browse files

avoid spurious POLLIN returns in signalfd


The new code in kernel/signal.c does not allow fetching private signals
from another task.  This patch avoid spurious POLLIN returns from a
signalfd poll(2) operation.

Signed-off-by: default avatarDavide Libenzi <davidel@xmailserver.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58e78475
Branches
Tags
No related merge requests found
...@@ -133,7 +133,8 @@ static unsigned int signalfd_poll(struct file *file, poll_table *wait) ...@@ -133,7 +133,8 @@ static unsigned int signalfd_poll(struct file *file, poll_table *wait)
* the peer disconnects. * the peer disconnects.
*/ */
if (signalfd_lock(ctx, &lk)) { if (signalfd_lock(ctx, &lk)) {
if (next_signal(&lk.tsk->pending, &ctx->sigmask) > 0 || if ((lk.tsk == current &&
next_signal(&lk.tsk->pending, &ctx->sigmask) > 0) ||
next_signal(&lk.tsk->signal->shared_pending, next_signal(&lk.tsk->signal->shared_pending,
&ctx->sigmask) > 0) &ctx->sigmask) > 0)
events |= POLLIN; events |= POLLIN;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment