Fwd: Windows shmem fix: makes shared memory fully ASLR and DEP compliant (ea. cache zone, limit zone, etc.)

Sergey Brester serg.brester at sebres.de
Tue Jun 9 14:37:56 UTC 2015


09.06.2015 15:43, Sergey Brester:

> 09.06.2015 14:44, Maxim Dounin:
> 
>> I don't see how CreateProcess() bInheritHandles affects handles 
>> created by worker processes. It is documented to only control whether 
>> inheritable handles will be inherited by a new process or not. Either 
>> way, worker processes are not expected to start other processes, so 
>> you probably shouldn't care at all.
> 
> The problem is, some handles are frequently default inheritable in 
> windows. And if any process in combination parent/children was exited 
> (ex. creashed) without closing this handle - it would be not closed, as 
> long as last process of this "group" is still alive (can potentially 
> inherit this leak handle).
> 
> Very bad thing is this "bInheritHandles", have very bad experience with 
> it.

Additionally, I have tested in the meantime the solution with 
createprocess/bInheritHandles=1.
Select in each child will fail with WSAEINVAL "select() failed (10022: 
An invalid argument was supplied)", despite the flag 
WSA_FLAG_NO_HANDLE_INHERIT in master was not specified by creating of 
listening socket.

Don't forget LSPs (Layered Service Providers) - although depricated but, 
when certain LSPs are installed, the inherited handles can't be used in 
the child.

But I try to dig deeper...



More information about the nginx-devel mailing list