]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
kernel: allow fork with TIF_NOTIFY_SIGNAL pending
authorJens Axboe <axboe@kernel.dk>
Mon, 22 Mar 2021 15:39:12 +0000 (09:39 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jan 2023 10:39:22 +0000 (11:39 +0100)
commit0f735cf52bd0b2aaca865e3d2e3dc276479e41ba
tree2c230398ea8d205be091e60a6106f83bd163c657
parent4b4d2c79921a8327e9e853dc93c06b27edb3a859
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/fork.c