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

Zoltán Majó zoltan.majo at oracle.com
Wed Mar 8 09:57:04 UTC 2017


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



More information about the hotspot-compiler-dev mailing list