From cfb50a9cb7da16375a26c3f147ebd17ca393f914 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 2 Dec 2020 13:40:26 +0000 Subject: [PATCH] 8253916: ResourceExhausted/resexhausted001 crashes on Linux-x64 Reviewed-by: stuefe, sspitsyn, dholmes --- src/hotspot/share/runtime/stackOverflow.cpp | 5 +---- src/hotspot/share/utilities/debug.hpp | 3 ++- src/hotspot/share/utilities/vmError.cpp | 4 +++- test/hotspot/jtreg/ProblemList.txt | 2 -- .../ResourceExhausted/resexhausted001/TestDescription.java | 3 ++- .../ResourceExhausted/resexhausted004/TestDescription.java | 3 ++- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hotspot/share/runtime/stackOverflow.cpp b/src/hotspot/share/runtime/stackOverflow.cpp index 01aba3ea2de..942f3a29e3f 100644 --- a/src/hotspot/share/runtime/stackOverflow.cpp +++ b/src/hotspot/share/runtime/stackOverflow.cpp @@ -103,10 +103,7 @@ void StackOverflow::create_stack_guard_pages() { } else { log_warning(os, thread)("Attempt to protect stack guard pages failed (" PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len)); - if (os::uncommit_memory((char *) low_addr, len)) { - log_warning(os, thread)("Attempt to deallocate stack guard pages failed."); - } - return; + vm_exit_out_of_memory(len, OOM_MPROTECT_ERROR, "memory to guard stack pages"); } log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages activated: " diff --git a/src/hotspot/share/utilities/debug.hpp b/src/hotspot/share/utilities/debug.hpp index cd44aea2781..8f6858ac589 100644 --- a/src/hotspot/share/utilities/debug.hpp +++ b/src/hotspot/share/utilities/debug.hpp @@ -149,7 +149,8 @@ do { enum VMErrorType { INTERNAL_ERROR = 0xe0000000, OOM_MALLOC_ERROR = 0xe0000001, - OOM_MMAP_ERROR = 0xe0000002 + OOM_MMAP_ERROR = 0xe0000002, + OOM_MPROTECT_ERROR = 0xe0000003 }; // Set to suppress secondary error reporting. diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 16e3b8e11c2..9b0dc413bcd 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -510,10 +510,12 @@ void VMError::report(outputStream* st, bool _verbose) { switch(static_cast(_id)) { case OOM_MALLOC_ERROR: case OOM_MMAP_ERROR: + case OOM_MPROTECT_ERROR: if (_size) { st->print("# Native memory allocation "); st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : - "(mmap) failed to map "); + (_id == (int)OOM_MMAP_ERROR) ? "(mmap) failed to map " : + "(mprotect) failed to protect "); jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); st->print("%s", buf); st->print(" bytes"); diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 75fbead6ab9..4c45915438d 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -131,8 +131,6 @@ vmTestbase/metaspace/gc/firstGC_50m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_99m/TestDescription.java 8208250 generic-all vmTestbase/metaspace/gc/firstGC_default/TestDescription.java 8208250 generic-all -vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java 8253916 linux-all -vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java 8253916 linux-all vmTestbase/nsk/jvmti/AttachOnDemand/attach045/TestDescription.java 8202971 generic-all vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/TestDescription.java 8219652 aix-ppc64 vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/TestDescription.java 8219652 aix-ppc64 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java index c86d34c9b2c..58a1867a9fc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001/TestDescription.java @@ -24,6 +24,7 @@ /* * @test + * @bug 8253916 * * @summary converted from VM Testbase nsk/jvmti/ResourceExhausted/resexhausted001. * VM Testbase keywords: [jpda, jvmti, noras, vm6, nonconcurrent, quarantine, exclude] @@ -37,7 +38,7 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm/native/timeout=240 + * @run main/othervm/native/manual/timeout=240 * -agentlib:resexhausted=-waittime=5 * -XX:-UseGCOverheadLimit * -Xms16m diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java index 8b53a5627d5..e795bf1f9d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted004/TestDescription.java @@ -24,6 +24,7 @@ /* * @test + * @bug 8253916 * * @key randomness * @summary converted from VM Testbase nsk/jvmti/ResourceExhausted/resexhausted004. @@ -39,7 +40,7 @@ * * @library /vmTestbase * /test/lib - * @run main/othervm/native + * @run main/othervm/native/manual * -agentlib:resexhausted=-waittime=5 * -Xms16m * -Xmx16m