Skip to content

Commit

Permalink
8293403: JfrResolution::on_jvmci_resolution crashes when caller is null
Browse files Browse the repository at this point in the history
Reviewed-by: never
  • Loading branch information
Doug Simon committed Sep 6, 2022
1 parent c05015b commit 7c96608
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hotspot/share/jfr/instrumentation/jfrResolution.cpp
Expand Up @@ -127,8 +127,10 @@ void JfrResolution::on_c2_resolution(const Parse * parse, const ciKlass * holder
#if INCLUDE_JVMCI
// JVMCI
void JfrResolution::on_jvmci_resolution(const Method* caller, const Method* target, TRAPS) {
if (is_compiler_linking_event_writer(target->method_holder()->name(), target->name()) && !IS_METHOD_BLESSED(caller)) {
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), link_error_msg);
if (is_compiler_linking_event_writer(target->method_holder()->name(), target->name())) {
if (caller == nullptr || !IS_METHOD_BLESSED(caller)) {
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), link_error_msg);
}
}
}
#endif
6 changes: 6 additions & 0 deletions test/jdk/jdk/jfr/jvm/TestGetEventWriter.java
Expand Up @@ -371,6 +371,12 @@ private static void checkJVMCI(Class<?> eventClass, String commitName) throws Th
throw new AssertionError("Expected IllegalAccessError");
} catch (IllegalAccessError e) {
}
try {
// Test looking up with null caller
cp.lookupMethod(cpi, 184, null);
throw new AssertionError("Expected IllegalAccessError");
} catch (IllegalAccessError e) {
}

// Ignore all subsequent instructions
return;
Expand Down

1 comment on commit 7c96608

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.