RFR: 8361725: Do not load Java agent with "-Xshare:dump -XX:+AOTClassLinking"
Ioi Lam
iklam at openjdk.org
Thu Jul 17 22:24:09 UTC 2025
When `-XX:+AOTClassLinking` is enabled when dumping CDS archives with `java -Xshare:dump`, we have more stringent restriction of what Java code can be executed -- if arbitrary Java code is executed, it may produce side effects that cannot be handled when archiving Java heap objects. This usually leads to cdsHeapVerifier.cpp reporting suspicious references to static fields that are not known to be safe.
We already avoid loading Java agents when dumping AOT caches (which are just enhanced CDS archives with more optimizations), we should do the same thing for `java -Xshare:dump -XX:+AOTClassLinking`.
After this PR, we still allow Java agents for `java -Xshare:dump -XX:-AOTClassLinking`, as that is required by some CDS tests. In a subsequent RFE, we will fix these CDS tests so Java agents are always disabled for `java -Xshare:dump`. See [JDK-8362561](https://bugs.openjdk.org/browse/JDK-8362561)
-------------
Commit messages:
- 8361725: Do not load Java agent with "-Xshare:dump -XX:+AOTClassLinking"
Changes: https://git.openjdk.org/jdk/pull/26374/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26374&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8361725
Stats: 65 lines in 5 files changed: 57 ins; 1 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/26374.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26374/head:pull/26374
PR: https://git.openjdk.org/jdk/pull/26374
More information about the hotspot-dev
mailing list