Segfault if /proc/PID/maps is opened in parallel threads [CAUSE: RtlQueryProcessDebugInformation]

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 7 08:28:14 GMT 2025


On Jul  5 19:34, Christian Franke via Cygwin wrote:
> Corinna Vinschen via Cygwin wrote:
> > I just added two patches, one of them dropping RtlQueryProcessDebugInformation
> > in favor of EnumProcessModules in dlsym(), the other by adding a global
> > mutex to format_process_maps while accessing the debug buffer.  I could
> > reproduce the crash even if RtlQueryProcessDebugInformation was serialized.
> > I could only avoid the crash by serializing the entire code from
> > RtlCreateQueryDebugBuffer up to and including RtlDestroyQueryDebugBuffer.
> > 
> > This ignores native processes which have a hard time to access
> > /proc anyway.
> 
> Many tests show that the problem with /proc/PID/maps does no longer occur,
> thanks.

Great, thanks for testing.

> dlsym() not tested, sorry.

It's basically a revert of an older patch anyway, since originally
dlsym() used EnumProcessModules().  I checked that it could still
resolve a symbol from cygwin1.dll when using dlsym(RTLD_DEFAULT, ...).


Thanks,
Corinna


More information about the Cygwin mailing list