-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8333363: ubsan: instanceKlass.cpp: runtime error: member call on null pointer of type 'struct AnnotationArray' #19885
Conversation
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
@MBaesken This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 20 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
The other returns pointers (e.g. class_type_annotations()) can be nullptr too, so we need the same checking there as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this a bigger change to handle all the potentially null pointers the same way?
st->print(BULLET"class type annotations: "); class_type_annotations()->print_value_on(st); st->cr(); | ||
st->print(BULLET"field annotations: "); fields_annotations()->print_value_on(st); st->cr(); | ||
st->print(BULLET"field type annotations: "); fields_type_annotations()->print_value_on(st); st->cr(); | ||
if (class_annotations() != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Hi Coleen, in this change I only adjusted the ones that were really reported when running HS :tier1 with ubsan enabled binaries. |
Why not add this to metadata.hpp:
and use it for the things that ubsan complains about now. Then you could use it for the next set of ubsan complaints. |
Hi Coleen, that print_on_maybe_null template is a great idea ! Added that and used it at the places where we check for nullptr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I think print_on_maybe_null will come in handy. Thank you for doing this ubsan work.
Hi Coleen and Stefan, thanks for the reviews ! /integrate |
Going to push as commit 46b817b.
Your commit was automatically rebased without conflicts. |
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)
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19885/head:pull/19885
$ git checkout pull/19885
Update a local copy of the PR:
$ git checkout pull/19885
$ git pull https://git.openjdk.org/jdk.git pull/19885/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19885
View PR using the GUI difftool:
$ git pr show -t 19885
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19885.diff
Webrev
Link to Webrev Comment