[PATCH] winsup/cygwin: Protect fork() against dll- and exe-updates.

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Aug 7 16:58:00 GMT 2015

On Aug  7 12:37, cyg Simple wrote:
> On 8/7/2015 12:18 PM, Corinna Vinschen wrote:
> > On Aug  7 11:01, cyg Simple wrote:
> >> On 8/3/2015 4:21 PM, Corinna Vinschen wrote:
> >>>
> >>> The HMODULE is only the address of the section so, no, there's no way to
> >>> do an NtCreateFile with this information alone.  As for the file id, I
> >>> never tried NtOpenFile w/ FILE_OPEN_BY_FILE_ID.  The usage description
> >>> in the WDK docs is a bit vague, but it does work.  You just have to have
> >>> the file id from some earlier call to NtQueryInformationFile.
> >>>
> >>
> >>
> >> I seem to remember that the file id isn't guaranteed to be constant on
> >> Windows FS, especially FAT, unless you keep the file open.
> > 
> > FAT doesn't support opening files by file ID.  On NTFS, file IDs are
> > constant and unique per file as long as it exists.  Se the remarks
> > secion in
> > 
> > https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788%28v=vs.85%29.aspx
> > 
> Okay good.  The first paragraph was what I was remembering.
> But ReplaceFile could use the same ID on the replacement file; that
> could cause issues if you expect the name to be the same.

Not here, afaics.  As long as the DLL is in use (and it certainly is in
this scenario) it keeps its file ID, even if it got moved to the trash.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20150807/5ecf007e/attachment.sig>

More information about the Cygwin-developers mailing list