RFR: 8332720: ubsan: instanceKlass.cpp:3550:76: runtime error: member call on null pointer of type 'struct Array'

Stefan Karlsson stefank at openjdk.org
Wed May 22 14:48:02 UTC 2024


On Wed, 22 May 2024 14:30:01 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> When running hs :tier1 tests, with ubsan enabled (configure flag --enable-ubsan), in test runtime/CommandLine/PrintClasses_id0.jtr
> this error is reported ; seems we miss a nullptr check that is in place at similar coding in instanceKlass.cpp .
> 
> /jdk/src/hotspot/share/oops/instanceKlass.cpp:3550:76: runtime error: member call on null pointer of type 'struct Array'
>     #0 0x7fed098d2362 in InstanceKlass::print_on(outputStream*) const /jdk/src/hotspot/share/oops/instanceKlass.cpp:3550
>     #1 0x7fed09897cdc in PrintClassClosure::do_klass(Klass*) /jdk/src/hotspot/share/oops/instanceKlass.cpp:2228
>     #2 0x7fed08bed334 in ClassLoaderData::classes_do(KlassClosure*) /jdk/src/hotspot/share/classfile/classLoaderData.cpp:387
>     #3 0x7fed08c06403 in ClassLoaderDataGraph::classes_do(KlassClosure*) /jdk/src/hotspot/share/classfile/classLoaderDataGraph.cpp:303
>     #4 0x7fed09108768 in VM_PrintClasses::doit() /jdk/src/hotspot/share/services/diagnosticCommand.cpp:989
>     #5 0x7fed0b776c38 in VM_Operation::evaluate() /jdk/src/hotspot/share/runtime/vmOperations.cpp:75
>     #6 0x7fed0b7af23e in VMThread::evaluate_operation(VM_Operation*) /jdk/src/hotspot/share/runtime/vmThread.cpp:283
>     #7 0x7fed0b7b0a67 in VMThread::inner_execute(VM_Operation*) /jdk/src/hotspot/share/runtime/vmThread.cpp:427
>     #8 0x7fed0b7b1681 in VMThread::loop() /jdk/src/hotspot/share/runtime/vmThread.cpp:493
>     #9 0x7fed0b7b1681 in VMThread::loop() /jdk/src/hotspot/share/runtime/vmThread.cpp:478
>     #10 0x7fed0b7b182d in VMThread::run() /jdk/src/hotspot/share/runtime/vmThread.cpp:177
>     #11 0x7fed0b4e8b0f in Thread::call_run() /jdk/src/hotspot/share/runtime/thread.cpp:225
>     #12 0x7fed0a9dae75 in thread_native_entry /jdk/src/hotspot/os/linux/os_linux.cpp:846
>     #13 0x7fed10fed6e9 in start_thread (/lib64/libpthread.so.0+0xa6e9) (BuildId: 2f8d3c2d0f4d7888c2598d2ff6356537f5708a73)
>     #14 0x7fed1051550e in clone (/lib64/libc.so.6+0x11850e) (BuildId: f732026552f6adff988b338e92d466bc81a01c37)

src/hotspot/share/oops/instanceKlass.cpp line 3552:

> 3550:   st->print(BULLET"default_methods:   ");
> 3551:   if (default_methods() != nullptr) { default_methods()->print_value_on(st); }
> 3552:   st->cr();

The `default_vtable_indicies() printing looks like this:

  if (default_vtable_indices() != nullptr) {
    st->print(BULLET"default vtable indices:   "); default_vtable_indices()->print_value_on(st);       st->cr();
  }

Should this change make the code follow the same pattern?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19349#discussion_r1610132839


More information about the hotspot-dev mailing list