RFR (S): 8196485: FromCardCache default card index can cause crashes

Thomas Schatzl thomas.schatzl at oracle.com
Thu Mar 8 08:59:16 UTC 2018


Hi all,

  can I have reviews for the following change that fixes a potential
crash due to missing remembered set entries on huge (2TB+) heaps, or
heaps that cross the 2TB address boundary (set via HeapBaseAddress)?

The reason is that in the FromCardCache that is used to filter out
repeated additions of the same card G1 uses 32 bits to represent that
card, with a default value of 2^32-1.

So if the first card we add to the remembered set has the index -1, G1
assumes that we already added that value and wrongly bails out.

2TB+ because 2^32 + 2^9 (card size) = 2^41 which is 2TB.

Note that some assertions in that code already catch this issue.

The fix is to extend the size of a FromCardCacheEntry to 64 bits, which
allows 2^73 byte sized heaps - which hopefully is sufficient for some
time :)

On my machine the passing test takes 8s (in debug mode), so I added it
to the regular tests run everytime.

CR:
https://bugs.openjdk.java.net/browse/JDK-8196485
Webrev:
http://cr.openjdk.java.net/~tschatzl/8196485/webrev/
Testing:
hs-tier1+2, new jtreg test asserting without the patch, running through
with the patch.

Thanks,
  Thomas



More information about the hotspot-gc-dev mailing list