JDK-8222387 : Out-of-bounds access to CPU _family_id_xxx array
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11,12,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • CPU: x86
  • Submitted: 2019-04-12
  • Updated: 2019-10-04
  • Resolved: 2019-04-14
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 11 JDK 13
11.0.5Fixed 13 b17Fixed
Description
As reported by fanjinke51@yeah.net

http://mail.openjdk.java.net/pipermail/hotspot-dev/2019-April/037725.html

We have:

const char* VM_Version_Ext::cpu_family_description(void) {
  int cpu_family_id = extended_cpu_family();
  if (is_amd()) {
    return _family_id_amd[cpu_family_id];
  }
  if (is_intel()) {
    if (cpu_family_id == CPU_FAMILY_PENTIUMPRO) {
      return cpu_model_description();
    }
    return _family_id_intel[cpu_family_id];
  }
  if (is_hygon()) {
    return "Dhyana";
  }

  return "Unknown x86";
}

which indexes into the _family_id_xx arrays using the value returned by extended_cpu_family(). But there is no check that the index is within range as can happen with newer processes. For example AMD Zen will have an id of decimal 23, but the _family_id_amd array only has 17 entries.

We need to add new entries for AMD Zen and ensure no out-of-bound accesses.
Comments
Fix-request: Original fix applies cleanly (modulo a single trivial whitespace diff) to 11. Tested tier1 tests ok.
05-08-2019