www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/13/23:57:15

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52E3vEqM825509
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 52E3vEqM825509
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=NWduA5vG
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 032B53857BA0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1741924634;
bh=r6LZKlecNM19E+btcvogvOv1FAoVp/gD1fTEYTuK8JM=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=NWduA5vG1z5uz8rSnjLsEHOyQZEqAcRDexbT9hY6lIvwk7L4//TZyUnQ0lASZ2YSA
qamJYmm/BtzwN1c8yLYdNwfUvma89ENM+2C5RysEjIxYJ8GIjYp6GBBUz0xyq9r3Be
m6K23yiekfTwp2IQ0hLYAm1pgwXGUrOCc3JbpOOQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA0DC3857BBF
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA0DC3857BBF
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741924607; cv=none;
b=GR/tdC8dOSMr+txgESqjr5kZbjz5HiloD3gmPw7Eaor6nUigNAQkI0b0XYTbyaWEmDdHyiGlmEpOy34QsUxHIdE+c3w1LG2q08pZq7YiGBsBOr08WPhi2AeQ81xPCN+szKyqVthJX8ak/7GKbJB+GwrAhfU3SXDhHDdHtfiBeho=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1741924607; c=relaxed/simple;
bh=WHSDKK3u2EMJ/D4S9TVBf538+V7fhUsTRB8MHbLKNP0=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=EktrvL6C3kbUMrkvrA6RjJOlDiWuLlsQlloZAq3MuOA0y5uBuajmF71sDmoPI/fOEcCcmJHV3laiwpzcnREEpBmdArzlejEADE/oAD8Lfzz/jjo+r8fTUaRnAzR9IBNe6x7tSJ22I57HOfGgkfYSJ18X9mpKTeBq5kF1ws9Frgs=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA0DC3857BBF
Date: Fri, 14 Mar 2025 12:56:42 +0900
To: cygwin AT cygwin DOT com
Subject: Re: cygwin 3.6.0: No signals received after swapcontext() is used
Message-Id: <20250314125642.0b8316d1a013681f8fac96e7@nifty.ne.jp>
In-Reply-To: <20250314081841.18cabfbaf99daf6ecc3f8ab5@nifty.ne.jp>
References: <bf4eb7e1-66e3-e1f9-67e2-c4d4a75ff6c8 AT t-online DOT de>
<Z864NNIyYwOWk5I3 AT calimero DOT vinschen DOT de>
<373993a3-9f0f-9750-60a0-950f83b3b0b5 AT t-online DOT de>
<Z9Gooi9C1UcJBuMW AT calimero DOT vinschen DOT de>
<Z9Gw6inr56cd4TGe AT calimero DOT vinschen DOT de>
<Z9G1BBjghen0kWvx AT calimero DOT vinschen DOT de>
<c0000d72-2b39-2647-648f-9006bed1273e AT t-online DOT de>
<20250313204252 DOT e340f0de50838f161b0e8323 AT nifty DOT ne DOT jp>
<20250313213148 DOT 6c2cb65f5e692005f28d3d2c AT nifty DOT ne DOT jp>
<Z9MIKWFS1q-TYojK AT calimero DOT vinschen DOT de>
<Z9NgWcJyt9kS5lCG AT calimero DOT vinschen DOT de>
<20250314081236 DOT bbdb1da7d746745925cdc752 AT nifty DOT ne DOT jp>
<20250314081841 DOT 18cabfbaf99daf6ecc3f8ab5 AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
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: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
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>

On Fri, 14 Mar 2025 08:18:41 +0900
Takashi Yano wrote:
> On Fri, 14 Mar 2025 08:12:36 +0900
> Takashi Yano wrote:
> > On Thu, 13 Mar 2025 23:46:49 +0100
> > Corinna Vinschen wrote:
> > > On Mar 13 17:30, Corinna Vinschen via Cygwin wrote:
> > > > On Mar 13 21:31, Takashi Yano via Cygwin wrote:
> > > > > What about following patch instead of your sigdelayed patch?
> > > > > [...]
> > > > > @@ -1834,6 +1841,26 @@ _cygtls::call_signal_handler ()
> > > > >  	   signal handler. */
> > > > >  	thisfunc (thissig, &thissi, thiscontext);
> > > > >  
> > > > > +      lock ();
> > > > > +      if (stackptr == ptr)
> > > > > +	push (retaddr1);
> > > > > +      else if (stackptr == ptr + 1)
> > > > > +	{
> > > > > +	  DWORD64 retaddr3 = pop();
> > > > > +	  push (retaddr1);
> > > > > +	  push (retaddr3);
> > > > > +	}
> > > > > +      else if (stackptr == ptr - 1)
> > > > > +	{
> > > > > +	  if (retaddr2)
> > > > > +	    push (retaddr2);
> > > > > +	  else
> > > > > +	    stackptr++;
> > > > > +	}
> > > > > +      else
> > > > > +	api_fatal ("Signal stack corrupted?.");
> > > > > +      unlock ();
> > > > > +
> > > > 
> > > > This... looks confusing and desperately needs comments (or at least
> > > > I need comments).
> > > > 
> > > > stackptr == ptr + 1 occurs if another signal arrived while the handler
> > > > was running, but isn't there a chance that sigdelayed has been pushed
> > > > as well, i.e., stackptr == ptr + 2?
> > > > 
> > > > I have no idea how the stackptr == ptr - 1 situation is supposed to
> > > > happen, though.  `else stackptr++;' looks weird.  If you don't push a
> > > > known address, what do you expect retaddr() pointing to, afterwards?
> > > 
> > > I have a slighty changed version. This one treats anything other
> > > than 0, 1 or 2 new addresses on the stack as bug.  I really made
> > > an effort trying to come up with a situation where the signal
> > > stack underflows, but I just couldn't.  If I'm missing something,
> > > please explain how this may happen.
> > > 
> > > Apart from that, I attached my patch proposal.
> > 
> > I think the following is the right thing. This version pulls return
> > addresses completely (not only one) before calling signal handler.
> 
> Sorry, I forgot to mention why.
> In the next case, the previous patch consumes stack one.
> 
> User code
>   signal handler 1
>     signal ahndler 2
>       longjmp
> User code

No, I was wrong. The _cygtls::stack is pulled every time
when call_signal_handler() is called. So, the _cygtls::stack
is always empty when signal handler is called.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
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