From nobody Sun May 24 20:34:05 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D7F03D75C5 for ; Thu, 21 May 2026 14:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779373396; cv=none; b=IzX4pYVCwSCAjpRe04Uela9bTyFEpw3Tfi02jX5pde2zK1ckoOiBo0onh8Bnw0uhUaWVFHgbLKdN6slDW7Ddld6DBsaSFq6U+3jf74ZKBnRRUJxNhWGXBQ5KIIshl7ejodq1M29H+RE9euwOdgIv2tHQwJQemCHCGMpyBW1V5Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779373396; c=relaxed/simple; bh=vkvxE28P0zrag41KylC50dr5R96zFtOXC1ohN2g7whA=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=kGg43DZOaKYI5TdXWe+iOkmyc7X9pFZb9V/s+aHjc4VLK49uSHXExVwJSNzTi4/BFaMfkw+XaIbKNHSlpV+7a/ZMQktcU1QJ0fJ0Xq8Fv8fNNGfaOL/lwGfwvhQaKXotaLVM9dhW6IfnM88QqoiwqCtqhKx9/a3M3Xj3HH6TUmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--nogikh.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=i0fyM7vS; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--nogikh.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="i0fyM7vS" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-48fd64c32e8so41455235e9.3 for ; Thu, 21 May 2026 07:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779373393; x=1779978193; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Lr8BKpOLWQtrvU98WKSsigNpDA+PKrjW2zdUyhAFbTw=; b=i0fyM7vSzPwuh/LxIXUPQOgLR8k9VAb9mYTkCFmRZ7LmSqugMbD+1s0ejI1Prru4jX QC9jDQBttCdtmCBEZtp5oKpGU0FkyTBic0bi+tDMC0QUHG9xNsYzT2BDQFnIs6V7lc1u +tKgxSaRTYAnGmS9mmMeP7/D5T2GVNWGxMa8YRmuyciAo2IusvvKbS9buZ89F/vtmN1F 78O/w9RlLP7ntTQxhLC/viWXzxzNTWVPpQsSMcQMHytyIBHA+9J/JuidxgdqIzK6nboK qFdNo6sIbE9eH0BuqXtZqPYoQ/Q6EgDmpnW+ORFminvvghzyEXz7FPC+MPexau7znHWk oJcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779373393; x=1779978193; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Lr8BKpOLWQtrvU98WKSsigNpDA+PKrjW2zdUyhAFbTw=; b=IvZZQ9rNLRDT3z6HReaME7djSjE6Z4Oo6EnWDp1eqNP2BhEm5hFGQU6PeyHueu7U2f /DtIgzHAlz91cSDPaTCCuy9LmKCM9iIDSYpF1cLtuwF0HHywSPsoZw8e+mv5CrZ9H5rg a0E/csqBt+NAiIRoecdtbiUgMw0hpy8bP+6PzwtKWAG2FRx20VqLG8Xf2+UYhCgdPazw esIXvZ6FbFufAoEbotNQyV6wpIjgzitXabpkTPEeF4SAAk5LsMyWPGo50SP6rcCESveh sCcKU8jppAqJiXKzp2A6r5i4hZ7m/s5xMoeA1AWd7EbFMaJOVXez8oC9ny4zw51jjjIr Ht0g== X-Forwarded-Encrypted: i=1; AFNElJ9EFSXJnbyhTvIeSEvXbYWboxw2+s8tPB+UTnL7Xwj/2zyvjKBiq53fz6Qb0oyM7aShXA4nz3siTztd1is=@vger.kernel.org X-Gm-Message-State: AOJu0YwKX3Z5sGeKzl7Bqangkop0nuS7doZdbj2KACf/6PGxuK2iHAM3 bAl1FnSXTQjArXZAcCjZs17axjnHTXjFbbcXj/GsdFx7FZa8wZK9sEKl9VedxT0ViOFJuhZEvCa nD6l3RQ== X-Received: from wmv6.prod.google.com ([2002:a05:600c:26c6:b0:485:3f38:3dd2]) (user=nogikh job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4f08:b0:48f:99a9:bbd6 with SMTP id 5b1f17b1804b1-490360bae19mr45875755e9.24.1779373392385; Thu, 21 May 2026 07:23:12 -0700 (PDT) Date: Thu, 21 May 2026 16:22:40 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.669.g59709faab0-goog Message-ID: <20260521142240.2973022-1-nogikh@google.com> Subject: [PATCH v2] signal: clear JOBCTL_PENDING_MASK for caller in zap_other_threads() From: Aleksandr Nogikh To: syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org Cc: adrianhuang0701@gmail.com, akpm@linux-foundation.org, brauner@kernel.org, kexinsun@smail.nju.edu.cn, oleg@redhat.com, peterz@infradead.org, syzbot@lists.linux.dev, tglx@kernel.org, dvyukov@google.com, Aleksandr Nogikh , syzbot+b109633ea805cac54a61@syzkaller.appspotmail.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D=3D 0 WARNING: CPU: 1 PID: 6475 at kernel/signal.c:373 task_participate_group_stop+0x215/0x2d0 Call Trace: 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 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 sin= gle group stop") Assisted-by: Gemini:gemini-3.1-pro-preview Gemini:gemini-3-flash-preview sy= zbot Reported-by: syzbot+b109633ea805cac54a61@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Db109633ea805cac54a61 Link: https://syzkaller.appspot.com/ai_job?id=3Dd70208cc-862b-4fe3-bf02-303= 1e10cd0b3 Signed-off-by: Aleksandr Nogikh Acked-by: Oleg Nesterov --- v2: Resending my from own name to comply with the rules. v1: https://lore.kernel.org/all/36638f2b-6f91-4e33-b630-fd7045eebc84@mail.kerne= l.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 =3D 0; =20 p->signal->group_stop_count =3D 0; + task_clear_jobctl_pending(p, JOBCTL_PENDING_MASK); =20 for_other_threads(p, t) { task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8 --=20 2.54.0.669.g59709faab0-goog