On Tue, 20 May 2025, Yuyi Wang wrote:

> Thank you for your reply. The DLL is a "proc macro" DLL for rustc, which means
> that it's not designed to be changed after created. However, I've also found
> that this stage-1 compiler doesn't always trigger this failure: it just 
> trigger
> fork failure with compiling relatively large projects. In this case, it fails
> to compile rustc, which depends on 17 proc-macro DLLs. Previously it also 
> failed
> to compile another tool in rust repo, but sorry I forget which one it was.
>
> An interesting phenomenon is that the stage-0 rustc is also a cygwin 
> executable,
> compiled 10 days before, and it doesn't trigger this failure. I haven't found
> out that if this failure is caused by some misc changes in rustc...
>
> I also tried again with Windows Defender disabled, but it still triggers the
> failure with exact the same message.
>
> Back to the code, I really think the most possible case is b) mb.BaseAddress 
> !=
> `here`. However, it means that we overestimated `size`, so `end` is less than
> `dll_end`, and the dll is smaller than it used to be...? Is it possible that 
> LoadLibraryExW() allocates smaller region than the image size?
>

After not being able to reproduce this with May 20 nightly, I was able to
reproduce it with May 21 nightly.  I added a long sleep after printing out
the error, so I could capture the address space.
      0 [main] rustc 1064 child_info_fork::abort: couldn't allocate memory 
0x20D8B0000(0) for
'\??\V:\rust\rustc-nightly-src\build-MSYS\x86_64-pc-cygwin\stage0-rustc\release\deps\tracing_attributes-0e8ab81319ad49f1.dll'
alignment, Win32 error 87
      0 [main] rustc 1064 child_info_fork::abort: couldn't allocate memory 
0x20D8B0000(0) for
'\??\V:\rust\rustc-nightly-src\build-MSYS\x86_64-pc-cygwin\stage0-rustc\release\deps\tracing_attributes-0e8ab81319ad49f1.dll'
alignment, Win32 error 87


interesting bits of parent /proc/<pid>/maps:
01DF0000-01DF1000 r--p 00000000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
01DF1000-0206A000 r-xp 00001000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
0206A000-0206B000 rw-p 0027A000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
0206B000-02120000 r--p 0027B000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
02120000-02121000 rw-p 00330000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
02121000-02133000 r--p 00331000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
02140000-02141000 r--p 00000000 6696:906D 3659174697957043    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
02141000-023CB000 r-xp 00001000 6696:906D 3659174697957043    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
023CB000-023CC000 rw-p 0028B000 6696:906D 3659174697957043    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
023CC000-0247B000 r--p 0028C000 6696:906D 3659174697957043    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
0247B000-0247C000 rw-p 0033B000 6696:906D 3659174697957043    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
0247C000-0248E000 r--p 0033C000 6696:906D 3659174697957043    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
7FFE0000-7FFE1000 r--p 00000000 0000:0000 0                   [shared-user-data]
7FFE2000-7FFE3000 r--p 00000000 0000:0000 0
100400000-100401000 r--p 00000000 E8D3:4D05 6917529123692588591   
/usr/bin/rustc.exe
100401000-100402000 r-xp 00001000 E8D3:4D05 6917529123692588591   
/usr/bin/rustc.exe
100402000-100403000 rw-p 00002000 E8D3:4D05 6917529123692588591   
/usr/bin/rustc.exe
100403000-100407000 r--p 00003000 E8D3:4D05 6917529123692588591   
/usr/bin/rustc.exe
100407000-100408000 rw-p 00007000 E8D3:4D05 6917529123692588591   
/usr/bin/rustc.exe
100408000-100419000 r--p 00008000 E8D3:4D05 6917529123692588591   
/usr/bin/rustc.exe
4E2A30000-4E2A31000 r--p 00000000 E8D3:4D05 6917529122652401199   
/usr/bin/msys-LLVM-20.dll
4E2A31000-4E597E000 r-xp 00001000 E8D3:4D05 6917529122652401199   
/usr/bin/msys-LLVM-20.dll
4E597E000-4E59BF000 rw-p 02F4E000 E8D3:4D05 6917529122652401199   
/usr/bin/msys-LLVM-20.dll
4E59BF000-4E706E000 r--p 02F8F000 E8D3:4D05 6917529122652401199   
/usr/bin/msys-LLVM-20.dll
4E706E000-4E70EC000 rw-p 0463E000 E8D3:4D05 6917529122652401199   
/usr/bin/msys-LLVM-20.dll
4E70EC000-4E7561000 r--p 046BC000 E8D3:4D05 6917529122652401199   
/usr/bin/msys-LLVM-20.dll
4ED0B0000-4ED0B1000 r--p 00000000 6696:906D 3659174697957303   
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/serde_derive-64b7c1037e33fbd1.dll

Interesting bit of child /proc/<PID>/maps:
00010000-00020000 rw-s 00000000 0000:0000 0
00020000-00023000 r--s 00000000 1047:0A2B 281474976764265     
/c/Windows/System32/l_intl.nls
00030000-0004F000 r--s 00000000 0000:0000 0
00050000-00054000 r--s 00000000 0000:0000 0
00060000-00061000 r--s 00000000 0000:0000 0
00070000-00072000 rw-p 00000000 0000:0000 0
00080000-00091000 r--s 00000000 1047:0A2B 281474976762863     
/c/Windows/System32/C_1252.NLS
000A0000-000B1000 r--s 00000000 1047:0A2B 281474976762943     
/c/Windows/System32/C_437.NLS
000C0000-000C3000 r--s 00000000 1047:0A2B 281474976764265     
/c/Windows/System32/l_intl.nls
000D0000-0019E000 r--s 00000000 1047:0A2B 562949953608383     
/c/Windows/System32/locale.nls
001A0000-001B1000 r--s 00000000 1047:0A2B 281474976762863     
/c/Windows/System32/C_1252.NLS
001C0000-001D1000 r--s 00000000 1047:0A2B 281474976762943     
/c/Windows/System32/C_437.NLS
001E0000-001E4000 r--s 00000000 0000:0000 0
001F0000-001F4000 r--s 00000000 0000:0000 0
00200000-00392000 ===p 00000000 0000:0000 0
00392000-00393000 rw-p 00192000 0000:0000 0                   [peb]
00393000-00395000 rw-p 00193000 0000:0000 0                   [teb (tid 20876)]
00395000-00397000 rw-p 00195000 0000:0000 0                   [teb (tid 53096)]
00397000-00399000 rw-p 00197000 0000:0000 0                   [teb (tid 33352)]
00399000-0039B000 rw-p 00199000 0000:0000 0                   [teb (tid 29440)]
0039B000-0039D000 rw-p 0019B000 0000:0000 0                   [teb (tid 33036)]
0039D000-00400000 ===p 0019D000 0000:0000 0
00400000-005F6000 ===p 00000000 0000:0000 0
005F6000-005F9000 rw-g 001F6000 0000:0000 0
005F9000-00600000 rw-p 001F9000 0000:0000 0
00600000-00601000 r--s 00000000 0000:0000 0
00690000-006C4000 rw-p 00000000 0000:0000 0                   [win heap 0 
default grow]
006C4000-00790000 ===p 00034000 0000:0000 0                   [win heap 0 
default grow]
00790000-0098B000 ===p 00000000 0000:0000 0                   [stack (tid 
53096)]
0098B000-0098E000 rw-g 001FB000 0000:0000 0                   [stack (tid 
53096)]
0098E000-00990000 rw-p 001FE000 0000:0000 0                   [stack (tid 
53096)]
00990000-00B8B000 ===p 00000000 0000:0000 0                   [stack (tid 
33352)]
00B8B000-00B8E000 rw-g 001FB000 0000:0000 0                   [stack (tid 
33352)]
00B8E000-00B90000 rw-p 001FE000 0000:0000 0                   [stack (tid 
33352)]
00B90000-00D8B000 ===p 00000000 0000:0000 0                   [stack (tid 
29440)]
00D8B000-00D8E000 rw-g 001FB000 0000:0000 0                   [stack (tid 
29440)]
00D8E000-00D90000 rw-p 001FE000 0000:0000 0                   [stack (tid 
29440)]
00D90000-00D92000 rw-p 00000000 0000:0000 0                   [win heap 0 
default grow]
00D92000-00E53000 ===p 00002000 0000:0000 0                   [win heap 0 
default grow]
00E60000-00E62000 rw-p 00000000 0000:0000 0
00E62000-00F23000 ===p 00002000 0000:0000 0
00FB0000-00FB6000 rw-p 00000000 0000:0000 0
00FB6000-00FC0000 ===p 00006000 0000:0000 0
00FC0000-011B8000 ===p 00000000 0000:0000 0                   [stack (tid 
33036)]
011B8000-011BB000 rw-g 001F8000 0000:0000 0                   [stack (tid 
33036)]
011BB000-011C0000 rw-p 001FB000 0000:0000 0                   [stack (tid 
33036)]
011C0000-01DF0000 ===p 00000000 0000:0000 0
01DF0000-01DF1000 r--p 00000000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
01DF1000-0206A000 r-xp 00001000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
0206A000-0206B000 rw-p 0027A000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
0206B000-02120000 r--p 0027B000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
02120000-02121000 rw-p 00330000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
02121000-02133000 r--p 00331000 6696:906D 3377699721246326    
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/derive_where-ec15e267ea8bb14f.dll
02140000-0248E000 ===p 00000000 0000:0000 0
02490000-7FFE0000 ===p 00000000 0000:0000 0
7FFE0000-7FFE1000 r--p 00000000 0000:0000 0                   [shared-user-data]
1A0030000-20D8B0000 ===p 00000000 0000:0000 0                 
[cygwin-shared-console]

Preferred base & size of tracing_attributes dll
$ rebase -i 
build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
/v/rust/rustc-nightly-src/build-MSYS/x86_64-pc-cygwin/stage0-rustc/release/deps/tracing_attributes-0e8ab81319ad49f1.dll
base 0x0004e5130000 size 0x0034e000

So it appears that hash-of-name-based auto image base was unluckily
overlapping the LLVM dll, resulting in the tracing dll being loaded at
other than its preferred base.  After that, I kind of expect that the
attempts to convince Windows to load the tracing dll to the same place in
the child to not be very fruitful, but maybe there's some debugging to be
done there (such as, why is there something showing up where the dll ought
to be, and why is it trying to reserve something right at the end of the
cygwin-shared-console)?

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

Reply via email to