RFR 8067105: Socket returned by ServerSocket.accept() is inherited by child process on Windows
Chris Hegarty
chris.hegarty at oracle.com
Wed Jan 28 21:40:58 UTC 2015
On 28 Jan 2015, at 21:24, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 28/01/2015 20:01, Chris Hegarty wrote:
>> Reviving an old code review [1], after further investigation…
>>
>> Pertinent details from previous review:
>> "A socket connection which is returned by ServerSocket.accept() is
>> inherited by a child process. The expected behavior is that the socket
>> connection is not inherited by the child process. This is an oversight
>> in the original implementation, that only sets HANDLE_FLAG_INHERIT for
>> newly created sockets.
>>
>> The native socket returned by ServerSocket.accept() should be configured
>> so it will not be inherited by a child process,
>> SetHandleInformation(<HANDLE>, HANDLE_FLAG_INHERIT, FALSE)."
>> http://cr.openjdk.java.net/~chegar/8067105/webrev.00/webrev/ <http://cr.openjdk.java.net/%7Echegar/8067105/webrev.00/webrev/>
>>
> I think you'll need to check for AcceptEx usages too but this is otherwise okay.
Good catch, there is one usage of AcceptEx in WindowsAsynchronousServerSocketChannelImpl.c <http://ipw83120.uk.oracle.com:8080/source/xref/jdk9-dev/jdk/src/java.base/windows/native/libnio/ch/WindowsAsynchronousServerSocketChannelImpl.c>.
I’ll make the change, add a test, and then update the webrev.
Thanks,
-Chris.
> -Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20150128/8dda4356/attachment.html>
More information about the net-dev
mailing list