RFR: 8297967: Make frame::safe_for_sender safer

Martin Doerr mdoerr at openjdk.org
Thu Dec 1 18:16:09 UTC 2022


On Thu, 1 Dec 2022 16:47:48 GMT, Johannes Bechberger <duke at openjdk.org> wrote:

> Makes frame::safe_for_sender safer by using os::is_readable_pointer to check the location of the return address.

src/hotspot/cpu/aarch64/frame_aarch64.cpp line 268:

> 266:   // Will the pc we fetch be non-zero (which we'll find at the oldest frame) and readable
> 267: 
> 268:   if (!os::is_readable_pointer(this->fp() + return_addr_offset * sizeof(address))) {

Address computation looks wrong: `fp()` returns an `intptr_t*`, so `return_addr_offset` gets scaled automatically before the addition. Wouldn't `thread->is_in_usable_stack(fp())` be a better check?

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

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


More information about the hotspot-dev mailing list