Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8222387

Out-of-bounds access to CPU _family_id_xxx array

XMLWordPrintable

    • b17
    • x86

        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.

              dholmes David Holmes
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: