[PATCH] signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()

2 views
Skip to first unread message

syzbot

unread,
May 21, 2026, 5:06:35 AM (yesterday) May 21
to syzkall...@googlegroups.com, linux-...@vger.kernel.org, adrianh...@gmail.com, ak...@linux-foundation.org, bra...@kernel.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org
When a multi-threaded process receives a stop signal (e.g., SIGSTOP),
do_signal_stop() sets JOBCTL_STOP_PENDING and JOBCTL_STOP_CONSUME on all
threads and sets signal->group_stop_count to the number of threads. If
one of the threads concurrently calls execve(), de_thread() invokes
zap_other_threads() to kill all other threads. zap_other_threads()
aborts the pending group stop by resetting signal->group_stop_count to 0
and clears the JOBCTL_PENDING_MASK for all other threads. However, it
fails to clear the job control flags for the calling thread.

When execve() completes, the calling thread returns to user mode and
checks for pending signals. Seeing the stale JOBCTL_STOP_PENDING flag,
it calls do_signal_stop(), which invokes task_participate_group_stop().
Since JOBCTL_STOP_CONSUME is still set, it attempts to decrement the
already-zero signal->group_stop_count, triggering a warning:

sig->group_stop_count == 0
WARNING: CPU: 1 PID: 6475 at kernel/signal.c:373
task_participate_group_stop+0x215/0x2d0
Call Trace:
<TASK>
do_signal_stop+0x3be/0x5c0 kernel/signal.c:2619
get_signal+0xa8c/0x1330 kernel/signal.c:2884
arch_do_signal_or_restart+0xbc/0x840 arch/x86/kernel/signal.c:337
exit_to_user_mode_loop+0x8c/0x4d0 kernel/entry/common.c:98
do_syscall_64+0x33e/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>

Fix this race condition by clearing the JOBCTL_PENDING_MASK for the
calling thread in zap_other_threads(), ensuring it does not retain any
stale job control state after the thread group is destroyed. This aligns
with other functions that tear down a thread group and abort group
stops, such as zap_process() and complete_signal(), which correctly
clear these flags for all threads including the current one.

Fixes: 39efa3ef3a37 ("signal: Use GROUP_STOP_PENDING to stop once for a single group stop")
Assisted-by: Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-preview
Reported-by: syzbot+b10963...@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b109633ea805cac54a61
Link: https://syzkaller.appspot.com/ai_job?id=d70208cc-862b-4fe3-bf02-3031e10cd0b3
Signed-off-by: Aleksandr Nogikh <nog...@google.com>

---
diff --git a/kernel/signal.c b/kernel/signal.c
index 2d102e025..9c2b32c4d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1338,6 +1338,7 @@ int zap_other_threads(struct task_struct *p)
int count = 0;

p->signal->group_stop_count = 0;
+ task_clear_jobctl_pending(p, JOBCTL_PENDING_MASK);

for_other_threads(p, t) {
task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK);


base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
--
See https://github.com/google/syzkaller/blob/master/docs/syzbot_ai_patches.md for more information.

Oleg Nesterov

unread,
May 21, 2026, 8:22:48 AM (yesterday) May 21
to syzbot, syzkall...@googlegroups.com, linux-...@vger.kernel.org, adrianh...@gmail.com, ak...@linux-foundation.org, bra...@kernel.org, kexi...@smail.nju.edu.cn, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org
On 05/21, syzbot wrote:
>
> When a multi-threaded process receives a stop signal (e.g., SIGSTOP),
> do_signal_stop() sets JOBCTL_STOP_PENDING and JOBCTL_STOP_CONSUME on all
> threads and sets signal->group_stop_count to the number of threads. If
> one of the threads concurrently calls execve(), de_thread() invokes
> zap_other_threads() to kill all other threads. zap_other_threads()
> aborts the pending group stop by resetting signal->group_stop_count to 0
> and clears the JOBCTL_PENDING_MASK for all other threads. However, it
> fails to clear the job control flags for the calling thread.

Yes...

> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1338,6 +1338,7 @@ int zap_other_threads(struct task_struct *p)
> int count = 0;
>
> p->signal->group_stop_count = 0;
> + task_clear_jobctl_pending(p, JOBCTL_PENDING_MASK);

OK, fair enough...

If we reset ->group_stop_count, we need to clear JOBCTL_PENDING_MASK for
every thread.

Acked-by: Oleg Nesterov <ol...@redhat.com>



-----------------------------------------------------------------------
But. It seems that we need more fixes (and more discussions) about the
SIGSTOP with exec race...

Oleg.

Christian Brauner

unread,
May 21, 2026, 8:40:36 AM (yesterday) May 21
to syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, Christian Brauner, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org
On Thu, 21 May 2026 09:05:43 +0000, syzbot wrote:
> When a multi-threaded process receives a stop signal (e.g., SIGSTOP),
> do_signal_stop() sets JOBCTL_STOP_PENDING and JOBCTL_STOP_CONSUME on all
> threads and sets signal->group_stop_count to the number of threads. If
> one of the threads concurrently calls execve(), de_thread() invokes
> zap_other_threads() to kill all other threads. zap_other_threads()
> aborts the pending group stop by resetting signal->group_stop_count to 0
> and clears the JOBCTL_PENDING_MASK for all other threads. However, it
> fails to clear the job control flags for the calling thread.
>
> [...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
https://git.kernel.org/vfs/vfs/c/71556f3d55ee

Aleksandr Nogikh

unread,
May 21, 2026, 9:03:51 AM (yesterday) May 21
to Christian Brauner, Greg Kroah-Hartman, syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, Dmitry Vyukov, Marco Elver
(+Greg)

Hi Christian and Oleg,

Thanks for reviewing and accepting the patch!

However, it seems that we first need to clarify how these types of
patches should be submitted to ensure we don't violate the Linux
kernel rules regarding AI-assisted contributions.

In a discussion under another patch by syzbot [1], Greg noted that
syzbot cannot be listed as the author. The official documentation [2]
isn't very specific about how to handle this exact scenario.

Once we know what changes are needed, we'd be happy to submit a v2
that fully adheres to the rules.

[1] https://lore.kernel.org/all/2026052107-recast-opt-946d@gregkh/
[2] https://docs.kernel.org/process/coding-assistants.html

Best regards,
Aleksandr

Christian Brauner

unread,
May 21, 2026, 9:17:12 AM (yesterday) May 21
to Aleksandr Nogikh, Greg Kroah-Hartman, syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, Dmitry Vyukov, Marco Elver
On Thu, May 21, 2026 at 03:03:35PM +0200, Aleksandr Nogikh wrote:
> (+Greg)
>
> Hi Christian and Oleg,
>
> Thanks for reviewing and accepting the patch!
>
> However, it seems that we first need to clarify how these types of
> patches should be submitted to ensure we don't violate the Linux
> kernel rules regarding AI-assisted contributions.
>
> In a discussion under another patch by syzbot [1], Greg noted that
> syzbot cannot be listed as the author. The official documentation [2]
> isn't very specific about how to handle this exact scenario.
>
> Once we know what changes are needed, we'd be happy to submit a v2
> that fully adheres to the rules.
>
> [1] https://lore.kernel.org/all/2026052107-recast-opt-946d@gregkh/
> [2] https://docs.kernel.org/process/coding-assistants.html

Submit under your name just like you would with a
coccinelle/sed/grep/script generated thing?

Greg Kroah-Hartman

unread,
May 21, 2026, 10:17:55 AM (yesterday) May 21
to Aleksandr Nogikh, Christian Brauner, syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, Dmitry Vyukov, Marco Elver
On Thu, May 21, 2026 at 03:03:35PM +0200, Aleksandr Nogikh wrote:
> (+Greg)
>
> Hi Christian and Oleg,
>
> Thanks for reviewing and accepting the patch!
>
> However, it seems that we first need to clarify how these types of
> patches should be submitted to ensure we don't violate the Linux
> kernel rules regarding AI-assisted contributions.

The documentation is very clear on this, what is missing?

> In a discussion under another patch by syzbot [1], Greg noted that
> syzbot cannot be listed as the author. The official documentation [2]
> isn't very specific about how to handle this exact scenario.

A "tool" can not sign off on a patch. That's always been the case, a
person has to take ownership and responsibility for it from a legal and
technical point of view. Again, nothing new here, been this way for a
very long time.

thanks,

greg k-h

Aleksandr Nogikh

unread,
May 21, 2026, 10:23:15 AM (yesterday) May 21
to syzkall...@googlegroups.com, linux-...@vger.kernel.org, adrianh...@gmail.com, ak...@linux-foundation.org, bra...@kernel.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, dvy...@google.com, Aleksandr Nogikh, syzbot+b10963...@syzkaller.appspotmail.com
When a multi-threaded process receives a stop signal (e.g., SIGSTOP),
do_signal_stop() sets JOBCTL_STOP_PENDING and JOBCTL_STOP_CONSUME on all
threads and sets signal->group_stop_count to the number of threads. If
one of the threads concurrently calls execve(), de_thread() invokes
zap_other_threads() to kill all other threads. zap_other_threads()
aborts the pending group stop by resetting signal->group_stop_count to 0
and clears the JOBCTL_PENDING_MASK for all other threads. However, it
fails to clear the job control flags for the calling thread.

When execve() completes, the calling thread returns to user mode and
checks for pending signals. Seeing the stale JOBCTL_STOP_PENDING flag,
it calls do_signal_stop(), which invokes task_participate_group_stop().
Since JOBCTL_STOP_CONSUME is still set, it attempts to decrement the
already-zero signal->group_stop_count, triggering a warning:

sig->group_stop_count == 0
WARNING: CPU: 1 PID: 6475 at kernel/signal.c:373
task_participate_group_stop+0x215/0x2d0
Call Trace:
<TASK>
do_signal_stop+0x3be/0x5c0 kernel/signal.c:2619
get_signal+0xa8c/0x1330 kernel/signal.c:2884
arch_do_signal_or_restart+0xbc/0x840 arch/x86/kernel/signal.c:337
exit_to_user_mode_loop+0x8c/0x4d0 kernel/entry/common.c:98
do_syscall_64+0x33e/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>

Fix this race condition by clearing the JOBCTL_PENDING_MASK for the
calling thread in zap_other_threads(), ensuring it does not retain any
stale job control state after the thread group is destroyed. This aligns
with other functions that tear down a thread group and abort group
stops, such as zap_process() and complete_signal(), which correctly
clear these flags for all threads including the current one.

Fixes: 39efa3ef3a37 ("signal: Use GROUP_STOP_PENDING to stop once for a single group stop")
Assisted-by: Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-preview syzbot
v2:
Resending my from own name to comply with the rules.

v1:
https://lore.kernel.org/all/36638f2b-6f91-4e33...@mail.kernel.org/

---
kernel/signal.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/signal.c b/kernel/signal.c
index 2d102e0258839..9c2b32c4d7553 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1338,6 +1338,7 @@ int zap_other_threads(struct task_struct *p)
int count = 0;

p->signal->group_stop_count = 0;
+ task_clear_jobctl_pending(p, JOBCTL_PENDING_MASK);

for_other_threads(p, t) {
task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK);

base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
--
2.54.0.669.g59709faab0-goog

Aleksandr Nogikh

unread,
May 21, 2026, 10:30:38 AM (yesterday) May 21
to Greg Kroah-Hartman, Christian Brauner, syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, Dmitry Vyukov, Marco Elver
The documentation was very clear that the `Signed-off-by` tag must
belong to a real person and these 2 patches actually did have such a
Signed-off-by.

We've just updated syzbot to also add a `From: ` tag with the
name/email of the person who pre-reviewed the patch and approved
sending it to LKML.

--
Aleksandr

>
> thanks,
>
> greg k-h

Aleksandr Nogikh

unread,
May 21, 2026, 10:32:34 AM (yesterday) May 21
to Christian Brauner, Greg Kroah-Hartman, syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, Dmitry Vyukov, Marco Elver
On Thu, May 21, 2026 at 3:17 PM Christian Brauner <bra...@kernel.org> wrote:
>
> On Thu, May 21, 2026 at 03:03:35PM +0200, Aleksandr Nogikh wrote:
> > (+Greg)
> >
> > Hi Christian and Oleg,
> >
> > Thanks for reviewing and accepting the patch!
> >
< .... >
>
> Submit under your name just like you would with a
> coccinelle/sed/grep/script generated thing?

FYI I've just resubmitted the patch under my name:
https://lore.kernel.org/all/20260521142240....@google.com/

Greg Kroah-Hartman

unread,
May 21, 2026, 11:00:01 AM (yesterday) May 21
to Aleksandr Nogikh, Christian Brauner, syzkall...@googlegroups.com, linux-...@vger.kernel.org, syzbot, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, Dmitry Vyukov, Marco Elver
On Thu, May 21, 2026 at 04:30:24PM +0200, Aleksandr Nogikh wrote:
> On Thu, May 21, 2026 at 4:17 PM Greg Kroah-Hartman
> <gre...@linuxfoundation.org> wrote:
> >
> > On Thu, May 21, 2026 at 03:03:35PM +0200, Aleksandr Nogikh wrote:
> > > (+Greg)
> > >
> > > Hi Christian and Oleg,
> > >
> > > Thanks for reviewing and accepting the patch!
> > >
> > > However, it seems that we first need to clarify how these types of
> > > patches should be submitted to ensure we don't violate the Linux
> > > kernel rules regarding AI-assisted contributions.
> >
> > The documentation is very clear on this, what is missing?
> >
> > > In a discussion under another patch by syzbot [1], Greg noted that
> > > syzbot cannot be listed as the author. The official documentation [2]
> > > isn't very specific about how to handle this exact scenario.
> >
> > A "tool" can not sign off on a patch. That's always been the case, a
> > person has to take ownership and responsibility for it from a legal and
> > technical point of view. Again, nothing new here, been this way for a
> > very long time.
>
> The documentation was very clear that the `Signed-off-by` tag must
> belong to a real person and these 2 patches actually did have such a
> Signed-off-by.

So, then you end up with an "authorless" signed-off-by patch, something
that makes everyone sit up and go "what just broke!".

> We've just updated syzbot to also add a `From: ` tag with the
> name/email of the person who pre-reviewed the patch and approved
> sending it to LKML.

Then they are the ones taking responsibility for a tool-generated patch.
Good luck with that, and be prepared for people to just blindly reject
them...

thanks,

greg k-h

Christian Brauner

unread,
9:19 AM (4 hours ago) 9:19 AM
to syzkall...@googlegroups.com, linux-...@vger.kernel.org, Aleksandr Nogikh, Christian Brauner, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, ol...@redhat.com, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, dvy...@google.com, syzbot+b10963...@syzkaller.appspotmail.com
On Thu, 21 May 2026 16:22:40 +0200, Aleksandr Nogikh wrote:
> When a multi-threaded process receives a stop signal (e.g., SIGSTOP),
> do_signal_stop() sets JOBCTL_STOP_PENDING and JOBCTL_STOP_CONSUME on all
> threads and sets signal->group_stop_count to the number of threads. If
> one of the threads concurrently calls execve(), de_thread() invokes
> zap_other_threads() to kill all other threads. zap_other_threads()
> aborts the pending group stop by resetting signal->group_stop_count to 0
> and clears the JOBCTL_PENDING_MASK for all other threads. However, it
> fails to clear the job control flags for the calling thread.
>
> [...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads()
https://git.kernel.org/vfs/vfs/c/90918794a4e2

Oleg Nesterov

unread,
11:19 AM (2 hours ago) 11:19 AM
to Christian Brauner, syzkall...@googlegroups.com, linux-...@vger.kernel.org, Aleksandr Nogikh, adrianh...@gmail.com, ak...@linux-foundation.org, kexi...@smail.nju.edu.cn, pet...@infradead.org, syz...@lists.linux.dev, tg...@kernel.org, dvy...@google.com, syzbot+b10963...@syzkaller.appspotmail.com
On 05/22, Christian Brauner wrote:
>
> It's encouraged to provide Acked-bys and Reviewed-bys even though the
> patch has now been applied. If possible patch trailers will be updated.

I have already acked V1, let me ack V2 as well.

Acked-by: Oleg Nesterov <ol...@redhat.com>

Reply all
Reply to author
Forward
0 new messages