After having reserved an address range for the Klass encoding range, we either:
a) Place CDS, then class space, into that address range
b) Place only class space in that range (if CDS is off).
If we wrongly decode an nKlass-id of 0, and the encoding base is not null, the resulting pointer points to the start of the class range. That area is readable, albeit unused (both CDS (a) and Metaspace (b) make sure that there is nothing placed).
Therefore, it would be good to establish a no-access zone at the range's start and write protect it. Dereferencing such an nKlass would result in an immediate crash.
This would closely mimic what we do in the compressed-oops-enabled java heap.
a) Place CDS, then class space, into that address range
b) Place only class space in that range (if CDS is off).
If we wrongly decode an nKlass-id of 0, and the encoding base is not null, the resulting pointer points to the start of the class range. That area is readable, albeit unused (both CDS (a) and Metaspace (b) make sure that there is nothing placed).
Therefore, it would be good to establish a no-access zone at the range's start and write protect it. Dereferencing such an nKlass would result in an immediate crash.
This would closely mimic what we do in the compressed-oops-enabled java heap.
- links to
-
Review(master) openjdk/jdk/19290