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

Windows race remapping memory read-write for CDS and redefine classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 10
    • 9
    • hotspot
    • windows

      From David Holmes:

      Re: "Maybe the logic for "remapping the RO section to read-write" is faulty on Windows and in rare occasions would unmap the RO section"

      That rings a bell:

      // Remap a block of memory.
      char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
                             char *addr, size_t bytes, bool read_only,
                             bool allow_exec) {
        // This OS does not allow existing memory maps to be remapped so we
        // have to unmap the memory before we remap it.
        if (!os::unmap_memory(addr, bytes)) {
          return NULL;
        }

        // There is a very small theoretical window between the unmap_memory()
        // call above and the map_memory() call below where a thread in native
        // code may be able to access an address that is no longer mapped.

        return os::map_memory(fd, file_name, file_offset, addr, bytes,
                 read_only, allow_exec);
      }

      What happens to the memory contents between the unmap and map?

      Change below to use VirtualProtect got GetLastError = 75

      http://cr.openjdk.java.net/~coleenp/8087153.01/

            Unassigned Unassigned
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: