8015635: Crash when specifying very large code cache size

Limit the size of the code cache to at most 2G when arguments are checked; added regression test

Reviewed-by: kvn, twisti
This commit is contained in:
Albert Noll 2013-07-09 11:48:05 +02:00
parent 85fedf2714
commit 1bc320c73a
2 changed files with 59 additions and 2 deletions

View file

@ -1855,8 +1855,13 @@ bool Arguments::check_gc_consistency() {
"please refer to the release notes for the combinations "
"allowed\n");
status = false;
} else if (ReservedCodeCacheSize > 2*G) {
// Code cache size larger than MAXINT is not supported.
jio_fprintf(defaultStream::error_stream(),
"Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
(2*G)/M);
status = false;
}
return status;
}
@ -2239,8 +2244,13 @@ bool Arguments::check_vm_args_consistency() {
"Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
min_code_cache_size/K);
status = false;
} else if (ReservedCodeCacheSize > 2*G) {
// Code cache size larger than MAXINT is not supported.
jio_fprintf(defaultStream::error_stream(),
"Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
(2*G)/M);
status = false;
}
return status;
}