www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/05/29/14:02:08

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 54TI28vg668212
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 54TI28vg668212
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=fqUdrrOe
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F2B53857C5F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1748541726;
bh=HhEtFfGaIYoHexTTY4hQISFQpW8xcUBlLc6Qp7aTa3A=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=fqUdrrOe92zrQdJIdR+Y9P3dvD1IUu+nzyP2AsDnO2pVNPP8piZ7vZ9w3FvWD3VwI
TMO+3v2fAvfwDhi7JkCGIPb8na2UoXWQmFzGrx/80kYtmnPnALeRlUQdw8zRM0T+g+
Kl9acpR4OKbhUmFDAeMBoRk32Lv4gmODnCbrdtlU=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 321C83858C54
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 321C83858C54
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748541696; cv=none;
b=ahVeX31V+jrB4YvjpKT7YDsNXrGFW0PItJWUjx4bHM87VJN4LI/XWt9h3+2HT+vweFvWMuFPUFOW0m928CUhtN6h3Rt1G3UjFi8v4JrVmCcOaWPrQZe1BeUma0FQMxwtU0+AqGzOr/+Y9xF+7pkQbvNsVypcEjYdimxbHev3if0=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1748541696; c=relaxed/simple;
bh=dBXB/8I458yAk0Vp+K/6mrazP4q792+BjBgCvO8xskE=;
h=Subject:To:From:Message-ID:Date:MIME-Version;
b=qddZ9U813kDNneTCIsh6cKce2rE+wRmF4osz9Gmh3gi/XB5kZGLhI/dU/OR49CXb3NmhKeR1+UskkNs4UvrSLmQP9Se/fH/yESvBVCZJfH9EcwNTUIFQN35tN+bL6DCW86ijcUZQxRuadHZ5vztGODcRQAHZBntxfxGcxbQulIc=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 321C83858C54
Subject: Re: Crash or hang if SIGSEGV+SIGALRM are nested
To: cygwin AT cygwin DOT com
References: <c4335d1d-5394-2a41-f06b-feb5c9fb1398 AT t-online DOT de>
<20250528215707 DOT ddb72fb28122c3ed07da8c5b AT nifty DOT ne DOT jp>
<20250529102846 DOT 8144f502c3f17decbe6700c1 AT nifty DOT ne DOT jp>
<76940263-49e8-1b4a-17f2-11f5545014ab AT t-online DOT de>
<20250530015410 DOT e8c4808c7947682b3309fbe7 AT nifty DOT ne DOT jp>
Message-ID: <32cf9316-3e97-7fab-f975-851c3dfc25b9@t-online.de>
Date: Thu, 29 May 2025 20:01:31 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101
SeaMonkey/2.53.20
MIME-Version: 1.0
In-Reply-To: <20250530015410.e8c4808c7947682b3309fbe7@nifty.ne.jp>
X-TOI-EXPURGATEID: 150726::1748541692-B1FF8A2D-A17534F1/0/0 CLEAN NORMAL
X-TOI-MSGID: 2cb55900-26de-4491-b158-a765be78b5a3
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Christian Franke via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Christian Franke <Christian DOT Franke AT t-online DOT de>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Takashi Yano via Cygwin wrote:
> On Thu, 29 May 2025 17:32:19 +0200
> Christian Franke wrote:
> ...
>> I still don't fully understand why a SIGSEGV triggered by an instruction
>> could interrupt a SIGALRM handler.
>> https://sourceware.org/pipermail/cygwin/2025-May/258145.html
>>
>> I guess such behavior is valid from the POSIX point of view, but it is
>> at least unexpected. If the SIGALRM handler is already running, it
>> should have interrupted the thread such that the instruction triggering
>> the segfault is not executed until the SIGALRM handler returns.
> I try to explain what is happing using the figure below.
>
>     <<<<<< Main thread >>>>>>                       < Signal Thread >
>                                              SIGNAL
>    main()   handler1() handler2()             QUEUE    wait_sig()
>      |          .          .                    |          |
>      |          .          .       ALRM         |          |
>      +----------------------------------------->|   ALRM   |
>      |          .          .       SEGV         +--------->|
>      X----------------------------------------->|          |
>      |          .       arm ALRM                |          |
>      +----------+ <----------------------------------------+
>                 |          .                    |   SEGV   |
>                 |          .                    +--------->|
>                 |          .                    |          |
>                 |          .      arm SEGV      |          |
>                 +----------+ <-----------------------------+
>                 .          |                    |          |
>           longjmp()        |                    |          |
>      +---------------------+                    |          |
>      |          .          .                    |          |
>      |          .          .                    |          |
>
> The point is the exception handler does not arm SIGSEGV handler
> directly. It just pushes the SIGSEGV into the signal queue.
> The signal thread reads the queue and process it asynchronously,
> and arms the handler().
>

I see. Thanks for nice explanation!

I created an issue at stress-ng upstream because at least the --mprotect 
test is affected:
https://github.com/ColinIanKing/stress-ng/issues/529

-- 
Regards,
Christian


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019