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

C2: Missing ChaCha20 stub for x86_32 leads to crashes

    XMLWordPrintable

Details

    • b02
    • x86

    Backports

      Description

        x86_32 has no stub for ChaCha20. We therefore assert in LibraryCallKit::inline_chacha20Block() when trying to create a runtime call with the stub address which is null:

        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/home/christian/jdk2/open/src/hotspot/share/opto/graphKit.cpp:2496), pid=583031, tid=583058
        # assert(call_addr != nullptr) failed: must not call null targets
        #
        # JRE version: Java(TM) SE Runtime Environment (23.0) (slowdebug build 23-internal-2023-12-08-0752178.christian...)
        # Java VM: Java HotSpot(TM) Server VM (slowdebug 23-internal-2023-12-08-0752178.christian..., mixed mode, tiered, g1 gc, linux-x86)
        # Problematic frame:
        # V [libjvm.so+0x993846] GraphKit::make_runtime_call(int, TypeFunc const*, unsigned char*, char const*, TypePtr const*, Node*, Node*, Node*, Node*, Node*, Node*, Node*, Node*)+0x38

        The fix should be straight forward to bail out on x86_32 (i.e. setting UseChaCha20Intrinsics to false on this platform).

        -------

        Original report:

        JDK-8318756 added the CC20P1305 algorithm what is now called AEADBufferTest. A github test run for 32bit mode showed a crash on one of the tests. This test iterates through different type and sized input buffers in a multi-part operation

        The failure is not consistent to a particular buffer size. In the first known case the buffers lengths were update(96), update(8), and doFinal(10). In the second case it was update(16), update(77), and doFinal(21).

        This test has shown no failures in 64bit and unlikely a result of the new internal buffer change in JDK-8318756. Pre-intrinsic checks should be preventing any incorrect buffers sent to the intrinsic. It's more likely the addition to the test has found a pre-existing bug.

        2023-12-07T16:17:53.9600749Z # A fatal error has been detected by the Java Runtime Environment:
        2023-12-07T16:17:53.9600885Z #
        2023-12-07T16:17:53.9601156Z # SIGSEGV (0xb) at pc=0x00000000, pid=2248, tid=10052
        2023-12-07T16:17:53.9601294Z #
        2023-12-07T16:17:53.9602299Z # JRE version: OpenJDK Runtime Environment (22.0) (build 22-internal--9168e8a4b7c205f65e0235dd2a88f9719b1f157a)
        2023-12-07T16:17:53.9603413Z # Java VM: OpenJDK Server VM (22-internal-x-9168e8a4b7c205f65e0235dd2a88f9719b1f157a, mixed mode, tiered, g1 gc, linux-x86)
        2023-12-07T16:17:53.9603571Z # Problematic frame:
        2023-12-07T16:17:53.9604830Z # J 5636 c2 com.sun.crypto.provider.ChaCha20Cipher.chaCha20Transform([BII[BI)V java.base@22-internal (193 bytes) @ 0xef57e249 [0xef57dec0+0x00000389]
        2023-12-07T16:17:53.9604957Z #
        2023-12-07T16:17:53.9605263Z # CreateCoredumpOnCrash turned off, no core file dumped

        case1: https://pipelinesghubeus4.actions.githubusercontent.com/95ZFXFsdGqaiknep1I1IAGcVYmkc9zx2Ed5n2kIsJi5wGebcj6/_apis/pipelines/1/runs/296/signedlogcontent/244?urlExpires=2023-12-07T18%3A19%3A17.2730894Z&urlSigningMethod=HMACV1&urlSignature=yS76mC3cZ%2BKhZtPZgO3M7NETqZuFXWuxKFxrcnlaoHE%3D
        case2: https://pipelinesghubeus4.actions.githubusercontent.com/95ZFXFsdGqaiknep1I1IAGcVYmkc9zx2Ed5n2kIsJi5wGebcj6/_apis/pipelines/1/runs/298/signedlogcontent/245?urlExpires=2023-12-07T18%3A05%3A13.0339960Z&urlSigningMethod=HMACV1&urlSignature=%2Bz%2FQ3VXIdfW%2FHfZBzssjNkH36xQN4VnLn%2BjbXOF%2F8mc%3D

        Attachments

          Issue Links

            Activity

              People

                jnimeh Jamil Nimeh
                ascarpino Anthony Scarpino
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: