RFR: 8285518: CDS assert: visibility cannot change between dump time and runtime
Ioi Lam
iklam at openjdk.java.net
Tue May 10 04:30:20 UTC 2022
This PR fixes a timing hole in the CDS class loading code. The bug happens with the `jdk/internal/ref/Cleaner` class, which is loaded by the boot classloader.
- The loading of `Cleaner` is initiated
- We look up the `pkg_entry` for this class
- At this point, the module system is not yet fully initialized, so package information is not yet available, and we get `pkg_entry == NULL`
- Later, in `SystemDictionary::is_shared_class_visible_impl`, we try to check the visbility of this class, but now the module system is fully initialized, so the NULL `pkg_entry` is no longer valid.
The fix is to always reload the `pkg_entry` if it's NULL. This should happen very rarely because `pkg_entry` for archived classes are usually non-null.
This timing hole existed before but has been triggered (once) only after Loom changed the bootstrap sequence of the reference thread. Nonetheless we should backport to older JDKs since there's still a theoretical chance this it may happen, and the fix is simple.
-------------
Commit messages:
- removed debug code
- 8285518: CDS assert: visibility cannot change between dump time and runtime
Changes: https://git.openjdk.java.net/jdk/pull/8392/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8392&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8285518
Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jdk/pull/8392.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8392/head:pull/8392
PR: https://git.openjdk.java.net/jdk/pull/8392
More information about the hotspot-runtime-dev
mailing list