Re: [PATCH V2] signal: Prevent exec() race

From: Oleg Nesterov

Date: Wed Sep 02 2026 - 13:27:35 EST


On 09/02, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@xxxxxxxxxx> writes:
>
> > I won't insist, but to me both the patch and resulting code look
> > a bit simpler this way.
>
> I agree that simply removing the special case that could skip grabbing
> siglock is more maintainable. Just one last thing to think about.

Well, but the patch from Thomas adds

scoped_guard(spinlock_irq, &tsk->sighand->siglock) {
tsk->flags |= PF_EXITING;
sigqueue_dequeue_pending(&tsk->pending, &sigq_list);
}

into the fast-path, so either way exit_signals() can no longer skip
grabbing siglock.

Or I missed something again?

> Oleg it appears you were the one who added the special case to skip
> taking siglock. So if you aren't worried about us removing it then
> I am happy to see it go.

I am worried. But see above. We need to fix the bug first. Then perhaps
we can add some other optimizations.

Oleg.