delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/13/12:31:48

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52DGVmfW217407
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 52DGVmfW217407
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=kY/ZaUSJ
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C031C3857C6C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1741883505;
bh=bsTTyGnI2LciT9CrN2K50ohf0KnVmol9wAQ8DRjF/W0=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=kY/ZaUSJTtAg1a4uuaBzW5VYeh0rIVB3iLbiMJbFBsr3wNIgzNlNfVbDv+bMi6g72
MRwjpb2lSJE/Vmh46AYxhYE7a0/ItwuA3FcI3SQrdfsdxHXcK/Jf065GNov46WOXce
qv1Jee5227W9MyspYqhktGElaC7cCRlNCSH3Kn/8=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1A5F3857C6C
Date: Thu, 13 Mar 2025 17:30:33 +0100
To: cygwin AT cygwin DOT com
Subject: Re: cygwin 3.6.0: No signals received after swapcontext() is used
Message-ID: <Z9MIKWFS1q-TYojK@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <Z8nxYCxthcsMVqzL AT calimero DOT vinschen DOT de>
<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>
MIME-Version: 1.0
In-Reply-To: <20250313213148.6c2cb65f5e692005f28d3d2c@nifty.ne.jp>
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: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
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 Mar 13 21:31, Takashi Yano via Cygwin wrote:
> On Thu, 13 Mar 2025 20:42:52 +0900
> Takashi Yano wrote:
> > After the commit:
> > 
> > commit a942476236b5e39bf30c533d08df7392e326a4c6 (origin/master, origin/main, origin/HEAD)
> > Author: Corinna Vinschen <corinna AT vinschen DOT de>
> > Date:   Wed Mar 12 17:17:31 2025 +0100
> > 
> >     Cygwin: sigdelayed: pop return address from signal stack earlier
> > 
> > Christians test case: timersig.c no longer works even with my v3 patches.
> > I suspect it is because pop(), retaddr() are not working as intended in
> > call_signal_handler() with this commit.

Sigh.

> > Could you please have a look?
> 
> 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?


Thanks,
Corinna

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