🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1808

Re: [PATCH] sigchain: recover from concurrent double-pops of the same signal

#1808
From: Phillip Wood
Date: Thu, 29 Oct 2026 11:15
60 lines
13379 bytes
A couple more thoughts ...

On 28/10/2026 16:39, Phillip Wood wrote:
> On 28/10/2026 14:47, ian4hu wrote:
>>
>> If you prefer the thread-level fix, I am happy to build it: a
>> git_pthread_create() wrapper that blocks SIGINT/SIGHUP/SIGTERM/
>> SIGQUIT around pthread_create()
> 
> I think that is probably the safest solution (though it does not help 
> for threads created external library code - I'm not sure if we have any 
> instances of that). I'd be interested to hear what others think, so I'd 
> wait a couple of days to see if anyone else comments before spending 
> much time on it.

We have a number of places where we spin up a bunch of threads to 
parallelize some work, for example in preload_index() we create some 
threads in a loop to read the index. In cases like that, where the loop 
body is just setting up some per-thread data and creating a thread, it 
would be more efficient to block signals before the loop and unblock 
them after, rather than blocking and unblocking each time we create a 
thread.

>> - leaving SIGPIPE alone, since it is
>> a synchronous signal and blocking it in workers turns deaths into
>> EPIPE
> 
> Does it? I thought that happened when its disposition is set to SIG_IGN. 
> Blocking a signal delays its delivery until it is unblocked, it does not 
> ignore the signal.

To clarify, in a multi threaded process the delivery of the signal is 
only delayed if it is blocked in all threads. If there's one or more 
threads where the signal isn't blocked it will be delivered to one of 
those threads.

Thanks

Phillip

>> - plus a sigaction()-based chain that masks all signals while
>> a handler runs.
> 
> When I wrote my last email I was thinking about blocking the signal that 
> is being handled as sigaction() defers the signal that is being handled 
> unless SA_NODEFER is passed. However, sigchain_push_common() sets the 
> same handler for all the common signals so it is probably safer to block 
> at least those as well as I'm not sure all our handlers are reentrant.
> 
>>  I would then drop this patch, or keep it as a
>> separate last-resort series if you think the belt and braces are
>> worth it.
> 
> I'd be inclined to drop it - if we're handling signals in a single 
> thread that should avoid the issue.
> 
> Thanks
> 
> Phillip
Technical Details
Message-ID: <d18d98c9-08a7-48e1-8a6b-a43aed05dec8@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-73752-linux-kernel-git=dewy.ru
References: <3f939144-d4b3-4bc5-aaea-16422450d638@gmail.com> <20261028144736.121433-1-hu2008yinxiang@163.com> <0806471f-957a-4f32-ac33-c00c25a46033@gmail.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-73752-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: Thu, 29 Oct 2026 11:15:05 +0000
Organization: Usenet Network
Message-ID: <d18d98c9-08a7-48e1-8a6b-a43aed05dec8@gmail.com>
References: <3f939144-d4b3-4bc5-aaea-16422450d638@gmail.com>
 <20261028144736.121433-1-hu2008yinxiang@163.com>
 <0806471f-957a-4f32-ac33-c00c25a46033@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1994495"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WvYpfFweGK2yO5IwOYAaxwhUacc= sha256:GWFxkpvVlJQthH1VykcVOwFT5ipJ1Pcz+LFsQYVhixE=
	sha1:BSeli4Mh87yDQjoxI7dq5Cff2Cc= sha256:ohmEvRYXTPRPpIiOsYp2AL9u3TLCdXRlBkOArXqeO6w=
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 07C0C125C63; Thu, 29 Oct 2026 14:15:30 +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 wCbS4CspmFWT;
	Thu, 29 Oct 2026 14:15:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73752-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 89BD5125C62; Thu, 29 Oct 2026 14:15:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 949C625A7B; Thu, 29 Oct 2026 11:15:11 +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=1793272511;
	b=uQmoFK532Zi2Ol8dTwimxHEGl6uGPnPx236t513DeHJDP3qz2vIOywNFKUJsrHQF2NJB
	 RmfTy0KbqmZSYj3SdcS92AfvfZKlhr9w97YnSHjgxqWxOc42YcbmeJcIMTZ9yL0OtTrNJ
	 Nr2Jl7g4vxAGq7WDDV3oRsV7DzRcZ1HJdIL/VUfNKwFu/3T2AIKbyTFINlpJr242YH0Aj
	 CH3/7nk5fSCv0Xs6X5hy0/Ch655a/1Y3hN7jtXkCEmrVUgCGQJEJmB/JZp+taMBkAZWst
	 1m6jK/WVZ0L4vVEOzCfGbJEhKVqe+0vfMQBJM1gpEGbBihQE1ElAKhmlBp+RtQ7lmvg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793272511;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature: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:From:To:Cc:References:Content-Language:
	 In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=BTfP7ps0oM9oVvh1+Tyuy0od+iW8gWvZyrnDp0FRNP0=;
	b=aeDIU0GsF0OR8NYBrSGmQivdQgrgf5lzpKmtm+xuBqIWtNbjgDaBagwpfHr8F4FQdKna
	 trscK7snJnvCsCKhLLKH8MSaMMSwsd5E0nm4jRC14SdSJYoXXPST/9/DbXOcF6dsVbORD
	 UJT1vB4KX/9Z0oLudKMsdORkmXq0MVuqFRzUMGfBs/GfoDgs1Ulpjd9KpdLbI1+bqwbTw
	 otyUB6f0MdXX6MIBW0cwbcTl7jLsu2A3L+mgBvnrXhEqygoKKjGJ6dRec3drljGgWfWbT
	 C1p43cl1Hey2QgmTGdGa1dtucMxlSmtnenlcOBTHAwJN9NmMsHdoA+sFDBGIjQhVJSw==
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=lCJaC9w3;
	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 57C26606A327;
	Thu, 29 Oct 2026 11:15:11 +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=lCJaC9w3
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793272510;
	b=RT6z3uPLoDp8r84Ttf24DuaKDM8yCCISdaLRV4DVlIbWAHDfnSZDoHkVUAG6/vhGNz/H
	 ELW4cM7O0UbUKKkwW34LRmngGHtLSSbWiK9MR73fQsnNsv6/39e+qHSOMQAonj5KHwC45
	 SBUFqD8l+8UOGGUc/6WBgBbCJ6Ii8bkHK82T66RsTx2WOgnJQU2hy2ZT97eXWRfJCfRa1
	 Tm2iKIIBSR2y/IhVWht6EyDpkUHHbZZIIFmN9RLAUybspnKRHETVYI94ICTSny/ds/kLm
	 OVn1RV++56a7+ap0nHlvViQqxEwhlpciWFIKNP5qal+WaBu1SZCTx220a1l+iiFDmNw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793272510;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date:
	 MIME-Version:User-Agent:Reply-To:Subject:From:To:Cc:References:
	 Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=BTfP7ps0oM9oVvh1+Tyuy0od+iW8gWvZyrnDp0FRNP0=;
	b=c2zVRPN/eLGweo6WLH4FJyFSGN60SyK1c7h4Oz4lhNhbwyFMYf8aEwJwmLCL8NGEXJH6
	 Xlfq5ripDnvr0lEcq5EduTtwssRozDPoPRpyypTzKvSKVvetMyHQfl1g1sunjwl0v81UE
	 ooIi75ujvjI2sdVIsUXVcxo77/21ZdC5BVSHgnHF7jsKl/iVx1CyubUQoaBBxycI4NDTK
	 2+KyEFlrsVgTM44uZawwyepVv5Yde75nx2A2sqICCJVC1QnOE02AsCXKUpDL6XwZTUsW3
	 mLxJooCEYiNOVo3hltnJ+vwey3YkCZLmNlxp5IxXXTWZ0mAG+z/2CaWuijqKoIKnv8Q==
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=lCJaC9w3;
	arc=none smtp.remote-ip=209.85.128.49
X-Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49])
	(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 2901A606A31E
	for <git@vger.kernel.org>; Thu, 29 Oct 2026 11:15:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2901A606A31E
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-f49.google.com with SMTP id 5b1f17b1804b1-4a4d7ae1ae9so18713455e9.1
        for <git@vger.kernel.org>; Thu, 29 Oct 2026 04:15:09 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793272508; x=1793877308; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:content-language
         :references:cc:to:from:subject:reply-to:user-agent:mime-version:date
         :message-id:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=BTfP7ps0oM9oVvh1+Tyuy0od+iW8gWvZyrnDp0FRNP0=;
        b=lCJaC9w3iUcOro8j12Kr0n7zmS50rd9RGxpsVU++VavIXz+agJr0CqlFcW1xt/LE8F
         d9CQS6qUgmkraqpyp/0o66ddrMvNnHMnM511qQCcyrRVFfuK84HpfzvHnt/Kr7tw96PQ
         QuSZHEF8Ehca9A/h7oYscmT2ITjr2hCroPdSzfkB474JyddwXWHn8156kzjfaWj/OrHF
         j3GEKjWCmepO0Qa5HpmWkUHvriZlCHP/f1jr5Pm0/ZU4sqZtjCuuZIiHR3OQP+BaAnvx
         Ues/QaK7NrukViSwEHQTdZU3UawZOOGWhTZkvJfX4ux6p1xvpwLaF/AZFLYhXx05Ph/D
         Udow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793272508; x=1793877308;
        h=content-transfer-encoding:content-type:in-reply-to:content-language
         :references:cc:to:from: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=BTfP7ps0oM9oVvh1+Tyuy0od+iW8gWvZyrnDp0FRNP0=;
        b=QmjHg6ajRUWLgHXigEIXyRab2aLEBFvWsrvtn+TsL9Se1+Vwd/ttrYRviOzyWG6lYI
         Aj2H8sGdhEl0aOse1UGWVdsd3KcV0rL5N2gUnyEEGClEqxJjr46WrBf2AhfllblVkI02
         nhk3e1OY9AdRbGcQdXFIm+c7kj3sQF0Jnhbbjld7NEfNzpnWxfZZcgBpsKYn1gvYbDoR
         h9yvaLpsnGyMF7Y+sKWVkQMgMnDvIqoZYpVi6DErBJjZDM24IBj+xvFP+ANUlIUeE6lA
         PwkZ7JTZyYFpH4MYnbszaJ6C5J5G3hcWw43CHkrt65Q1ZrB5IkzpK9ODlQYAz4dgtvhp
         khfQ==
X-Gm-Message-State: AFq9FYJcdSIH1mrLUqBnCriDu7j6YjnFxyHn5bEgE/unIQ0L9cL5Qm7o
	2FmtErvXhSiIjJL7C1ThDu6W99BbaLEMSd+I9+unLukZxybHQyyWzvDw
X-Gm-Gg: AYBFou2uUmN2AcVaC2g3x3jqSIb+5urtye5gqjYzXh6XjxhmQOkwZUKmI/g7CvWS+Gi
	C9N6mB18m2TJej6HgG9yRm80n2Ein0vPY4CxJOas1Fb37UfVNERYpONdNVO1JgMtMBkWwMTCbIq
	Cc9nqH2Ta+DPedAJE6z/1HQ5octh/F7SWUXm2wDWjs3J4HSEuQ3/t2AAHaxNxAfgfPm4+B7abui
	Wv9aiCXIlw4I4ZuFxEagTtoQ1OJWLuY8yPpMJ310XGkm7i3AZ+8o4t2o7YLl4GwdWt1+QFmrD2y
	7wNGtoAGis9WiOXOd2D6L6lGH1PJttgC6FGMFo3M//NbFIiWDEV3hAOOHPr4T+sgQWrsijCNCl2
	/XG0aQE0I52rrxJoc6VaQMpTXwsbgov3WA5P/UnfjiEvfVpRDP0wTVg6OQKRltBJJqChFAexT9A
	wF5O8I7gaieeIDmBUToNMKZvjBX9/y/RYAhQ+hb6R45OyV1DYodX0U9fyEy28c0cyjeVTE2Rs4Q
	6QcwsZX0p2K2DLfmNREuTNw37+HLZ5qPA3Rre8HH3yFCc7OcHtMFtHDNjzWz11n9DOyBZ8r7Dv4
	LRyTSgM3+h6cPGRCWjYf2NShwKuO8jJgn/yGeoMVIRV363v9e4KZRBiqDftKosObSLzB89T205A
	7qYhrbCqbLA/3h6csogbEb3G3PJHq
X-Received: by 2002:a05:600c:3b8f:b0:4a1:dbdf:17a8 with SMTP id 5b1f17b1804b1-4a9643d381amr125623655e9.2.1793272508320;
        Thu, 29 Oct 2026 04:15:08 -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-4aa7f41895fsm51419115e9.5.2026.10.29.04.15.07
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Thu, 29 Oct 2026 04:15:07 -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: git@vger.kernel.org, gitster@pobox.com, peff@peff.net,
 phillip.wood@dunelm.org.uk
X-In-Reply-To: <0806471f-957a-4f32-ac33-c00c25a46033@gmail.com>