提交 bdc378de 编写于 作者: P ptisnovs

6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages,...

6885308: The incorrect -XX:StackRedPages, -XX:StackShadowPages, -XX:StackYellowPages could cause VM crash
Summary: Test minimal stack sizes given (also fixed linux compilation error)
Reviewed-by: never, phh, coleenp
上级 0183fc12
...@@ -58,7 +58,7 @@ void* ResourceObj::operator new(size_t size, allocation_type type) { ...@@ -58,7 +58,7 @@ void* ResourceObj::operator new(size_t size, allocation_type type) {
void ResourceObj::operator delete(void* p) { void ResourceObj::operator delete(void* p) {
assert(((ResourceObj *)p)->allocated_on_C_heap(), assert(((ResourceObj *)p)->allocated_on_C_heap(),
"delete only allowed for C_HEAP objects"); "delete only allowed for C_HEAP objects");
DEBUG_ONLY(((ResourceObj *)p)->_allocation = badHeapOopVal;) DEBUG_ONLY(((ResourceObj *)p)->_allocation = (uintptr_t)badHeapOopVal;)
FreeHeap(p); FreeHeap(p);
} }
...@@ -104,7 +104,7 @@ ResourceObj& ResourceObj::operator=(const ResourceObj& r) { // default copy assi ...@@ -104,7 +104,7 @@ ResourceObj& ResourceObj::operator=(const ResourceObj& r) { // default copy assi
ResourceObj::~ResourceObj() { ResourceObj::~ResourceObj() {
// allocated_on_C_heap() also checks that encoded (in _allocation) address == this. // allocated_on_C_heap() also checks that encoded (in _allocation) address == this.
if (!allocated_on_C_heap()) { // ResourceObj::delete() zaps _allocation for C_heap. if (!allocated_on_C_heap()) { // ResourceObj::delete() zaps _allocation for C_heap.
_allocation = badHeapOopVal; // zap type _allocation = (uintptr_t)badHeapOopVal; // zap type
} }
} }
#endif // ASSERT #endif // ASSERT
......
...@@ -1559,6 +1559,18 @@ bool Arguments::verify_interval(uintx val, uintx min, ...@@ -1559,6 +1559,18 @@ bool Arguments::verify_interval(uintx val, uintx min,
return false; return false;
} }
bool Arguments::verify_min_value(intx val, intx min, const char* name) {
// Returns true if given value is greater than specified min threshold
// false, otherwise.
if (val >= min ) {
return true;
}
jio_fprintf(defaultStream::error_stream(),
"%s of " INTX_FORMAT " is invalid; must be greater than " INTX_FORMAT "\n",
name, val, min);
return false;
}
bool Arguments::verify_percentage(uintx value, const char* name) { bool Arguments::verify_percentage(uintx value, const char* name) {
if (value <= 100) { if (value <= 100) {
return true; return true;
...@@ -1611,6 +1623,16 @@ bool Arguments::check_gc_consistency() { ...@@ -1611,6 +1623,16 @@ bool Arguments::check_gc_consistency() {
return status; return status;
} }
// Check stack pages settings
bool Arguments::check_stack_pages()
{
bool status = true;
status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages");
status = status && verify_min_value(StackRedPages, 1, "StackRedPages");
status = status && verify_min_value(StackShadowPages, 1, "StackShadowPages");
return status;
}
// Check the consistency of vm_init_args // Check the consistency of vm_init_args
bool Arguments::check_vm_args_consistency() { bool Arguments::check_vm_args_consistency() {
// Method for adding checks for flag consistency. // Method for adding checks for flag consistency.
...@@ -1723,6 +1745,7 @@ bool Arguments::check_vm_args_consistency() { ...@@ -1723,6 +1745,7 @@ bool Arguments::check_vm_args_consistency() {
} }
status = status && check_gc_consistency(); status = status && check_gc_consistency();
status = status && check_stack_pages();
if (_has_alloc_profile) { if (_has_alloc_profile) {
if (UseParallelGC || UseParallelOldGC) { if (UseParallelGC || UseParallelOldGC) {
......
...@@ -338,6 +338,7 @@ class Arguments : AllStatic { ...@@ -338,6 +338,7 @@ class Arguments : AllStatic {
} }
static bool verify_interval(uintx val, uintx min, static bool verify_interval(uintx val, uintx min,
uintx max, const char* name); uintx max, const char* name);
static bool verify_min_value(intx val, intx min, const char* name);
static bool verify_percentage(uintx value, const char* name); static bool verify_percentage(uintx value, const char* name);
static void describe_range_error(ArgsRange errcode); static void describe_range_error(ArgsRange errcode);
static ArgsRange check_memory_size(julong size, julong min_size); static ArgsRange check_memory_size(julong size, julong min_size);
...@@ -400,6 +401,8 @@ class Arguments : AllStatic { ...@@ -400,6 +401,8 @@ class Arguments : AllStatic {
static bool check_gc_consistency(); static bool check_gc_consistency();
// Check consistecy or otherwise of VM argument settings // Check consistecy or otherwise of VM argument settings
static bool check_vm_args_consistency(); static bool check_vm_args_consistency();
// Check stack pages settings
static bool check_stack_pages();
// Used by os_solaris // Used by os_solaris
static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized); static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册