RFR: 8356324: JVM crash (SIGSEGV at ClassListParser::resolve_indy_impl) during -Xshare:dump starting from 21.0.5
Koichi Sakata
ksakata at openjdk.org
Thu Aug 14 07:43:44 UTC 2025
A crash occurs when running with `-Xshare:dump` and specifying a class list file generated by an older JDK (e.g. JDK 17) via `-XX:SharedClassListFile`.
This pull request fixes the issue and prevents the crash.
# Details
Example command to reproduce:
$ ./jdk-26/fastdebug/bin/java -Xshare:dump -XX:SharedClassListFile=classes.list -XX:SharedArchiveFile=noop.jsa HelloWorld
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000ffff8610355c, pid=53155, tid=53156
#
# JRE version: OpenJDK Runtime Environment (26.0) (fastdebug build 26-internal-adhoc.jyukutyo.jyukutyo-jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 26-internal-adhoc.jyukutyo.jyukutyo-jdk, interpreted mode, compressed oops, compressed class ptrs, g1 gc, linux-
aarch64)
# Problematic frame:
# V [libjvm.so+0x90355c] ClassListParser::resolve_indy_impl(Symbol*, JavaThread*)+0x2dc
[full crash log omitted for brevity]
The class list file that triggers the problem, generated by JDK 17, looks like this:
@lambda-proxy java/lang/System$LoggerFinder run ()Ljava/security/PrivilegedAction; ()Ljava/lang/Object; REF_invokeStatic java/lang/System$LoggerFinder lambda$accessProvider$0 ()Ljava/lang/System$LoggerFinder; ()Ljava/lang/System$LoggerFinder;
In contrast, the recent JDK generates class list contents as follows:
@cp jdk/internal/logger/LoggerFinderLoader 15 21 30 96 99 105 110 117 118 122 141
@cp jdk/internal/logger/DefaultLoggerFinder 1 2 7 8 14 22 29 30
@cp java/lang/System$LoggerFinder 1 2 10 27 31
When an old-style class list file is used, the `_resolved_indy_entries` variable remains null, which leads to a crash during `-Xshare:dump`.
This PR adds a null check to avoid the crash.
After applying this fix, running with the same options no longer results in a crash. Instead, a warning is shown as expected:
$ ./jdk-26_fixed/jdk-26/fastdebug/bin/java -Xshare:dump -XX:SharedClassListFile=classes.list -XX:SharedArchiveFile=noop.jsa HelloWorld
[0.094s][warning][cds] No invoke dynamic constant pool entry can be found for class java/lang/System$LoggerFinder. The classlist is probably out-of-date.
# Additional note
We may also want to apply the same fix to the `resolved_indy_entry_at` function in the `ConstantPoolCache` class. Please let me know if that is desirable.
For reference, the current implementation is:
inline ResolvedIndyEntry* ConstantPoolCache::resolved_indy_entry_at(int index) const {
return _resolved_indy_entries->adr_at(index);
}
-------------
Commit messages:
- Fix crash occurring during -Xshare:dump
Changes: https://git.openjdk.org/jdk/pull/26770/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26770&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8356324
Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/26770.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26770/head:pull/26770
PR: https://git.openjdk.org/jdk/pull/26770
More information about the hotspot-dev
mailing list