JDK-8025550 : valgrind: Conditional jump depends on uninitialised value in Arena::set_size_in_bytes()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs25
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-09-26
  • Updated: 2016-08-16
  • Resolved: 2014-03-17
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 7 JDK 9
7u131Fixed 9 b08Fixed
Description
The bug is found by running JDK 8 b109 inside valgrind

The various Arena constructor calls set_size_in_bytes(), like:

Arena::Arena() {
  _first = _chunk = new (AllocFailStrategy::EXIT_OOM, Chunk::init_size) Chunk(Chunk::init_size);
  _hwm = _chunk->bottom();      // Save the cached hwm, max
  _max = _chunk->top();
  set_size_in_bytes(Chunk::init_size);
  NOT_PRODUCT(Atomic::inc(&_instance_count);)
}

void Arena::set_size_in_bytes(size_t size) {
  if (_size_in_bytes != size) {
    _size_in_bytes = size;
    MemTracker::record_arena_size((address)this, size);
  }
}

However, at this time, the _size_in_bytes field is not yet initialized, (and it might be equal to size just by chance).

The fix would be have a different method like

void Arena::init_size_in_bytes(size_t size) {
  _size_in_bytes = size;
  MemTracker::record_arena_size((address)this, size);
}

This should be fixed because it generates a lot of error messages inside valgrind.

Comments
Added the 8-na label as this issue does not appear to reproduce on JDK 8. It seems that code changes associated with JDK-8056290 may have resolved this for JDK 8.
16-08-2016