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

Increase buffer size for buf (insert_features_names) in Abstract_VM_Version::insert_features_names

    XMLWordPrintable

Details

    • b26

    Backports

      Description

        Running ./java --version on my machine crashes a debug build.

        (I already encounter issues during build, actually, but it seems the "java" executable is already build at that time, and just crashes when it gets invoked)

        # To suppress the following error report, specify this argument
        # after -XX: or in .hotspotrc: SuppressErrorAt=/abstract_vm_version.cpp:311
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/home/emanuel/Documents/fork7-jdk/open/src/hotspot/share/runtime/abstract_vm_version.cpp:311), pid=1142703, tid=1142704
        # assert(res > 0) failed: not enough temporary space allocated
        #
        # JRE version: (20.0) (slowdebug build )
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 20-internal-2022-11-25-1222340.emanuel..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0x344cdc] Abstract_VM_Version::insert_features_names(char*, unsigned long, char const**)+0x82
        #
        # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/emanuel/Documents/fork7-jdk/build/linux-x64-slowdebug/jdk/bin/core.1142703)
        #
        # An error report file with more information is saved as:
        # /home/emanuel/Documents/fork7-jdk/build/linux-x64-slowdebug/jdk/bin/hs_err_pid1142703.log
        #
        #

        The problem seems to be that we have limited the buffer size char buf[512]; .
        src/hotspot/cpu/x86/vm_version_x86.cpp line 992
        If I raise it to 1024, everything works.
        The string produced is (514 characters):
        (8 cores per cpu, 2 threads per core) family 6 model 141 stepping 1 microcode 0x40, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, avx512f, avx512dq, avx512cd, avx512bw, avx512vl, sha, fma, vzeroupper, avx512_vpopcntdq, avx512_vpclmulqdq, avx512_vaes, avx512_vnni, clflush, clflushopt, clwb, avx512_vbmi2, avx512_vbmi, rdtscp, rdpid, fsrm, gfni, avx512_bitalg, f16c, pku, ospke, cet_ibt, cet_ss, avx512_ifma
        I compared it to an un-synced repo, and get (501 characters):
        (8 cores per cpu, 2 threads per core) family 6 model 141 stepping 1 microcode 0x40, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, avx512f, avx512dq, avx512cd, avx512bw, avx512vl, sha, fma, vzeroupper, avx512_vpopcntdq, avx512_vpclmulqdq, avx512_vaes, avx512_vnni, clflush, clflushopt, clwb, avx512_vbmi2, avx512_vbmi, rdtscp, rdpid, fsrm, gfni, avx512_bitalg, f16c, pku, ospke, cet_ibt, cet_ss
        I assume the 512 byte limit is arbitrary and could be raised?
        Looks like "avx512_ifma" was recently added
        JDK-8288047
        https://github.com/openjdk/jdk/commit/f12710e938b36594623e9c82961d8aa0c0ef29c2


        Proposed patch
        diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp
        index e981498f7d6..5a45c29307e 100644
        --- a/src/hotspot/cpu/x86/vm_version_x86.cpp
        +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp
        @@ -989,7 +989,7 @@ void VM_Version::get_processor_features() {
             _has_intel_jcc_erratum = IntelJccErratumMitigation;
           }
         
        - char buf[512];
        + char buf[1024];
           int res = jio_snprintf(
                       buf, sizeof(buf),
                       "(%u cores per cpu, %u threads per core) family %d model %d stepping %d microcode 0x%x",

        Attachments

          Issue Links

            Activity

              People

                epeter Emanuel Peter
                epeter Emanuel Peter
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: