DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 52PDfFCV2668983 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 52PDfFCV2668983 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=QTGICgpN X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE0D2385772A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1742910073; bh=6DnWhna8Jw+N4hPwYExtC8zHCMqnYv7QXE8t1+4pXKM=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=QTGICgpNyWXx4acKdqF8HBC21yUg3xNQt1pfEECKsZsUiNZLxsPg3hGf6GS2bFuNq vRCzAl+0ECTfb05Rel3kNC6MXYtU1xRtAThYaNSHhGnaLndI3Iq5uPVE9EOguNvs0+ 6COq9TrdrPN+sHZEt0sHmmDtLR+8RYL3uvTakd+Q= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B3BD63858D33 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B3BD63858D33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1742909918; cv=none; b=ZZRYNAov/w5W1BMNFsvE1M0sXRudFUnsUouy5aw2P8n2SemaW3WEqno30W6WW53cX3vSvOQJM3/jS5bw+MQkZEEn+IncMmseaX0DpCuFLPVWhCjCEFPdg0wUqQ8iqeoZeCKbYH7rizmFy8fHTlxigIbCQkeSF1hzD6bTSkhbu5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1742909918; c=relaxed/simple; bh=XercvGfuf5eZEsw0b1a97sys7+YeZnma5LgWIWW190A=; h=From:Subject:To:Message-ID:Date:MIME-Version; b=bG3/bSV8WIkXyEKsUTj5g+5jebgTLNg4Vf+DgfkTbqUX/mcTMivKMvzgUt72qX2qX9YXG3TZJY/yPKgmoByj96wGzR7nDYHs/gopmMIjlablyKZiqXcwfELAMAAwE0YExtBm+Z+/p19mBY7H8nBX5/WveEAvA4QNi2ZblqU8zfA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3BD63858D33 Subject: Hang or crash after multiple SIGILL or SIGSEGV and siglongjmp To: cygwin AT cygwin DOT com Message-ID: Date: Tue, 25 Mar 2025 14:38:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 SeaMonkey/2.53.20 MIME-Version: 1.0 X-TOI-EXPURGATEID: 150726::1742909915-99D0FA4D-76373BCF/0/0 CLEAN NORMAL X-TOI-MSGID: 3761934c-cf8e-4bf0-8165-4aa506cfd189 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Christian Franke via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Christian Franke Content-Type: text/plain; charset="utf-8"; Format="flowed" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 52PDfFCV2668983 Found because 'stress-ng --priv-instr ...' hangs and then requires '/bin/kill --force ...': Testcase with   [PATCH v2] Cygwin: signal: Copy context to alternate stack in the SA_ONSTACK case already applied: $ uname -r 3.7.0-dev-16-g2ef1a37e7823-dirty.x86_64 $ cat loopsigill.c #include #include #include #include static volatile sig_atomic_t sigcnt; static sigjmp_buf sjb; static void sighandler(int sig) {   (void)sig;   ++sigcnt;   siglongjmp(sjb, 1);   write(1, "[FAIL]\n", 7); } int main() {   signal(SIGILL, sighandler);   printf("pid=%d\n", (int)getpid());   while (sigsetjmp(sjb, 1))     ;   // loop:   if (sigcnt < 10 || !(sigcnt % 1000))     printf("%06d\n", sigcnt);   if (sigcnt >= 100000)       return 42;   asm volatile ("invd"); // goto loop;   return 13; // NOT REACHED } $ gcc -o loopsigill loopsigill.c $ ./loopsigill # may succeed ... pid=122 000000 000001 ... 099000 100000 $ echo $? 42 $ ./loopsigill # ... or crash silently ... pid=130 000000 000001 ... 026000 027000 $ echo $? 0 $ ./loopsigill # ... or hang pid=135 000000 000001 ... 037000 038000 [requires '/bin/kill --force ...'] $ strace -o trace.log ./loopsigill # run '/bin/kill --force ...' ASAP! pid=142 000000 [always hangs after first signal and fills trace.log quickly] $ less trace.log ...    25   25501 [main] loopsigill 142 write: 7 = write(1, 0xA00017710, 7) --- Process 6856 (pid: 142), exception c0000096 at 00000001004011b9   142   25643 [main] loopsigill 142 exception::handle: In cygwin_except_handler exception 0xC0000096 at 0x1004011B9 sp 0x7FFFFCBE0    26   25669 [main] loopsigill 142 exception::handle: In cygwin_except_handler signal 4 at 0x1004011B9    38   25707 [main] loopsigill 142 break_here: break here --- Process 6856 (pid: 142), exception c0000096 at 00000001004011b9 --- Process 6856 (pid: 142), exception c0000096 at 00000001004011b9 ... likely repeated until disk is full or time_t wraps around... --- Process 6856 (pid: 142), exception c0000096 at 00000001004011b9 Problem also occurs - without the mentioned patch, - with get/setcontext() instead of sig*jmp(), - with nullptr access and SIGSEGV handler, - with Cygwin 3.5.7-1. I agree that this is not a common use case :-) -- 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