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

Avoid calling vm_update with a NULL name

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u191
    • Fix Version/s: openjdk8u212
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      generic
    • OS:
      generic

      Description

      gcc 7.x gives the following warning when building jdk8u:

      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/runtime/fprofiler.cpp:
      In member function ‘void ThreadProfiler::vm_update(TickPosition)’:
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/runtime/fprofiler.cpp:638:56:
      warning: argument 1 null where non-null expected [-Wnonnull]
          bool vm_match(const char* name) const { return strcmp(name, _name)
      == 0; }
                                                         ~~~~~~^~~~~~~~~~~~~
      In file included from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp:35:0,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/utilities/globalDefinitions.hpp:33,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/utilities/debug.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/runtime/globals.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/allocation.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/iterator.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/genOopClosures.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/oops/klass.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/runtime/handles.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/memory/universe.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/code/oopRecorder.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/asm/codeBuffer.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/asm/assembler.hpp:28,
                        from
      /home/ubuntu/openjdk/jdk8u/hotspot/src/share/vm/precompiled/precompiled.hpp:29:
      /usr/include/string.h:136:12: note: in a call to function ‘int
      strcmp(const char*, const char*)’ declared here
        extern int strcmp (const char *__s1, const char *__s2)
                   ^~~~~~

      This appears to be because vm_update with a single argument calls its
      sibling function with a NULL name, which is not safe. A safer and
      compatible alternative is to call vm_update with an empty string; it
      results in exactly the same hash as a NULL string, i.e. 0.

      https://mail.openjdk.java.net/pipermail/jdk8u-dev/2018-December/008342.html

        Attachments

          Activity

            People

            Assignee:
            andrew Andrew Hughes
            Reporter:
            andrew Andrew Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: