JDK-6679708 : No_Safepoint_Verifier and BacktraceBuilder have uninitialized fields
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2008-03-25
  • Updated: 2012-10-08
  • Resolved: 2008-06-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u14Fixed 7Fixed hs13Fixed
Description
While doing some testing with valgrind I tripped across a couple uninitialized fields.  BacktraceBuilder has an extra field which is uninitialized and is benignly useless.  No_Safepoint_Verifier doesn't properly initialize the _activated field.  Normally it should be true and garbage on the stack is more likely to be non-zero so mostly I think this doesn't matter either.

Comments
SUGGESTED FIX --- old/src/share/vm/classfile/javaClasses.cpp Tue Mar 25 10:04:30 2008 +++ new/src/share/vm/classfile/javaClasses.cpp Tue Mar 25 10:04:30 2008 @@ -1015,7 +1015,6 @@ typeArrayOop _bcis; int _index; bool _dirty; - bool _done; No_Safepoint_Verifier _nsv; public: @@ -1029,12 +1028,10 @@ }; // constructor for new backtrace - BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL) { + BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL), _dirty(false) { expand(CHECK); _backtrace = _head; _index = 0; - _dirty = false; - _done = false; } void flush() { --- old/src/share/vm/memory/gcLocker.hpp Tue Mar 25 10:04:32 2008 +++ new/src/share/vm/memory/gcLocker.hpp Tue Mar 25 10:04:32 2008 @@ -184,7 +184,9 @@ Thread *_thread; public: #ifdef ASSERT - No_Safepoint_Verifier(bool activated = true, bool verifygc = true ) : No_GC_Verifier(verifygc) { + No_Safepoint_Verifier(bool activated = true, bool verifygc = true ) : + No_GC_Verifier(verifygc), + _activated(activated) { _thread = Thread::current(); if (_activated) { _thread->_allow_allocation_count++;
27-03-2008

EVALUATION Remove the extra field from BacktraceBuilder and initialize the field in No_Safepoint_Verifier.
25-03-2008