fork error when trying to call VirtualAlloc with size==0

Brian Inglis Brian.Inglis@SystematicSW.ab.ca
Tue May 20 04:59:50 GMT 2025


On 2025-05-19 21:25, Yuyi Wang via Cygwin 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?

Could it be this known issue:

https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw

LoadLibraryExW with LOAD_LIBRARY_REQUIRE_SIGNED_TARGET requires DLL 
characteristic IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY (0x0080)

https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-image_optional_header64

https://stackoverflow.com/questions/62461457/loadlibraryexw-fails-to-load-user32-dll

https://learn.microsoft.com/en-us/answers/questions/1189539/loadlibraryexw-returns-error-invalid-image-hash-on

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


More information about the Cygwin mailing list