RFR: [8036088] - Thread-unsafe strtok() is used to parse the list of overrides
Hello! The strtok() function is used in ./windows/native/sun/net/spi/DefaultProxySelector.c. This function is not thread safe, so it may potentially cause a problem. The failure in this particular place would be very unlikely, because this code should be executed only once during initialization. Therefore, no regtest provided. The fix would be to use a thread-safe equivalent, which is strtok_s() under Windows. Would you please help review this simple fix? BUGURL: https://bugs.openjdk.java.net/browse/JDK-8036088 WEBREV: http://cr.openjdk.java.net/~igerasim/8036088/0/webrev/ Sincerely yours, Ivan
Re: RFR [9] 8035897 : FD_SETSIZE should be set on macosx
Alan, I pushed this changes before receiving your comments. If you agree, I'll push the following changes under a new bug number. http://cr.openjdk.java.net/~chegar/8035897/webrev.comments/webrev/ The error handling seems a little overly complicated in PlainDatagramSocketImpl, but I don't proposed to change that in this issue. -Chris. On 02/03/14 19:44, Alan Bateman wrote: On 28/02/2014 14:40, Chris Hegarty wrote: : I think option 2 is preferable: http://cr.openjdk.java.net/~chegar/8035897/webrev.00/webrev/ I'm still checking to see it an automatic regression test is possible, but I wanted to circulate the changes for comment first. This mostly looks okay to me although it's a bit inconsistent for NET_Timeout to have a JNIEnv parameter. It might be better to have it set errno to ENOMEM or some error and handle it in the call instead. Also just on the exception message, I assume it should be "select" rather than NET_Select as NET_Select has been removed. As per the other comments then it would be good to re-visit the issue as to why select is used here as it would be good to replace it with poll if the issue with 0-length UDP packets has been fixed. -Alan.
Re: RFR [9] 8035897 : FD_SETSIZE should be set on macosx
On 03/03/2014 16:45, Chris Hegarty wrote: Alan, I pushed this changes before receiving your comments. If you agree, I'll push the following changes under a new bug number. http://cr.openjdk.java.net/~chegar/8035897/webrev.comments/webrev/ The error handling seems a little overly complicated in PlainDatagramSocketImpl, but I don't proposed to change that in this issue. -Chris. Thanks for taking the comment on board, this looks good. -Alan
Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list of overrides
On Mar 3, 8:32pm, ivan.gerasi...@oracle.com (Ivan Gerasimov) wrote: -- Subject: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list | Hello! | | The strtok() function is used in | ./windows/native/sun/net/spi/DefaultProxySelector.c. | This function is not thread safe, so it may potentially cause a problem. | | The failure in this particular place would be very unlikely, because | this code should be executed only once during initialization. | Therefore, no regtest provided. | | The fix would be to use a thread-safe equivalent, which is strtok_s() | under Windows. | | Would you please help review this simple fix? | | BUGURL: https://bugs.openjdk.java.net/browse/JDK-8036088 | WEBREV: http://cr.openjdk.java.net/~igerasim/8036088/0/webrev/ Doesn't windows have strtok_r() IEEE Std 1003.1c-1995 (``POSIX.1''). christos
Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list of overrides
Hi Christos! On 03.03.2014 20:52, chris...@zoulas.com wrote: On Mar 3, 8:32pm, ivan.gerasi...@oracle.com (Ivan Gerasimov) wrote: -- Subject: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list | Hello! | | The strtok() function is used in | ./windows/native/sun/net/spi/DefaultProxySelector.c. | This function is not thread safe, so it may potentially cause a problem. | | The failure in this particular place would be very unlikely, because | this code should be executed only once during initialization. | Therefore, no regtest provided. | | The fix would be to use a thread-safe equivalent, which is strtok_s() | under Windows. | | Would you please help review this simple fix? | | BUGURL: https://bugs.openjdk.java.net/browse/JDK-8036088 | WEBREV: http://cr.openjdk.java.net/~igerasim/8036088/0/webrev/ Doesn't windows have strtok_r() IEEE Std 1003.1c-1995 (``POSIX.1''). MSDN does not refer to strtok_r(). Grepping the JDK code shows that strtok_s() is used in the windows-specific code. Sincerely yours, Ivan christos
Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse
strtok is thread-safe in MS C/C++. It uses thread-local store to hold its state. strtok_s can be called recursively to parse different strings, though it's named like the MS extensions that check for buffer overruns. http://msdn.microsoft.com/en-us/library/2c8d19sb(v=vs.100).aspx -- Message: 5 Date: Mon, 03 Mar 2014 21:01:15 +0400 From: Ivan Gerasimov Subject: Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list of overrides To: Christos Zoulas , OpenJDK Network Dev list Message-ID: <5314b55b.9070...@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Hi Christos! On 03.03.2014 20:52, chris...@zoulas.com wrote: > On Mar 3, 8:32pm, ivan.gerasi...@oracle.com (Ivan Gerasimov) wrote: > -- Subject: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list > > | Hello! > | > | The strtok() function is used in > | ./windows/native/sun/net/spi/DefaultProxySelector.c. > | This function is not thread safe, so it may potentially cause a problem. > | > | The failure in this particular place would be very unlikely, because > | this code should be executed only once during initialization. > | Therefore, no regtest provided. > | > | The fix would be to use a thread-safe equivalent, which is strtok_s() > | under Windows. > | > | Would you please help review this simple fix? > | > | BUGURL: https://bugs.openjdk.java.net/browse/JDK-8036088 > | WEBREV: http://cr.openjdk.java.net/~igerasim/8036088/0/webrev/ > > Doesn't windows have strtok_r() IEEE Std 1003.1c-1995 (``POSIX.1''). MSDN does not refer to strtok_r(). Grepping the JDK code shows that strtok_s() is used in the windows-specific code. Sincerely yours, Ivan > christos > > End of net-dev Digest, Vol 81, Issue 3 **
Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse
Yes, you're right. strtok() is thread-safe in Windows unlike its Unix counterpart. Thus using strtok_s() only adds some boundary checking in this case. Sincerely yours, Ivan On 04.03.2014 0:26, Salter, Thomas A wrote: strtok is thread-safe in MS C/C++. It uses thread-local store to hold its state. strtok_s can be called recursively to parse different strings, though it's named like the MS extensions that check for buffer overruns. http://msdn.microsoft.com/en-us/library/2c8d19sb(v=vs.100).aspx -- Message: 5 Date: Mon, 03 Mar 2014 21:01:15 +0400 From: Ivan Gerasimov Subject: Re: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list of overrides To: Christos Zoulas ,OpenJDK Network Dev list Message-ID: <5314b55b.9070...@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Hi Christos! On 03.03.2014 20:52, chris...@zoulas.com wrote: On Mar 3, 8:32pm, ivan.gerasi...@oracle.com (Ivan Gerasimov) wrote: -- Subject: RFR: [8036088] - Thread-unsafe strtok() is used to parse the list | Hello! | | The strtok() function is used in | ./windows/native/sun/net/spi/DefaultProxySelector.c. | This function is not thread safe, so it may potentially cause a problem. | | The failure in this particular place would be very unlikely, because | this code should be executed only once during initialization. | Therefore, no regtest provided. | | The fix would be to use a thread-safe equivalent, which is strtok_s() | under Windows. | | Would you please help review this simple fix? | | BUGURL: https://bugs.openjdk.java.net/browse/JDK-8036088 | WEBREV: http://cr.openjdk.java.net/~igerasim/8036088/0/webrev/ Doesn't windows have strtok_r() IEEE Std 1003.1c-1995 (``POSIX.1''). MSDN does not refer to strtok_r(). Grepping the JDK code shows that strtok_s() is used in the windows-specific code. Sincerely yours, Ivan christos End of net-dev Digest, Vol 81, Issue 3 **