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/
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/
- duplicates
-
JDK-8129739 os::pd_remap_memory on Windows has a small race condition that can lead to access of an unmapped region
-
- Closed
-
- relates to
-
JDK-8087153 EXCEPTION_ACCESS_VIOLATION when CDS RO section vanished on win32
-
- Closed
-