RFR: 8217309: ZGC: Fix ZNMethodTable corruption

Per Liden per.liden at oracle.com
Tue Jan 22 11:05:33 UTC 2019


On 1/22/19 11:34 AM, Stefan Karlsson wrote:
> Hi Per,
> 
> On 2019-01-22 10:36, Per Liden wrote:
>> Calls to CollectedHeap::register_nmethod()/unregister_nmethod() should 
>> be protected by the CodeCache_lock (when called outside of 
>> safepoints). However, nmethod::make_unloaded() calls 
>> CollectedHeap::unregister_nmethod() without this lock held, which can 
>> corrupt the ZNMethodTable. Adding the lock is straight forward. The 
>> rest of the patch adjusts ZNMethodTable::unregister_nmethod() to never 
>> return false (which should never happen), adds the the proper asserts, 
>> etc.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8217309
>> Webrev: http://cr.openjdk.java.net/~pliden/8217309/webrev.0
> 
> Looks good.

Thanks for reviewing Stefan.

> 
> One thought about related code:
>     while (_iter_table != NULL) {
>       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
>       os::naked_short_sleep(1);
>     }
> 
> We might want to consider changing this into using wait/notify instead 
> of unlocker/sleep.

Sounds like a good future enhancement.

/Per

> 
> Thanks,
> StefanK
> 
>>
>> Testing: Tier1-4 on all archs. Tier-1-7 on Linux/x86
>>
>> (I'll update the bug with the proper fix-request label, justification, 
>> etc)
>>
>> /Per


More information about the hotspot-gc-dev mailing list