kernel: allow fork with TIF_NOTIFY_SIGNAL pending
authorJens Axboe <axboe@kernel.dk>
Mon, 22 Mar 2021 15:39:12 +0000 (09:39 -0600)
committerJens Axboe <axboe@kernel.dk>
Sun, 4 Apr 2021 21:27:38 +0000 (15:27 -0600)
commit5c392b3de634a7a26f23ab52275b9354395999e8
tree82fea8cab780989b3fcd054d5c591e896cd8bb25
parent4d636d877e82c58c49644dcdfe7ef0f184fc1600
kernel: allow fork with TIF_NOTIFY_SIGNAL pending

fork() fails if signal_pending() is true, but there are two conditions
that can lead to that:

1) An actual signal is pending. We want fork to fail for that one, like
   we always have.

2) TIF_NOTIFY_SIGNAL is pending, because the task has pending task_work.
   We don't need to make it fail for that case.

Allow fork() to proceed if just task_work is pending, by changing the
signal_pending() check to task_sigpending().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/fork.c