RFR: 8341020: Metaspace::contains crashes when Metaspace is not fully initialized

David Holmes dholmes at openjdk.org
Sun Sep 29 22:36:34 UTC 2024


On Thu, 26 Sep 2024 11:44:44 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> When debugging CDS, I asked for `os::print_location` when Metaspace was not completely initialized. I suspect the same might happen if error handler fires very early in startup sequence.
> 
> `os::print_location` got to `Metaspace::contains`, which ended up in `Metaspace::is_in_nonclass_metaspace`, which crashed, since `VirtualSpaceList` was null. Other checks in `Metaspace::contains` seem to only check the address against the boundaries, and are not affected.
> 
> Additional testing:
>  - [x] The same debugging session did not crash the VM after the patch

LGTM!

Thanks

-------------

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21206#pullrequestreview-2336030545


More information about the hotspot-runtime-dev mailing list