delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2026/07/25/09:13:49

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 66PDDmvJ552096
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 66PDDmvJ552096
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=R2b4ddoS
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3E304BA7992
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1784985225;
bh=Es80lWAD0YJuWV5xEzFy7dlU2rvVgGU89Elpmop24es=;
h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:Cc:From;
b=R2b4ddoSawNinXV6EbSbcL3ZSz/uAJeG82XYeIpJagDjGkDFds1RgLZ0jQQUjUadO
yuM356qh7ZvaOHUsLIkOcjs0nzMT4EpAo+HpJZgUazcW9t5RGmTU37VjtVHxx6Nk9q
x3MDC/uI467FVJANke0hoq1A0dvKWBPfzcAxH6V0=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30BC74BA2E17
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 30BC74BA2E17
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784985178; cv=none;
b=FZYGRy5OxWSIqyD76x9JauxzfvEuz0Ae1Dyu3xv3UKnYiOzLwp15VLwDbfi8Il9KP05/fWcLNe/9+OunG1t1Gjrwv6FDGkNc3mZxFu6Kx+Wcf3WuS7z3DQQmBXh9R1+KGejFJkgItDpQlSjQsQHPkXUsFrDirWIgTEXBlGOeZAQ=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1784985178; c=relaxed/simple;
bh=ZFrXc7E4WAWnVA4SjaaJMCbE/qhGJH8LfYZCwS7sfqo=;
h=From:Subject:To:Message-ID:Date:MIME-Version:DKIM-Signature;
b=G2kvUVpznKL29OBYt/O+bIvPDS57yrAt6Qd3YYaY0+IhDO425zLtmF+XAfEFvMiQjqvBeHiuUzqNsnGudFfiFEUehlNXb9tmPRCw39PnJOLeErQe6a9aARbDk9a0BWzXFKYe7spyjY+E+4NYvGBgVg65oEmBNK8EdXtUgiyzlXE=
ARC-Authentication-Results: i=1; sourceware.org;
dkim=pass (2048-bit key, unprotected)
header.d=t-online.de header.i=Christian DOT Franke AT t-online DOT de
header.a=rsa-sha256 header.s=20260216 header.b=P9Gy50ox
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30BC74BA2E17
Subject: Cygwin 3.7.0-0.569.g524d75ff regression: segfault on parallel open of
/proc/PID/fd/*
To: cygwin AT cygwin DOT com
Message-ID: <5687625c-9334-9eb7-f6e8-2df99a729f43@t-online.de>
Date: Sat, 25 Jul 2026 15:12:54 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101
SeaMonkey/2.53.23
MIME-Version: 1.0
X-TOI-EXPURGATEID: 150726::1784985174-DBFFC93F-18BA267B/0/0 CLEAN NORMAL
X-TOI-MSGID: 8d834357-5c9b-4c4c-8b46-1ab91690222c
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-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>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 66PDDmvJ552096

After 524d75ff ("Cygwin: open: Unlock fdtab before open_with_arch()"), 
CI workflow shows that 'stress-ng --procfs ...' now hangs.

Testcase:

$ uname -r # not with 3.7.0-0.567.g161e3cb999fb.x86_64
3.7.0-0.569.g524d75ff7398.x86_64

$ cat proc-self-fd.c
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>

static void * threadfunc(void * arg)
{
   (void)arg;
   for (int i = 0; i < 100000; i++) {
     char path[32];
     snprintf(path, sizeof(path), "/proc/self/fd/%d", i % 10);
     int fd = open(path, O_RDONLY);
     if (fd < 0) {
       printf("%p#%06d: %s: errno=%d\n", pthread_self(), i, path, errno);
       continue;
     }
     printf("%p#%06d: %s: fd=%d\n", pthread_self(), i, path, fd);
     close(fd);
   }
   return NULL;
}

int main()
{
   pthread_t t = NULL;
   int ret = pthread_create(&t, NULL, threadfunc, NULL);
   if (ret)
     return 1;
   threadfunc(NULL);
   ret = pthread_join(t, NULL);
   printf("pthread_join(%p, .)=%d\n", t, ret);
   if (ret)
     return 1;
   return 0;
}

$ gcc -o proc-self-fd proc-self-fd.c

$ ./proc-self-fd
...
0xa00000500#001908: /proc/self/fd/8: errno=2
0xa00000010#001900: /proc/self/fd/0: fd=3
0xa00000500#001909: /proc/self/fd/9: errno=2
0xa00000010#001901: /proc/self/fd/1: errno=14<== EFAULT
[hangs, kill -9 does not work]

$ strace -o trace.log ./proc-self-fd
[taskkill /f /im proc-self-fd.exe in other window]

$ less trace.log
...
    25   21725 [main] proc-self-fd 14876 fhandler_pty_slave::open_setup: 
/dev/pty1 opened, usecount 3
    61   21786 [main] proc-self-fd 14876 build_fh_pc: found an archetype 
for (null)(136/1) io_handle 0x200
    66   21852 [main] proc-self-fd 14876 build_fh_pc: fh 0x800008E40, 
dev 00880001
    71   21923 [main] proc-self-fd 14876 fhandler_base::open_with_arch: 
line 471: /dev/pty1<0x8000086F0> usecount + 1 = 4
--- Process 3968 (pid: 14876), exception c0000008 at 00007ff81682416a
--- Process 3968 (pid: 14876), exception c0000008 at 00007ff81682416a
...


"... found an archetype for (null) ..." <== Hmm...

--
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 © 2026   by DJ Delorie     Updated Sep 20 2026