United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6744783 HotSpot segfaults if given -XX options with an empty string argument
JDK-6744783 : HotSpot segfaults if given -XX options with an empty string argument

Details
Type:
Bug
Submit Date:
2008-09-04
Status:
Closed
Updated Date:
2011-03-08
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
hotspot
OS:
solaris_2.5.1,generic
Sub-Component:
runtime
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs14,6u11
Fixed Versions:
hs14 (b06)

Related Reports
Backport:
Backport:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
There's a regression in the argument parsing code
of the HotSpot which leads to a segmentation fault if an -XX option
with an empty string argument (e.g. -XX:SyncKnobs= or
-XX:SyncKnobs="") is given on the command line.

The regression must have appeared somewhere in HS 11, because Java
1.6.0_06 (which contains HS 10.0_b22) doesn't show the problem while
both Java 1.6.0_10 (HS 11.0_b11) and Java 1.7.0-ea-b24 (HS 12.0_b01)
as well as the latest OpenJDK snapshot (Rev. 292 with tag jdk7-b34)
are affected.

                                    

Comments
SUGGESTED FIX

Suggested fix provided as a patch by the submitter:

The patch also fixes a minor flaw in globals.hpp
where the default value of the 'PrintAssemblyOptions' option, which is
of type 'ccstr', should really be "" instead of 'false'.

# HG changeset patch
# User Volker H. Simonis <###@###.###>
# Date 1220536147 -7200
# Node ID 9e103080d2dd8b4741fb22052dec954ed1192972
# Parent  5967ae2171f65055b4da7af918751d5a8d9e5f10
Fixed a regression in arguments.cpp which leads to a segmentation fault if an empty -XX option with an empty string argument (e.g. -XX:SyncKnobs= or -XX:SyncKnobs="") was given on the command line.

The regression must have appeared somewhere in HS 11, because Java 1.6.0_06 (which contains HS 10.0_b22) doesn't show the problem while both Java 1.6.0_10 (HS 11.0_b11) and Java 1.7.0-ea-b24 (HS 12.0_b01) as well as the latest OpenJDK snapshot (Rev. 292 with tag jdk7-b34) are affected.

At the same time I fixed a minor problem in globals.hpp where the default value of the 'PrintAssemblyOptions' option which is of type 'ccstr' should really be "" instead of 'false'.

diff -r 5967ae2171f6 -r 9e103080d2dd src/share/vm/runtime/arguments.cpp
--- a/src/share/vm/runtime/arguments.cpp	Thu Aug 28 11:05:17 2008 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Thu Sep 04 15:49:07 2008 +0200
@@ -610,9 +610,6 @@ bool Arguments::parse_argument(const cha
       if (flag->ccstr_accumulates()) {
         return append_to_string_flag(name, value, origin);
       } else {
-        if (value[0] == '\0') {
-          value = NULL;
-        }
         return set_string_flag(name, value, origin);
       }
     }
diff -r 5967ae2171f6 -r 9e103080d2dd src/share/vm/runtime/globals.hpp
--- a/src/share/vm/runtime/globals.hpp	Thu Aug 28 11:05:17 2008 -0700
+++ b/src/share/vm/runtime/globals.hpp	Thu Sep 04 15:49:07 2008 +0200
@@ -689,7 +689,7 @@ class CommandLineFlags {
   diagnostic(bool, PrintAssembly, false,                                    \
           "Print assembly code (using external disassembler.so)")           \
                                                                             \
-  diagnostic(ccstr, PrintAssemblyOptions, false,                            \
+  diagnostic(ccstr, PrintAssemblyOptions, "",                               \
           "Options string passed to disassembler.so")                       \
                                                                             \
   diagnostic(bool, PrintNMethods, false,                                    \
                                     
2008-09-04
EVALUATION

Simple fix to argument processing
                                     
2008-09-05
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/885fe0f95828
                                     
2008-09-25



Hardware and Software, Engineered to Work Together