8219414: SA: jhsdb jsnap throws UnmappedAddressException with core generated by gcore
Reviewed-by: cjplummer, jgeorge
--- a/src/hotspot/os/linux/globals_linux.hpp Thu Feb 21 05:06:41 2019 -0500
+++ b/src/hotspot/os/linux/globals_linux.hpp Thu Feb 21 21:02:39 2019 +0900
@@ -70,7 +70,12 @@
diagnostic(bool, DumpPrivateMappingsInCore, true, \
"If true, sets bit 2 of /proc/PID/coredump_filter, thus " \
"resulting in file-backed private mappings of the process to "\
- "be dumped into the corefile, if UseSharedSpaces is true.") \
+ "be dumped into the corefile.") \
+ \
+ diagnostic(bool, DumpSharedMappingsInCore, true, \
+ "If true, sets bit 3 of /proc/PID/coredump_filter, thus " \
+ "resulting in file-backed shared mappings of the process to " \
+ "be dumped into the corefile.") \
\
diagnostic(bool, UseCpuAllocPath, false, \
"Use CPU_ALLOC code path in os::active_processor_count ")
--- a/src/hotspot/os/linux/os_linux.cpp Thu Feb 21 05:06:41 2019 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp Thu Feb 21 21:02:39 2019 +0900
@@ -131,6 +131,7 @@
enum CoredumpFilterBit {
FILE_BACKED_PVT_BIT = 1 << 2,
+ FILE_BACKED_SHARED_BIT = 1 << 3,
LARGEPAGES_BIT = 1 << 6,
DAX_SHARED_BIT = 1 << 8
};
@@ -1357,8 +1358,8 @@
void os::abort(bool dump_core, void* siginfo, const void* context) {
os::shutdown();
if (dump_core) {
-#if INCLUDE_CDS
- if (UseSharedSpaces && DumpPrivateMappingsInCore) {
+#ifndef ZERO
+ if (DumpPrivateMappingsInCore) {
ClassLoader::close_jrt_image();
}
#endif
@@ -3432,8 +3433,6 @@
return result;
}
-// Set the coredump_filter bits to include largepages in core dump (bit 6)
-//
// From the coredump_filter documentation:
//
// - (bit 0) anonymous private memory
@@ -5131,11 +5130,13 @@
set_coredump_filter(DAX_SHARED_BIT);
}
-#if INCLUDE_CDS
- if (UseSharedSpaces && DumpPrivateMappingsInCore) {
+ if (DumpPrivateMappingsInCore) {
set_coredump_filter(FILE_BACKED_PVT_BIT);
}
-#endif
+
+ if (DumpSharedMappingsInCore) {
+ set_coredump_filter(FILE_BACKED_SHARED_BIT);
+ }
return JNI_OK;
}