Integrated: 8285518: CDS assert: visibility cannot change between dump time and runtime
Ioi Lam
iklam at openjdk.java.net
Tue May 10 18:22:42 UTC 2022
On Mon, 25 Apr 2022 23:48:14 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: 61c68abc
Author: Ioi Lam <iklam at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/61c68abc68a77e5d009d4665dc21e840db02f4ae
Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod
8285518: CDS assert: visibility cannot change between dump time and runtime
Reviewed-by: dholmes, ccheung
-------------
PR: https://git.openjdk.java.net/jdk/pull/8392
More information about the hotspot-runtime-dev
mailing list