RFR: 8341015: OopStorage location decoder crashes accessing non-initalized OopStorage

Kim Barrett kbarrett at openjdk.org
Thu Sep 26 12:19:35 UTC 2024


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

> When debugging CDS, I asked for `os::print_location` before OopStorage was initialized, like an error handler would do. This is a fairly unusual situation, this is why we have not seen it before. Anyhow, we entered the new code added by [JDK-8340392](https://bugs.openjdk.org/browse/JDK-8340392), which crashed on `OopStorage` that was `nullptr`. I think we should null-check `OopStorage` before calling into it.
> 
> Additional testing:
>  - [x] OopStorageSetTest still passing
>  - [x] Verified the check is now passing in similar debugging session

Looks good.

src/hotspot/share/gc/shared/oopStorageSet.cpp line 89:

> 87:     const void* aligned_addr = align_down(addr, alignof(oop));
> 88:     for (OopStorage* storage : Range<Id>()) {
> 89:       if (storage != nullptr && storage->print_containing((oop*) aligned_addr, st)) {

Add a comment?  Something like "Might get here while handling error before storage initialization."

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

Marked as reviewed by kbarrett (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21204#pullrequestreview-2331047091
PR Review Comment: https://git.openjdk.org/jdk/pull/21204#discussion_r1776951002


More information about the hotspot-gc-dev mailing list