8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs

Fri, 14 Nov 2014 14:23:25 +0100

author
mgerdin
date
Fri, 14 Nov 2014 14:23:25 +0100
changeset 7366
e8bf410d5e23
parent 7365
600c44255e5f
child 7367
82d3e7b5277a

8058209: Race in G1 card scanning could allow scanning of memory covered by PLABs
Summary: Read _top before _gc_time_stamp in saved_mark_word() with LoadLoad order to ensure we get a consistent view
Reviewed-by: brutisso, dcubed, dholmes, stefank

src/share/vm/gc_implementation/g1/heapRegion.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp	Tue Nov 11 11:05:41 2014 +0100
     1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Nov 14 14:23:25 2014 +0100
     1.3 @@ -1015,10 +1015,13 @@
     1.4  HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
     1.5    G1CollectedHeap* g1h = G1CollectedHeap::heap();
     1.6    assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
     1.7 -  if (_gc_time_stamp < g1h->get_gc_time_stamp())
     1.8 -    return top();
     1.9 -  else
    1.10 +  HeapWord* local_top = top();
    1.11 +  OrderAccess::loadload();
    1.12 +  if (_gc_time_stamp < g1h->get_gc_time_stamp()) {
    1.13 +    return local_top;
    1.14 +  } else {
    1.15      return Space::saved_mark_word();
    1.16 +  }
    1.17  }
    1.18  
    1.19  void G1OffsetTableContigSpace::record_top_and_timestamp() {

mercurial