RFR: 8352092: -XX:AOTMode=record crashes with InstanceKlass in allocated state [v2]

Ioi Lam iklam at openjdk.org
Thu Mar 27 14:32:53 UTC 2025


> Please review this small fix for a crash that can be caused only with JNI `DefineClass()` calls, which can leave a class in the `allocated` state inside a `ClassLoaderData` when the class is in a prohibited package such as `java/foo`.
> 
> The bug was found when running the JCK with an AOT cache. I tried to write a jtreg regression test but it's not possible to use pure Java code to reproduce this condition -- attempts by Java code to define classes in a prohibited package will be blocked from entering the ClassFileParser.

Ioi Lam has updated the pull request incrementally with two additional commits since the last revision:

 - Move CollectClassesForLinking inside while loop to see classes loaded as side effect of linking
 - @coleenp comments - use ClassLoaderDataGraph::loaded_classes_do_keepalive()

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/24172/files
  - new: https://git.openjdk.org/jdk/pull/24172/files/3bb77d59..ae23a56d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24172&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24172&range=00-01

  Stats: 50 lines in 1 file changed: 17 ins; 18 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/24172.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24172/head:pull/24172

PR: https://git.openjdk.org/jdk/pull/24172


More information about the hotspot-runtime-dev mailing list