RFR: JDK-8298908: Instrument Metaspace for ASan [v12]
Ioi Lam
iklam at openjdk.org
Fri Jan 13 05:53:15 UTC 2023
On Thu, 12 Jan 2023 07:40:05 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/memory/metaspace/chunkManager.cpp line 308:
>>
>>> 306: }
>>> 307:
>>> 308: if (enlarged) {
>>
>> What's the reason of calling the ASAN functions outside of the lock?
>>
>> Will we have a race condition if two threads call ChunkManager::attempt_enlarge_chunk() at the same time and get to here out of order? @tstuefe
>
> To be enlarged chunk belongs to the class loader already, and we are inside the class loader metaspace lock.
If there's no particular reason to do it outside of the lock, I would prefer to have the ASAN call while holding the lock. That way you don't need to worry about race conditions.
MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag);
old_level = c->level();
enlarged = c->vsnode()->attempt_enlarge_chunk(c, &_chunks);
ASAN_UNPOISON_MEMORY_REGION(....);
-------------
PR: https://git.openjdk.org/jdk/pull/11702
More information about the hotspot-runtime-dev
mailing list