Review request (S): 6539281 -Xcheck:jni should validate char* argument to ReleaseStringUTFChars

Tom Rodriguez tom.rodriguez at oracle.com
Thu Dec 2 13:13:25 PST 2010


On Dec 2, 2010, at 11:14 AM, Staffan Larsen wrote:

> Yes, you are right. I can't figure out a way to avoid this, unless I copy all of the code from the normal methods into jniCheck.cpp and never call the unchecked versions.

It's probably not a big deal since it only affects -Xcheck:jni.

tom

> 
> Will do the isCopy == true check.
> 
> /Staffan
> 
> On 2 dec 2010, at 20.03, Tom Rodriguez wrote:
> 
>> 
>> On Dec 2, 2010, at 6:18 AM, Staffan Larsen wrote:
>> 
>>> http://cr.openjdk.java.net/~sla/6539281/webrev.00/
>>> 
>>> Validate that ReleaseStringUTFChars/ReleaseStringChars is called with something allocated by GetStringUTChars/GetStringChars when running with -Xcheck:jni. This is accomplished by adding a well-known tag in the memory immediately before the pointer that is returned to the user. This tag is verified in ReleaseStringUTFChars.
>> 
>> Won't this cause the dtrace arguments not to match up anymore?  The return probe for GetStringChars will report the original allocation but the ReleaseStringChars will be passed the new allocation so they won't agree.  It's a minor issue but it does seem odd.
>> 
>> You might consider asserting that isCopy == true.
>> 
>> tom
>> 
>>> 
>>> Thanks,
>>> /Staffan
>> 
> 



More information about the hotspot-runtime-dev mailing list