www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/05/27/11:45:47

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 54RFjlAv3620597
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 54RFjlAv3620597
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=rzuMfQBM
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2CBA385F025
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1748360745;
bh=aoCFQREUim0eebOaKqHLPhpiWjuqkPdKz9VPklfcsWA=;
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=rzuMfQBMYBMfxvWZ0+mzxPNGQ8jwZ6nd5THFvnhA8MFtjD3Lr9W5i1kNork2rYT8v
WdvXzEO1j+H56D26c1yscFG5MeKRcUdqxFS26MjY/v4nsrYzfAilBUIJr/KrOM36JM
3LB+f/GChENZa++kYNI1ABkm31f2tkOlb+g2hfek=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB0F1385840F
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EB0F1385840F
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1748360654; cv=none;
b=DFXbR+b+n+DaJGkgTIX6K2t40/PS6WyUPDD6pRw1ugyAvGNONfi+VWjmpU8wNISs+kwBRk6/CVoAhOycd0rdREr9mQUTEDjmhzRU4t772oi6jh0ADkchCdbEN7OEPo8zOuOcXo5LrvxrUKCjf8Z9EwLqVvPEedpSzcC7+zqtuKM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1748360654; c=relaxed/simple;
bh=UW0xpIAz2xbjQLZe0Io17kVkojW+yBJr0hm+blPgrXE=;
h=Subject:From:To:Message-ID:Date:MIME-Version;
b=G04Q0vAxYwlA+Rec0c4ClCXCBUxP0+LzUXW/KBTCyCX2XlKeAjH7+As+j063U3zsmOUD+vEto+qzihnawY+fZe44vH6Y7li89m8rsJZIx7oqZ5K0PSM10F0kH9PJD5Eklmy6+/UUzIIC9HMIHTTgsVJXbBl37GFPRw57SbrjWWA=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB0F1385840F
Subject: Re: Segfault if /proc/PID/maps is opened in parallel threads [CAUSE:
RtlQueryProcessDebugInformation]
To: cygwin AT cygwin DOT com
References: <2f7ae08b-80c9-4497-f07c-5d527bbb7ec2 AT t-online DOT de>
<17bba06c-4bdd-01df-8477-235aff98b2cb AT t-online DOT de>
Message-ID: <9deb7d60-b05d-ad7f-e316-64781687953b@t-online.de>
Date: Tue, 27 May 2025 17:44:10 +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: <17bba06c-4bdd-01df-8477-235aff98b2cb@t-online.de>
X-TOI-EXPURGATEID: 150726::1748360651-CBFF55E7-DFE129DE/0/0 CLEAN NORMAL
X-TOI-MSGID: 185dafdf-1bc6-4177-8585-eb7791b4dd49
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>

On Sun, 25 May 2025 16:46:49 +0200, Christian Franke wrote:
> On Sat, 24 May 2025 15:19:10 +0200, Christian Franke wrote:
>> If /proc/PID/maps is opened in parallel threads, the process PID may 
>> segfault.
>>
>> Testcase:
>>
>> ...
>>
>> Problem is not reproducible with any of the other /proc/PID/* files.
>>
>
> A closer look shows that the problem is unrelated to thread safety. 
> The segfault also occurs when the following command is run 
> simultaneously in two terminals:
>
> $ while cat /proc/1234/maps > /dev/null; do printf .; done
> .............cat: /proc/1234/maps: No such file or directory
>

The root of the problem is the call of RtlQueryProcessDebugInformation() 
here:
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler/process.cc;h=8fae9be5#l630

If this part is removed, the segfault does no longer occur. Then 
/proc/PID/maps still work but the "[win heap ...]" information is 
missing. No patch provided because I don't know whether this could 
possibly be fixed without removing this functionality.

A test with a separate test program shows that the problem is unrelated 
to Cygwin: Parallel calls to RtlQueryProcessDebugInformation() with the 
same PID could be used to crash this process. It also "worked" with 
Notepad.exe.

Possible Windows (Version 10.0.22631.5039) bug?

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