RFR: 8336042: Caller/callee param size mismatch in deoptimization causes crash
Dean Long
dlong at openjdk.org
Wed Feb 12 01:18:04 UTC 2025
On Tue, 11 Feb 2025 07:59:01 GMT, Dean Long <dlong at openjdk.org> wrote:
> When calling a MethodHandle linker, such as linkToStatic, we drop the last argument, which causes a mismatch between what the caller pushed and what the callee received. In deoptimization, we check for this in several places, but in one place we had outdated code. See the bug for the gory details.
>
> In this PR I add asserts and a test to reproduce the problem, plus the necessary fixes in deoptimizations. There are other inefficiencies in deoptimization that I didn't address, hoping to simplify the fix for backports.
>
> Some platforms align locals according to the caller during deoptimization, while some align locals according to the callee. The asserts I added compute locals both ways and check that they are still within the frame. I attempted this on all platforms, but am only able to test x64 and aarch64. I need help testing those asserts for arm32, ppc, riscv, and s390.
src/hotspot/share/runtime/deoptimization.cpp line 754:
> 752: int caller_actual_parameters = -1; // value not used except for interpreted frames, see below
> 753: if (deopt_sender.is_interpreted_frame()) {
> 754: caller_actual_parameters = callee_parameters + (caller_was_method_handle ? 1 : 0);
Previously, if caller_was_method_handle was set, we would pass in 0 below, which was wrong for the has_member_arg case, and I suspect it broke JVMTI PopFrame for platforms that don't use popframe_move_outgoing_args, but I don't have a test for this suspicion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23557#discussion_r1951795243
More information about the hotspot-dev
mailing list