Quantcast

[9] RFR (S): 8175340: Possible invalid memory accesses due to ciMethodData::bci_to_data() returning NULL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[9] RFR (S): 8175340: Possible invalid memory accesses due to ciMethodData::bci_to_data() returning NULL

Zoltán Majó
Hi,


please review the fix for 8175340.

https://bugs.openjdk.java.net/browse/JDK-8175340
http://cr.openjdk.java.net/~zmajo/8175340/webrev.01/

The method ciMethodData::bci_to_data() can return NULL instead of a
valid ciProfileData*. Some users of the ciProfileData returned by
bci_to_data() do not check if the returned value is NULL, which can
result in an invalid memory accesses.

The issue has never happened in practice. While working on the issue,
however, I experimented with a VM version that had asserts in
Parse::branch_prediction and to Parse::dynamic_branch_prediction
checking that bci_to_data() is not NULL. I was able to trigger some of
the asserts I added by running the VM with -XX:-ProfileInterpreter
-XX:-TieredCompilation. (The asserts are not part of the patch sent out
for review.)

The fix I propose is simple: Check if bci_to_data() is NULL, if yes, do
not use profiling information / generate profiling code.

The fix passes JPRT and RBT testing.

Thank you!

Best regards,


Zoltan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [9] RFR (S): 8175340: Possible invalid memory accesses due to ciMethodData::bci_to_data() returning NULL

Vladimir Kozlov
Looks good.

thanks,
Vladimir

On 3/8/17 1:57 AM, Zoltán Majó wrote:

> Hi,
>
>
> please review the fix for 8175340.
>
> https://bugs.openjdk.java.net/browse/JDK-8175340
> http://cr.openjdk.java.net/~zmajo/8175340/webrev.01/
>
> The method ciMethodData::bci_to_data() can return NULL instead of a valid ciProfileData*. Some users of the ciProfileData returned by bci_to_data() do not check if the returned value is NULL, which
> can result in an invalid memory accesses.
>
> The issue has never happened in practice. While working on the issue, however, I experimented with a VM version that had asserts in Parse::branch_prediction and to Parse::dynamic_branch_prediction
> checking that bci_to_data() is not NULL. I was able to trigger some of the asserts I added by running the VM with -XX:-ProfileInterpreter -XX:-TieredCompilation. (The asserts are not part of the patch
> sent out for review.)
>
> The fix I propose is simple: Check if bci_to_data() is NULL, if yes, do not use profiling information / generate profiling code.
>
> The fix passes JPRT and RBT testing.
>
> Thank you!
>
> Best regards,
>
>
> Zoltan
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [9] RFR (S): 8175340: Possible invalid memory accesses due to ciMethodData::bci_to_data() returning NULL

Zoltán Majó
Thank you for the review, Vladimir!

Best regards,


Zoltan

On 03/09/2017 02:37 AM, Vladimir Kozlov wrote:

> Looks good.
>
> thanks,
> Vladimir
>
> On 3/8/17 1:57 AM, Zoltán Majó wrote:
>> Hi,
>>
>>
>> please review the fix for 8175340.
>>
>> https://bugs.openjdk.java.net/browse/JDK-8175340
>> http://cr.openjdk.java.net/~zmajo/8175340/webrev.01/
>>
>> The method ciMethodData::bci_to_data() can return NULL instead of a
>> valid ciProfileData*. Some users of the ciProfileData returned by
>> bci_to_data() do not check if the returned value is NULL, which
>> can result in an invalid memory accesses.
>>
>> The issue has never happened in practice. While working on the issue,
>> however, I experimented with a VM version that had asserts in
>> Parse::branch_prediction and to Parse::dynamic_branch_prediction
>> checking that bci_to_data() is not NULL. I was able to trigger some
>> of the asserts I added by running the VM with -XX:-ProfileInterpreter
>> -XX:-TieredCompilation. (The asserts are not part of the patch
>> sent out for review.)
>>
>> The fix I propose is simple: Check if bci_to_data() is NULL, if yes,
>> do not use profiling information / generate profiling code.
>>
>> The fix passes JPRT and RBT testing.
>>
>> Thank you!
>>
>> Best regards,
>>
>>
>> Zoltan
>>

Loading...