Integrated: 8371216: oopDesc::print_value_on breaks if klass is garbage
Paul Hübner
phubner at openjdk.org
Mon Nov 10 09:28:13 UTC 2025
On Fri, 7 Nov 2025 09:08:33 GMT, Paul Hübner <phubner at openjdk.org> wrote:
> Hi all,
>
> The `oopDesc::print_value_on` function checks if an oop is a string, and if so just prints the raw string. To do this, it needs to read the `klass()`. If the `klass()` reads garbage, one of many assertion errors is likely triggered.
>
> For example, if G1's verification finds problematic oops, it will attempt to print them. If these oops have garbage (incorrect or racey) klasses, this will cause an assertion error, fail fast, and VM crash. G1 never finishes printing, which may make debugging more difficult. The developer can/will be made aware in other ways if the `klass()` is garbage, for example by being told that it is not in the metaspace.
>
> We observed the above in Valhalla and already patched it there.
>
> Testing: tiers 1-5 on Linux (x64, AArch64), macOS (x64, AArch64), Windows (x64).
This pull request has now been integrated.
Changeset: f48ad21e
Author: Paul Hübner <phubner at openjdk.org>
Committer: Martin Doerr <mdoerr at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/f48ad21ecc288c280db3ffb2e098df12518e2a5a
Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
8371216: oopDesc::print_value_on breaks if klass is garbage
Reviewed-by: coleenp, mdoerr
-------------
PR: https://git.openjdk.org/jdk/pull/28190
More information about the hotspot-dev
mailing list