Cygwin: dll_list: query dll file id at load time

NtQueryVirtualMemory for MemorySectionName does not reliable return the
changed dll file name when another process does move the file around,
and we may end up creating forkable hardlinks to wrong dll files.
So query the file id when loading the dll rather than before fork.
This commit is contained in:
Michael Haubenwallner 2019-04-30 16:15:30 +02:00 committed by Corinna Vinschen
parent 0f5776c47c
commit e33db96a14
2 changed files with 2 additions and 4 deletions

View File

@ -380,6 +380,8 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
d->forkable_ntname = d->ntname + ntnamelen + 1;
*d->forkable_ntname = L'\0';
}
if (forkables_supported ())
d->stat_real_file_once (); /* uses nt_max_path_buf () */
append (d);
if (type == DLL_LOAD)
loaded_dlls++;

View File

@ -605,10 +605,6 @@ dll_list::forkable_ntnamesize (dll_type type, PCWCHAR fullntname, PCWCHAR modnam
void
dll_list::prepare_forkables_nomination ()
{
dll *d = &dlls.start;
while ((d = d->next))
d->stat_real_file_once (); /* uses nt_max_path_buf () */
PWCHAR pbuf = nt_max_path_buf ();
bool needsep = false;