--- old/src/hotspot/os/linux/os_linux.cpp 2018-10-09 10:10:53.417103556 +0530 +++ new/src/hotspot/os/linux/os_linux.cpp 2018-10-09 10:10:53.113103556 +0530 @@ -128,8 +128,12 @@ // for timer info max values which include all bits #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) -#define LARGEPAGES_BIT (1 << 6) -#define DAX_SHARED_BIT (1 << 8) +enum CoredumpFilterBit { + FILE_BACKED_PVT_BIT = 1 << 2, + LARGEPAGES_BIT = 1 << 6, + DAX_SHARED_BIT = 1 << 8 +}; + //////////////////////////////////////////////////////////////////////////////// // global variables julong os::Linux::_physical_memory = 0; @@ -3399,10 +3403,9 @@ // - (bit 7) dax private memory // - (bit 8) dax shared memory // -static void set_coredump_filter(bool largepages, bool dax_shared) { +static void set_coredump_filter(CoredumpFilterBit bit) { FILE *f; long cdm; - bool filter_changed = false; if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) { return; @@ -3413,17 +3416,11 @@ return; } + long saved_cdm = cdm; rewind(f); + cdm |= bit; - if (largepages && (cdm & LARGEPAGES_BIT) == 0) { - cdm |= LARGEPAGES_BIT; - filter_changed = true; - } - if (dax_shared && (cdm & DAX_SHARED_BIT) == 0) { - cdm |= DAX_SHARED_BIT; - filter_changed = true; - } - if (filter_changed) { + if (cdm != saved_cdm) { fprintf(f, "%#lx", cdm); } @@ -3562,7 +3559,7 @@ size_t large_page_size = Linux::setup_large_page_size(); UseLargePages = Linux::setup_large_page_type(large_page_size); - set_coredump_filter(true /*largepages*/, false /*dax_shared*/); + set_coredump_filter(LARGEPAGES_BIT); } #ifndef SHM_HUGETLB @@ -5066,8 +5063,13 @@ prio_init(); if (!FLAG_IS_DEFAULT(AllocateHeapAt)) { - set_coredump_filter(false /*largepages*/, true /*dax_shared*/); + set_coredump_filter(DAX_SHARED_BIT); } + + if (UseSharedSpaces) { + set_coredump_filter(FILE_BACKED_PVT_BIT); + } + return JNI_OK; } --- old/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java 2018-10-09 10:10:54.225103556 +0530 +++ new/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java 2018-10-09 10:10:53.957103556 +0530 @@ -23,8 +23,8 @@ /** * @test - * @bug 8174994 - * @summary Test the clhsdb commands 'printmdo', 'printall' on a CDS enabled corefile. + * @bug 8174994 8200613 + * @summary Test the clhsdb commands 'printmdo', 'printall', 'jstack' on a CDS enabled corefile. * @requires vm.cds * @requires vm.hasSA * @requires os.family != "windows" @@ -79,7 +79,6 @@ CDSTestUtils.createArchiveAndCheck(opts); String[] jArgs = { - "-Xmx512m", "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + SHARED_ARCHIVE_NAME, "-XX:+CreateCoredumpOnCrash", @@ -156,7 +155,7 @@ throw new SkippedException("The CDS archive is not mapped"); } - cmds = List.of("printmdo -a", "printall"); + cmds = List.of("printmdo -a", "printall", "jstack -v"); Map> expStrMap = new HashMap<>(); Map> unExpStrMap = new HashMap<>(); @@ -182,6 +181,11 @@ "illegal code", "Failure occurred at bci", "No suitable match for type of address")); + expStrMap.put("jstack -v", List.of( + "Common-Cleaner", + "Method*")); + unExpStrMap.put("jstack -v", List.of( + "sun.jvm.hotspot.debugger.UnmappedAddressException")); test.runOnCore(TEST_CDS_CORE_FILE_NAME, cmds, expStrMap, unExpStrMap); } catch (SkippedException e) { throw e;