From: Jens Axboe Date: Mon, 22 Mar 2021 15:39:12 +0000 (-0600) Subject: kernel: allow fork with TIF_NOTIFY_SIGNAL pending X-Git-Tag: v5.10.162~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f735cf52bd0b2aaca865e3d2e3dc276479e41ba;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/fork.c b/kernel/fork.c index 252a40f14f726..b5cd5cdd3e678 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1942,7 +1942,7 @@ static __latent_entropy struct task_struct *copy_process( recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); retval = -ERESTARTNOINTR; - if (signal_pending(current)) + if (task_sigpending(current)) goto fork_out; retval = -ENOMEM;