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>
Fri, 23 Dec 2022 21:30:34 +0000 (14:30 -0700)
commitb6ea49a1293ab63ef65553c576b8d919bdd3d42e
tree2c230398ea8d205be091e60a6106f83bd163c657
parent428760d101b98af1e7675882337dcad7c6786d87
kernel: allow fork with TIF_NOTIFY_SIGNAL pending

[ Upstream commit 66ae0d1e2d9fe6ec70e73fcfdcf4b390e271c1ac ]

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