6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash

Fri, 29 Jan 2010 14:51:38 -0800

author
johnc
date
Fri, 29 Jan 2010 14:51:38 -0800
changeset 1679
745c853ee57f
parent 1631
f3345b7b01b4
child 1680
6484c4ee11cb

6885297: java -XX:RefDiscoveryPolicy=2 or -XX:TLABWasteTargetPercent=0 cause VM crash
Summary: Interval checking is now being performed on the values passed in for these two flags. The current acceptable range for RefDiscoveryPolicy is [0..1], and for TLABWasteTargetPercent it is [1..100].
Reviewed-by: apetrusenko, ysr

src/share/vm/includeDB_core file | annotate | diff | comparison | revisions
src/share/vm/memory/referenceProcessor.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/includeDB_core	Wed Jan 27 22:38:37 2010 -0800
     1.2 +++ b/src/share/vm/includeDB_core	Fri Jan 29 14:51:38 2010 -0800
     1.3 @@ -175,6 +175,7 @@
     1.4  arguments.cpp                           management.hpp
     1.5  arguments.cpp                           oop.inline.hpp
     1.6  arguments.cpp                           os_<os_family>.inline.hpp
     1.7 +arguments.cpp                           referenceProcessor.hpp
     1.8  arguments.cpp                           universe.inline.hpp
     1.9  arguments.cpp                           vm_version_<arch>.hpp
    1.10  
     2.1 --- a/src/share/vm/memory/referenceProcessor.hpp	Wed Jan 27 22:38:37 2010 -0800
     2.2 +++ b/src/share/vm/memory/referenceProcessor.hpp	Fri Jan 29 14:51:38 2010 -0800
     2.3 @@ -263,10 +263,13 @@
     2.4      int                parallel_gc_threads = 1,
     2.5      bool               mt_processing = false,
     2.6      bool               discovered_list_needs_barrier = false);
     2.7 +
     2.8    // RefDiscoveryPolicy values
     2.9 -  enum {
    2.10 +  enum DiscoveryPolicy {
    2.11      ReferenceBasedDiscovery = 0,
    2.12 -    ReferentBasedDiscovery  = 1
    2.13 +    ReferentBasedDiscovery  = 1,
    2.14 +    DiscoveryPolicyMin      = ReferenceBasedDiscovery,
    2.15 +    DiscoveryPolicyMax      = ReferentBasedDiscovery
    2.16    };
    2.17  
    2.18    static void init_statics();
     3.1 --- a/src/share/vm/runtime/arguments.cpp	Wed Jan 27 22:38:37 2010 -0800
     3.2 +++ b/src/share/vm/runtime/arguments.cpp	Fri Jan 29 14:51:38 2010 -0800
     3.3 @@ -1487,6 +1487,20 @@
     3.4  //===========================================================================================================
     3.5  // Parsing of main arguments
     3.6  
     3.7 +bool Arguments::verify_interval(uintx val, uintx min,
     3.8 +                                uintx max, const char* name) {
     3.9 +  // Returns true iff value is in the inclusive interval [min..max]
    3.10 +  // false, otherwise.
    3.11 +  if (val >= min && val <= max) {
    3.12 +    return true;
    3.13 +  }
    3.14 +  jio_fprintf(defaultStream::error_stream(),
    3.15 +              "%s of " UINTX_FORMAT " is invalid; must be between " UINTX_FORMAT
    3.16 +              " and " UINTX_FORMAT "\n",
    3.17 +              name, val, min, max);
    3.18 +  return false;
    3.19 +}
    3.20 +
    3.21  bool Arguments::verify_percentage(uintx value, const char* name) {
    3.22    if (value <= 100) {
    3.23      return true;
    3.24 @@ -1723,6 +1737,16 @@
    3.25      status = false;
    3.26    }
    3.27  
    3.28 +  status = status && verify_interval(RefDiscoveryPolicy,
    3.29 +                                     ReferenceProcessor::DiscoveryPolicyMin,
    3.30 +                                     ReferenceProcessor::DiscoveryPolicyMax,
    3.31 +                                     "RefDiscoveryPolicy");
    3.32 +
    3.33 +  // Limit the lower bound of this flag to 1 as it is used in a division
    3.34 +  // expression.
    3.35 +  status = status && verify_interval(TLABWasteTargetPercent,
    3.36 +                                     1, 100, "TLABWasteTargetPercent");
    3.37 +
    3.38    return status;
    3.39  }
    3.40  
     4.1 --- a/src/share/vm/runtime/arguments.hpp	Wed Jan 27 22:38:37 2010 -0800
     4.2 +++ b/src/share/vm/runtime/arguments.hpp	Fri Jan 29 14:51:38 2010 -0800
     4.3 @@ -336,6 +336,8 @@
     4.4    static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
     4.5      return is_bad_option(option, ignore, NULL);
     4.6    }
     4.7 +  static bool verify_interval(uintx val, uintx min,
     4.8 +                              uintx max, const char* name);
     4.9    static bool verify_percentage(uintx value, const char* name);
    4.10    static void describe_range_error(ArgsRange errcode);
    4.11    static ArgsRange check_memory_size(julong size, julong min_size);

mercurial