RFR - 8133249: Occasional SIGSEGV: non thread-safe use of strerr in getLastErrorString

Christos Zoulas christos at zoulas.com
Thu Sep 24 15:10:08 UTC 2015


On Sep 24,  3:10pm, rob.mckenna at oracle.com (Rob McKenna) wrote:
-- Subject: Re: RFR - 8133249: Occasional SIGSEGV: non thread-safe use of str

| Hi folks,
| 
| Uploaded a newer version:
| 
| http://cr.openjdk.java.net/~robm/8133249/webrev.02/
| 
| To address Rogers question, this needed to be separate from 
| getLastErrorString because of the return type and the err arg, but I 
| like the idea of avoiding the creation of a new file. Also, all of the 
| files that require the new function (now called getErrorString) already 
| include jni_util.c so it makes sense to put this in jni_util_md.c with 
| getLastErrorString.
| 
| As per Christos' suggestion I've mapped strerr_r to __xpg_strerror_r 
| instead of using the gnu strerror_r. I'd be interested to hear feedback 
| on this change.
| 
| I've corrected the oversights around the jli sources and 
| PlainDatagramSocket. The jli stuff shouldn't have been there in the 
| first place.
| 
| Ivan, I've kept the return type. As you note, I should have been using 
| it in ProcessImpl_md.c and the extra information from the return is 
| potentially useful.

LGTM.
In src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c
shouldn't the sprintf() get changed to jio_snprintf() or at least
snprintf()/_snprintf()? It would be nice if someone went and killed all the
sprintfs()...

christos



More information about the core-libs-dev mailing list