Article View: linux.kernel.git
Article #1735Re: [PATCH] sigchain: recover from concurrent double-pops of the same signal
From: Phillip Wood
Date: Wed, 28 Oct 2026 14:29
Date: Wed, 28 Oct 2026 14:29
45 lines
13057 bytes
13057 bytes
On 28/10/2026 13:37, ian4hu wrote: > Hi, > > Gentle ping on this one. It is queued in 'seen' as > iy/sigchain-recover-concurrent-pops, and the latest "What's cooking" > marks it as "Needs review". > > A short recap: when two copies of the same signal reach two threads > nearly at the same time, the concurrent sigchain_pop() calls in the > handlers can unwind the chain by two levels instead of one, leaving > the process spinning in a handler that keeps re-raising the signal. It sounds to me like the bug is that we're unwinding the same chain of signal handlers in two different threads at the same time. Doesn't that mean we're potentially calling the same handler twice, once from each thread, which doesn't sound like it'll lead to anything good. I wonder how hard it would be to fix the code to ensure that signals are blocked when we spawn a new thread so that they are only handled in a single thread. It would probably be good idea to start using sigaction() as well so that we don't interrupt a signal handler if we receive another instance of the same signal while the handler is running. Thanks Phillip > This is reachable with "git clone --depth 1" over ssh receiving two > SIGTERMs in quick succession, and only SIGKILL gets rid of the > process. > > The patch leaves the push/pop fast path alone and only teaches the > "n < 1" guard in sigchain_pop() to fall back to the pre-chain > disposition, so the stuck handler's raise() terminates the process > just as a single delivery would. > > Peff, I have Cc'ed you since you wrote the sigchain code. I would > appreciate your thoughts on whether this "repair after the fact" > approach is acceptable, or whether you would rather see the chain > mutation serialized instead. I also have a version that uses a > per-signal spinlock around push/pop, and can send it if that is > preferred. > > Thanks, > ian4hu
Technical Details
Message-ID:
<3f939144-d4b3-4bc5-aaea-16422450d638@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73655-linux-kernel-git=dewy.ruReferences:
<pull.2263.git.1792154272296.gitgitgadget@gmail.com> <20261028133755.112476-1-hu2008yinxiang@163.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73655-linux-kernel-git=dewy.ru
From: phillip.wood123@gmail.com (Phillip Wood)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] sigchain: recover from concurrent double-pops of the same
signal
Date: Wed, 28 Oct 2026 14:29:19 +0000
Organization: Usenet Network
Message-ID: <3f939144-d4b3-4bc5-aaea-16422450d638@gmail.com>
References: <pull.2263.git.1792154272296.gitgitgadget@gmail.com>
<20261028133755.112476-1-hu2008yinxiang@163.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="1787572"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:oCUpMXntHcj6jq/pMnVcON2Cjp8= sha256:dILk4MQ+keRgxM8ptssn2SDe2FAIt3d1DOeffSPeMhM=
sha1:KVnPloIAY9E67P0QzsqrMB7PaPI= sha256:LGPO/UUcE7r2luTJgkdCDfhs542U8MZTbSrCUBtX5RU=
Content-Language: en-US
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 2A1DA125C36; Wed, 28 Oct 2026 17:29:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 91fEr9p-T2gT;
Wed, 28 Oct 2026 17:29:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-73655-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 58106125C33; Wed, 28 Oct 2026 17:29:28 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id B284327A61; Wed, 28 Oct 2026 14:29:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793197765;
b=vIvCsBFf3RyE8+/CHT9cm/aGtk910Ob+SjIXKOMU+5d/Gv4ipVMuCU3oGcGWdsHzfYIe
yb9r3AuqlrI0fpyetjY5bmJ3YW+MlvwPZENMAghZmui1Y9l/bBHDIWoUpVUbNJZpL8fuj
5YZFQj9GIk1iao0yv9GiloFoOKtHRD8u0i9Q/W9XcuRTWzMbL2bwfbkRChX3JwAXAY78A
BWR86Y3Qc+si0oFQjArKAICWXwezprJhHo1b9eSkn8baK7luFGKXX9vAoQUVmJtKQ0ERj
8CtdjkJP3clqGDf7Ec6r5ONdZblJIqmbIjSRK+cq9wyQ/2okHP9KW+3G7AvrVNRirPQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793197765;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=xHOgOLRLi2GgzjAZ9R4kAiwhgP1J+rfmSscDb9d0vRo=;
b=A+zNJK0VJudYNMoJpnVoblV+3zmENs54Fcju2ry3u6e0hp/aDecNJWEgmA9a2WwQ7YA5
kY5Y9toKyXVtIriB/oQUk+l2V9Gn6s3y9OpT+X/tDjGA9gRLsWPH/xL8uYrq1px5FyWDL
GroRJE9efNqDox6Rdi5mOiMl9PJCUW5kIjmh9+vK3H0dAsVGt1eVPrJD7l7b+NdXxJwcJ
Qpxrn676ob2QrhTe7sWG3sExUEs67NBxrElvao356PVs3OK2fQUTS1buUSJTGX+ogbYTn
prjYRhh9Jtv3M0C/Khv1rLVK+jtHKFWbZshca0aodYYVR6LdIa8pTrYOOo7safVgakQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BQhhX8gq;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 866FC606A323;
Wed, 28 Oct 2026 14:29:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BQhhX8gq
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793197764;
b=qWc10hWkj3kbYYdiytxGue9u/H9nvRKKw2s2zOZNmX5e8IwgkHT/0SoW45HjBUQXJXAl
sODZYPS5ULd3jXwvXdxsARIH8PM2n5uDDllFAZkEesupf7RBllgBhBGu5DA6Sv6PRApMo
a0YJLJ7YNyHdyzTCsrKwGSzZrpkml6bKrQ4j4wxcDs5U1WEBwaW8k+gnOqwHGlKcEX+MB
Xw31gKyqVJCclw7ATf/6q+p2njirLElvSzgRShR0kkpaYGA5O9fJfez5r8sYpMHF74uPM
IityC212GmGe6bYHw0TkmRGx7vXKNoMububF1c0lKHEvnMEI6QKRZ5enOjg4ChfWpOQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793197764;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:
References:Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=xHOgOLRLi2GgzjAZ9R4kAiwhgP1J+rfmSscDb9d0vRo=;
b=vsep8bSnURjwsKBKJU4F/za/IowUtXSCi9UpFRsuK8flErkqrRvhpA/pvlXrALg7pQwq
HZ6V0RIYyQLVHNuvwqSbksDIpG5e96K/MDpOxmGi5MoxjLkCvm0vtP3D2lt3v+pLIhSlF
ESbqlKi1btgmLNiLMPFIpgSLAcUvxcJ+xxXhw+nLg1s4BEj+edqeIbU4QNyYo0frmJYRi
g9qyd3jnMlcEXdGCn7iACzfsviuvl1bpldL1t09ecpNdfO4yI3sMyXjocDz5QeJdlUKUq
dmj27zWBM+4f6AxarxxB5W7PNXRqBZQe1Y3iOcDM2Ka0mgVBGspZWBBiLKouVD5Cagw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BQhhX8gq;
arc=none smtp.remote-ip=209.85.128.52
X-Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59655606A31E
for <git@vger.kernel.org>; Wed, 28 Oct 2026 14:29:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 59655606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4a2069b9710so10124305e9.2
for <git@vger.kernel.org>; Wed, 28 Oct 2026 07:29:24 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793197763; x=1793802563; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=xHOgOLRLi2GgzjAZ9R4kAiwhgP1J+rfmSscDb9d0vRo=;
b=BQhhX8gqHVaWC7N06GbASMUGG6dVq3ardfv8iu2e9xZCuTwToOmBtuePo+Kv/4mzn6
8d+yLVb7DyZn/9NVPZ263WDz3WHiZOmgeZY3VDr5xz29092s15iUQxmNSLOv6DBklsTj
9hC6bKPsvSJ/1+mmmiELiD+KreJH6MdXDYdwdfPxUXD2sbWA0O8YS8aVF8o8gmxq0cu5
uYpY4pEsueVPORZ9FtvYLSq42kWz+ev3pPC+NCPKHBuwjRRRPjqgrLkNgE8Q8TzVSHz/
YnyMwI3vOaCCYQrrzZNs5bERKfCGn/dsW6LhnXEAG/iq+oMi6drMN+72SU/1ricUTYTc
Vh1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793197763; x=1793802563;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=xHOgOLRLi2GgzjAZ9R4kAiwhgP1J+rfmSscDb9d0vRo=;
b=Ujl7Wd56NRjjC+SbH4UN9ztNpr8LWB294OiN791ntH+JZwcpG070xHFgI2fLPlUheQ
3+iQ43QaI09RNmFnqskAWVj/zwYVQ2FYFI6JhyIgcahL/75NhIt7X2pu3hjzc5w3USdW
Dbc73JB9Gbvw/hag2deuHDO3ahuFNtjbXxfmjoWwHtXZVGX37a5/vKYv77MpehxzklCV
CjQXa3PDsNUMN0CPQuIvftjQq/ySvTLq38Dxc5BzAJEhdOLQ234UUAGGMdpII2fOLk94
oMrhphq0l0DIjk0pwtwkvL22GgY4pahJKNMT8l8QvtKaEI9ggOIDQzc4x154Skfx/8Kw
DZ8A==
X-Forwarded-Encrypted: i=1; AKwUvBzExO41CUoZhHjHqhgMPIWsmaE2retHSUqugS27HZglZGh3hsOD5PeTtEu9fZ04u9Y/w7U=@vger.kernel.org
X-Gm-Message-State: AFq9FYI+dNV+RKxf5Lvh1CMsYtZ4mcue24f34sPkuEjWImYXe28Z9moR
yTxZddmJ9zq49f4iKuaD84JWG41a8p/PZRy9UAC2nLwA+pnk84oG8sec
X-Gm-Gg: AYBFou07OC3Fc5mXu1e5zZjpVZqnZkDWdel2uyuViEhQLgrIKVzOZKnTbn/zoegR96Q
C4kynThAbonkDoKcSJ93t/lcSCN0JplIUYE35L/mcogdAjIbYtdQumhOMvwx9fDGq5H9RF8f/JJ
Kse5OCQz+CbUL2HSBBd9UF/GkB3I/XMvjz+4Urop3Igfs157C+3I0s2rgaYMn+rdefvHiTZynEX
dcWRSjlpfFUEj3m3Ob7UfJMcm8n9Zz6Qn1YOd7OCaZ+TC7kNzlq0Nd9tQRy7zuyb1SnoZNeUSn9
pVzVZMyDAkyMl1QiAA6z7rtIyg3w3qgFhfJ/vH8qMqOLcbkZR+8xPkkng5sqNegGrhR7VPHjAmh
64wc21xiOhypnb+QXqpqaIqXj1Wls5k28KZCHpjA842XmBh/1ItaYMt0NCq2Qg1Ys2iJM8jgvIu
rztcIMcv9yiyc0mXbPBK04Hoe3g5+4rhpnFIRruTEhvdBojxA/85BmlFjKW8IKT3CB9LjryK2zY
DbTfAmhWFYgrEfzXGsc+cdMOtiXIwCuUfCeWpb8IdgdDlxfOZo4LBDgVaL6z8zhD3w2zHD1yWyY
yMrYOo9o+WkK5D+O1S3JVlwkm80EqgHClWLQY+Q/Xh0UvYZUdKOguJOP6CbKW+4J/XmH7rDfdQ/
mYBvSQxQ=
X-Received: by 2002:a05:600c:3541:b0:4a7:9025:5c3b with SMTP id 5b1f17b1804b1-4a966f20483mr56815425e9.19.1793197762225;
Wed, 28 Oct 2026 07:29:22 -0700 (PDT)
X-Received: from ?IPV6:2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f? ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a977edc20csm42916725e9.3.2026.10.28.07.29.21
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Wed, 28 Oct 2026 07:29:21 -0700 (PDT)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Reply-To: phillip.wood@dunelm.org.uk
X-Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
X-In-Reply-To: <20261028133755.112476-1-hu2008yinxiang@163.com>