RFR: JDK-8294902: Undefined Behavior in C2 regalloc with null references [v3]

Vladimir Ivanov vlivanov at openjdk.org
Fri Nov 4 00:04:30 UTC 2022


On Thu, 3 Nov 2022 16:23:45 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/share/oops/instanceKlass.cpp line 390:
>> 
>>> 388:   // Record dependency to keep nest host from being unloaded before this class.
>>> 389:   ClassLoaderData* this_key = class_loader_data();
>>> 390:   if (this_key != NULL) {
>> 
>> The code assumes `this_key != NULL`. Do we need an assert/guarantee here?
>
> I did see this one trigger, otherwise I wouldn't have known about it, but I can't reproduce it today. Whether it's an assert or a guarantee depends on how serious the problem would be.

Interesting! I do hit the assert during JDK build:

#  Internal Error (.../src/hotspot/share/oops/instanceKlass.cpp:390), pid=956, tid=6147
#  Error: assert(this_key != __null) failed

V   report_vm_error(char const*, int, char const*, char const*, ...)+0x88
V   InstanceKlass::set_nest_host(InstanceKlass*)+0x254
V   SystemDictionary::load_shared_lambda_proxy_class(InstanceKlass*, Handle, Handle, PackageEntry*, JavaThread*)+0x19c
V   SystemDictionaryShared::prepare_shared_lambda_proxy_class(InstanceKlass*, InstanceKlass*, JavaThread*)+0x13c
V   JVM_LookupLambdaProxyClassFromArchive+0x2cc
C  Java_java_lang_invoke_LambdaProxyClassArchive_findFromArchive+0x4c
j  java.lang.invoke.LambdaProxyClassArchive.findFromArchive(...) java.base at 20-internal
...


Looks like a pre-existing bug to me.

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

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


More information about the hotspot-dev mailing list