8122937: [JEP 245] Validate JVM Command-Line Flag Arguments

Validate the arguments to all JVM command-line flags so as to avoid crashes, and ensure that appropriate error messages are displayed when they are invalid.

Reviewed-by: ddmitriev, dholmes, kbarrett, drwhite, brutisso, coleenp
This commit is contained in:
Gerard Ziemski 2015-06-18 14:39:38 -05:00
parent ac072b303d
commit ed2bb8c9fc
49 changed files with 2843 additions and 938 deletions

View file

@ -54,6 +54,7 @@
#include "runtime/deoptimization.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/globals.hpp"
#include "runtime/init.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/java.hpp"
@ -3303,6 +3304,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
jint ergo_result = Arguments::apply_ergo();
if (ergo_result != JNI_OK) return ergo_result;
// Final check of all arguments after ergonomics which may change values.
if (!CommandLineFlags::check_all_ranges_and_constraints()) {
return JNI_EINVAL;
}
if (PauseAtStartup) {
os::pause();
}