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

jni_GetStringUTFChars() uses wrong heap allocator

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 19
    • Fix Version/s: 19
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b22

      Description

      While analyzing valgrind log, I noticed abnormal entries:

      Conditional jump or move depends on uninitialised value(s)
         at 0x5AF96E7: is_readable_pointer (os.cpp:1056)
         by 0x5AF96E7: is_pointer_bad (os.cpp:1177)
         by 0x5AF96E7: is_pointer_bad (os.cpp:1176)
         by 0x5AF96E7: os::is_first_C_frame(frame*) (os.cpp:1199)
         by 0x5B0BD56: os::get_native_stack(unsigned char**, int, int) (os_posix.cpp:155)
         by 0x578EA1F: jni_GetStringUTFChars (jni.cpp:2236)
         by 0xF2D9A6A: Java_jdk_internal_loader_NativeLibrary_findEntry0 (NativeLibraries.c:233)

      Because I did not turn on NMT detail tracking, there should not have stack walking.

      It turns out that jni_GetStringUTFChars() passes 0 as NativeCallStack reference (see below), that results construction of NativeCallStack, where it performs stack walking in its constructor.

         result = AllocateHeap(length + 1, mtInternal, 0, AllocFailStrategy::RETURN_NULL);

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              zgu Zhengyu Gu
              Reporter:
              zgu Zhengyu Gu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: