JDK-8142500 : missing null checks in IfNode::has_only_uncommon_traps
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-11-11
  • Updated: 2015-12-10
  • Resolved: 2015-11-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b96Fixed
Related Reports
Relates :  
Description
While testing Graal with JDK9 we hit a SEGV with latest C2.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5708e8e89e, pid=13481, tid=13508
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 1.9.0-internal-_2015_11_10_13_33-b00)
# Java VM: OpenJDK 64-Bit Server VM (1.9.0-internal-_2015_11_10_13_33-b00, mixed mode, tiered, jvmci, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x49189e]  JVMState::same_calls_as(JVMState const*) const+0xe
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to /slave/buildlog/CI-graal-compiler_gate_amd64_linux_postgate_jdk9-SNAPSHOT_jdk8_jdk7/build/graal-compiler/core.13481)
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

V  [libjvm.so+0x49189e]  JVMState::same_calls_as(JVMState const*) const+0xe
V  [libjvm.so+0x6ffe0b]  IfNode::has_only_uncommon_traps(ProjNode*, ProjNode*&, ProjNode*&, PhaseIterGVN*)+0x1ab
V  [libjvm.so+0x702726]  IfNode::fold_compares(PhaseIterGVN*)+0x236
V  [libjvm.so+0x703a1b]  IfNode::Ideal(PhaseGVN*, bool)+0xc9b

Inspection of the code showed it was possible for both dom_caller and caller to be null here:

      JVMState* dom_caller = dom_unc->jvms()->caller();
      JVMState* caller = unc->jvms()->caller();
      if (!dom_caller->same_calls_as(caller)) {
        return false;
      }

It should at least be checking that both are non-NULL though I think that both of them being NULL would actually be ok.  I pushed the following to our local repo http://hg.openjdk.java.net/graal/graal-jvmci-9/hotspot/rev/e9d1036f48c1
Comments
Thanks, Tom. I'll send the patch out for review then.
13-11-2015

Your patch passed our fastdebug post gate builds which had previously been crashing so it looks good from our end.
13-11-2015

Yes, I'll put it into our repo and see if fails.
12-11-2015

C2 crashes in 'IfNode::has_only_uncommon_traps()' after calling 'dom_caller->same_calls_as(caller)' because 'dom_caller' or 'caller' is NULL. This may happen if the method containing the corresponding uncommon trap is not inlined and therefore has no caller in it's JVMState. We should bail out if either 'dom_caller' or 'caller' is NULL (it's fine if both are NULL). Since we check that the uncommon traps belong to the same method, this can only happen if the method is recursively inlined. Here is my patch: http://cr.openjdk.java.net/~thartmann/8142500/webrev.00/ Tom, could you verify that this solves the issue?
12-11-2015

Thanks for the report. Do we have a reproducer for this?
12-11-2015

Yes it appears to new code from that fix.
11-11-2015

[~never], you said it's in code from JDK-8140574.
11-11-2015