RFR: 8333363: ubsan: instanceKlass.cpp: runtime error: member call on null pointer of type 'struct AnnotationArray'
Coleen Phillimore
coleenp at openjdk.org
Tue Jun 25 15:38:10 UTC 2024
On Tue, 25 Jun 2024 15:30:02 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> With ubsan enabled binaries we run on Linux aarch64 and Linux x86_64 into this issue :
>>
>> runtime/CommandLine/PrintClasses_id0.jtr
>>
>> src/hotspot/share/oops/instanceKlass.cpp:3603:84: runtime error: member call on null pointer of type 'struct AnnotationArray'
>> #0 0xfffface09b40 in InstanceKlass::print_on(outputStream*) const src/hotspot/share/oops/instanceKlass.cpp:3603
>> #1 0xffffacdcd088 in PrintClassClosure::do_klass(Klass*) src/hotspot/share/oops/instanceKlass.cpp:2228
>> #2 0xffffac464200 in ClassLoaderData::classes_do(KlassClosure*) src/hotspot/share/classfile/classLoaderData.cpp:387
>> #3 0xffffac475c4c in ClassLoaderDataGraph::classes_do(KlassClosure*) src/hotspot/share/classfile/classLoaderDataGraph.cpp:303
>> #4 0xffffac7bc4f4 in VM_PrintClasses::doit() src/hotspot/share/services/diagnosticCommand.cpp:989
>> #5 0xffffae599c88 in VM_Operation::evaluate() src/hotspot/share/runtime/vmOperations.cpp:75
>> #6 0xffffae5a5a14 in VMThread::evaluate_operation(VM_Operation*) src/hotspot/share/runtime/vmThread.cpp:283
>> #7 0xffffae5a779c in VMThread::inner_execute(VM_Operation*) src/hotspot/share/runtime/vmThread.cpp:427
>> #8 0xffffae5a7fd8 in VMThread::loop() src/hotspot/share/runtime/vmThread.cpp:493
>> #9 0xffffae5a80bc in VMThread::run() src/hotspot/share/runtime/vmThread.cpp:177
>> #10 0xffffae396958 in Thread::call_run() src/hotspot/share/runtime/thread.cpp:225
>> #11 0xffffadba1b0c in thread_native_entry src/hotspot/os/linux/os_linux.cpp:846
>> #12 0xffffb1a9d5c4 (/lib/aarch64-linux-gnu/libc.so.6+0x7d5c4)
>> #13 0xffffb1b05ed8 (/lib/aarch64-linux-gnu/libc.so.6+0xe5ed8)
>
> src/hotspot/share/oops/instanceKlass.cpp line 3607:
>
>> 3605: st->cr();
>> 3606: }
>> 3607: if (class_annotations() != nullptr) {
>
> I hate to say it but this whole function looks like it should be rewritten. There are other places that could be null, like local_interfaces, and transitive_interfaces. I wonder if you should have a macro above with a string BULLET string, and do them all like this.
it might also be that all the metadata print_on functions should use the same thing. There's
static void print_value_on_maybe_null(outputStream* st, const Metadata* m) {
if (nullptr == m)
st->print("null");
else
m->print_value_on(st);
}
maybe that should take the string with BULLET and print in the whole thing in the else statement.
Or add a similar one that prints the address.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19885#discussion_r1653054693
More information about the hotspot-dev
mailing list