Integrated: 8315890: Attempts to load from nullptr in instanceKlass.cpp and unsafe.cpp

Matias Saavedra Silva matsaave at openjdk.org
Thu Nov 2 14:33:16 UTC 2023


On Fri, 27 Oct 2023 15:40:58 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

> Calls in instanceKlass.cpp and unsafe.cpp try to call an atomic load on method calls that could return nullptr. This patch ensures that nullptr is not passed into the load. 
> 
> In `print_as_native_pointer` in archiveBuilder, `source_obj_to_requested_obj` should not be able to return `nullptr` as the result is immediately cast to an oop which cascades down to the failure reported in  `get_volatile()` in `unsafe.cpp`. Placing an assert close to the top of this call stack should prevent this from happening and will better indicate the source of an unexpected `nullptr` should it occur.
> 
> Verified with tier1-5 tests.

This pull request has now been integrated.

Changeset: 7a7b1e5a
Author:    Matias Saavedra Silva <matsaave at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/7a7b1e5a920d71ab717d8993c9258a01f1074a48
Stats:     5 lines in 2 files changed: 3 ins; 1 del; 1 mod

8315890: Attempts to load from nullptr in instanceKlass.cpp and unsafe.cpp

Reviewed-by: coleenp, ccheung, dholmes

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

PR: https://git.openjdk.org/jdk/pull/16405


More information about the hotspot-dev mailing list