Skip to content

Commit

Permalink
dlm: kill the unnecessary and wrong device_close()->recalc_sigpending()
Browse files Browse the repository at this point in the history
device_close()->recalc_sigpending() is not needed, sigprocmask() takes
care of TIF_SIGPENDING correctly.

And without ->siglock it is racy and wrong, it can wrongly clear
TIF_SIGPENDING and miss a signal.

But even with this patch device_close() is still buggy:

  1. sigprocmask() should not be used, we have set_task_blocked(),
     but this is minor.

  2. We should never block SIGKILL or SIGSTOP, and this is what
     the code tries to do.

  3. This can't protect against SIGKILL or SIGSTOP anyway. Another
     thread can do signal_wake_up(), say, do_signal_stop() or
     complete_signal() or debugger.

  4. sigprocmask(SIG_BLOCK, allsigs) doesn't necessarily clears
     TIF_SIGPENDING, say, freezing() or ->jobctl.

  5. device_write() looks equally wrong by the same reason.

Looks like, this tries to protect some wait_event_interruptible() logic
from signals, it should be turned into uninterruptible wait.  Or we need
to implement something like signals_stop/start for such a use-case.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Aug 9, 2013
1 parent 6c2580c commit 201d3df
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/dlm/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,6 @@ static int device_close(struct inode *inode, struct file *file)
device_remove_lockspace() */

sigprocmask(SIG_SETMASK, &tmpsig, NULL);
recalc_sigpending();

return 0;
}
Expand Down

0 comments on commit 201d3df

Please sign in to comment.