* pinfo.cc (pinfo::init): Detect potential race where short block has been
retrieved but PID_EXECED flag is not set.
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2012-09-17  Christopher Faylor  <me.cygwin2012@cgf.cx> | ||||||
|  |  | ||||||
|  | 	* pinfo.cc (pinfo::init): Detect potential race where short block has | ||||||
|  | 	been retrieved but PID_EXECED flag is not set. | ||||||
|  |  | ||||||
| 2012-09-13  Christopher Faylor  <me.cygwin2012@cgf.cx> | 2012-09-13  Christopher Faylor  <me.cygwin2012@cgf.cx> | ||||||
|  |  | ||||||
| 	* cygthread.cc (cygthread::stub): Remove old, unnecessary, FIXMEd code. | 	* cygthread.cc (cygthread::stub): Remove old, unnecessary, FIXMEd code. | ||||||
|   | |||||||
| @@ -299,6 +299,15 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0) | |||||||
|  |  | ||||||
|       bool created = shloc != SH_JUSTOPEN; |       bool created = shloc != SH_JUSTOPEN; | ||||||
|  |  | ||||||
|  |       /* Detect situation where a transitional memory block is being retrieved. | ||||||
|  | 	 If the block has been allocated with PINFO_REDIR_SIZE but not yet | ||||||
|  | 	 updated with a PID_EXECED state then we'll retry.  */ | ||||||
|  |       MEMORY_BASIC_INFORMATION mbi; | ||||||
|  |       if (!created && procinfo->exists () | ||||||
|  | 	  && VirtualQuery (procinfo, &mbi, sizeof (mbi)) | ||||||
|  | 	  && mbi.RegionSize < sizeof (_pinfo)) | ||||||
|  | 	goto loop; | ||||||
|  |  | ||||||
|       if (!created && createit && (procinfo->process_state & PID_REAPED)) |       if (!created && createit && (procinfo->process_state & PID_REAPED)) | ||||||
| 	{ | 	{ | ||||||
| 	  memset (procinfo, 0, sizeof (*procinfo)); | 	  memset (procinfo, 0, sizeof (*procinfo)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user