DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 62QAGHLB2188564 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 62QAGHLB2188564 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=lai6G9k8 X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25EA34BA2E11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1774520176; bh=YXaV3wa13BHLF33fJJ/TB9c6d27esIHfZbUgfLkkZrQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lai6G9k8fc7oNKob0oNx3IjVzLVmyoQC1wnON/OEyHZTSuDSfLICMaBKFtS7y+cRt Rs0ua90zmz1hOD0nE2+xsbngktAFSsgm/J0mZrzebnPNjCdDI4VcsrYhtARZX8MoEi 1i33ax9pRHvKK/X0C/tNR6fPTCRtSNo3KM0Ttxns= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 946D94BA2E11 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 946D94BA2E11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774520155; cv=none; b=By/RP1iLTUEp+wfhUX2Pr1NdHlWVApglvk6eYV5/smhWHMjHFODljpoNmoJ2hbSbv5aBB7z7CwGhnQJlTuUHpIGjvt3WucgT8CtI6kBx9zl7/WzFVEQNbrQq5+TAcadtAqTSWjdK7a7GMZvNqBGsSb5mtWJkErSStC0lDZ+ucrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774520155; c=relaxed/simple; bh=jRgwjbAArjMeTB6CnoDh3zbzZbG2iOEJcDUdKSYB/4E=; h=From:To:Subject:Mime-Version:Date:Message-ID; b=n/RlcuwWY/Xf9LSHM5FzO//obUmvpNbfkqMKtRNSXDALuChZUdZ4LP3ZdjMNqVCRJfI16ddGnG3rcNKurDFqEqgBmg0qhNY+NhXlcTmMXn3jaffnCFg6INPs3z/51T63psObk33fM9F6C0Of2ZMpq8yQ1Z1JAGcsiOkzP/iNXjE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 946D94BA2E11 EX-QQ-RecipientCnt: 1 X-QQ-GoodBg: 2 X-QQ-SSF: 00400000000000F0 X-QQ-FEAT: D4aqtcRDiqTSsxwgbpkr0H2dMTsnn5XHB5O4+HrFXFU= X-QQ-BUSINESS-ORIGIN: 2 X-QQ-Originating-IP: OiRD8gZe6r5CpY9mOavLW7ULrLhHSiwJxFsOaClHoTs= X-Originating-IP: 112.224.230.122 X-QQ-STYLE: X-QQ-mid: lv2sz3b-1t1774520149te73ef84c To: "=?utf-8?B?Y3lnd2lu?=" Subject: Bug: MapViewOfFileEx 'cygpid' fails with Win32 error 487 on Windows 11 x64 Mime-Version: 1.0 Date: Thu, 26 Mar 2026 18:15:48 +0800 X-Priority: 3 Message-ID: X-QQ-MIME: TCMime 1.0 by Tencent X-Mailer: QQMail 2.x X-QQ-Mailer: QQMail 2.x X-BIZMAIL-ID: 10665984710005052971 X-Address-Ticket: version=; type=; ticket_id=; id_list=; display_name=; session_id=; X-QQ-SENDSIZE: 520 Feedback-ID: lv:nui.st:qybglogicsvrgz:qybglogicsvrgz3a-0 X-QQ-XMAILINFO: OKhYnE1LzMsB15Meaos6y9ENt0tV0RM+eygx4uPEhDG+QRz0YNgn2aRd 9m0CaMfSt1xO2rVNzMPXEn4j8Pj52LTuqDak0KKU4fPLXgmPnUDT3UWyYM8RL/Wux79HgJ6 ifUSPIA2TDJ6kerkclg/YTdF0XP8qXkFhbnEQnWhUO+1Dktt6N4Lff5izLBUOW2mYrA7+6a l/tmi4OIUDY5FwINXAXJP8TmOVYyDSD4cIfqckTk4q7mWLwU42Qr+lovlJ+LY2RQunrXZj+ x2HWWuSNjOphWnsNkE8FZhnp8HbaNWCedNuf3XTY9Y3jX2Ki61daEgdR2JYm4pqTqRW+ITW HRe5b4Dr3at3gA1xxJgd5haE+4os3jCqZV7jVkHfmTjrcyIrL8U5NZZbR4/ky46Er20hCsB 44d1tzheB1WoT2JY9q6IdN/s96i20hZbjK5rALprT+aosXX9UDwUI8DDMOhvZs7do5vZGdL tH4MHKRnV/1UYr2PMMiS9ZrqJoYhDPtRByp1I3L0ZfYzq6KIN+t/Ojy5HVBi6Y6K1njigT8 WcPNAMcRaVU4VM0FzmSrL1Fq/Xlp1zYGexnNEj4kgT6UO0d5E+KmaEpt9tgzdgTdbuMcYEG 1Ro9diPcyIQ9sNHkgeRPtsLvvqeCoobaJaA1ycHz4KFfcEQNmf/4xW3hdetijkro9qhiTOt vsgA8vVavKMrqeRKdXCVJ05WwQsapULGkDBZA5EMaA2mkTsG4Bwx/GuPw/E3YU/GdLMV5x7 iHQ9H8O1sA99ougdc1HnmD/DKbcUon0ALPV+k0mQoN2EkjlXWR5trxWWhy81meQskEgiHuw +n8GZXcO1/Kk3flOftOGK3elHmwsrlI6UikBhkF7MReErWjeJBJZ4QbMkrEyeonb5dc9KHd iPdFz+SEkCFLaLtdhjbZE68+IAIglk7Cknac6H4zLkT0K96a/jJu2dcEliZ0Zzvk7qktfC/ tST+DfDtzgzD4rH5za9qhYTKuwDygKDhT6esqaLrmCGLeoQ== X-QQ-XMRINFO: Mp0Kj//9VHAxzExpfF+O8yhSrljjwrznVg== X-QQ-RECHKSPAM: 0 X-Content-Filtered-By: Mailman/MimeDel 2.1.30 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: =?utf-8?b?6ZmI6YC454KcIHZpYSBDeWd3aW4=?= Reply-To: =?utf-8?B?6ZmI6YC454Kc?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" Hi Cygwin developers, I'm writing to report a fatal crash that occurs on Windows 11 x64 with a self-compiled program, but does NOT occur on Windows 10 x64 or Windows 11 ARM. ## Symptom A self-compiled program terminates immediately at startup with:   *** fatal error - MapViewOfFileEx 'cygpid.XXXXXX'(0x46C, size 64896,   m 6, created 0), Win32 error 487. Terminating.   Hangup Win32 error 487 is ERROR_INVALID_ADDRESS, meaning the target virtual address is already occupied at the time of mapping. ## Root Cause Analysis After reading the Cygwin source code, I traced the crash to winsup/cygwin/shared.cc, inside open_shared():   static NO_COPY uintptr_t next_address = SHARED_REGIONS_ADDRESS_LOW;   do {     addr   = (void *) next_address;     shared = MapViewOfFileEx(shared_h, access, 0, 0, 0, addr);     next_address += wincap.allocation_granularity();     if (next_address >= SHARED_REGIONS_ADDRESS_HIGH) {       if (!shared && loop) break;  // exhausted entire range -> api_fatal       next_address = SHARED_REGIONS_ADDRESS_LOW;       loop = true;     }   } while (!shared); The address range is defined in winsup/cygwin/memory_layout.h:   #define SHARED_REGIONS_ADDRESS_LOW   0x1a0000000UL   #define SHARED_REGIONS_ADDRESS_HIGH  0x200000000UL On my Windows 11 x64 system, every MapViewOfFileEx() call in the loop fails with ERROR_INVALID_ADDRESS (487) for this particular program, exhausting the entire range and triggering the api_fatal(). I used VirtualQuery() to scan the address space and confirmed that the 0x1a0000000-0x200000000 range is occupied when this program runs. The exact cause of the occupation is not yet identified, but it is reproducibly absent on Windows 10 x64 and Windows 11 ARM. ## Workaround (user-side) I confirmed a fix by patching the two constants in cygwin1.dll to:   SHARED_REGIONS_ADDRESS_LOW  = 0x140000000   SHARED_REGIONS_ADDRESS_HIGH = 0x1a0000000 The new range was verified free via VirtualQuery(), and the program runs normally after the patch. ## Suggested Fix It may be worth investigating why the 0x1a0000000-0x200000000 range becomes unavailable on Windows 11 x64 in certain scenarios, and considering whether the range defined in memory_layout.h should be adjusted or made more resilient (e.g., falling back to a different range instead of calling api_fatal). ## Environment - Affected:     Windows 11 x64 (tested on 25H2) - Not affected: Windows 10 x64, Windows 11 ARM - Cygwin:      3.6.7 I hope this analysis is useful. Happy to provide additional information or run further diagnostics if needed. Best regards -- 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