RFR: 8336042: Caller/callee param size mismatch in deoptimization causes crash [v2]

Dean Long dlong at openjdk.org
Fri Feb 14 22:41:13 UTC 2025


On Wed, 12 Feb 2025 21:09:31 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.
>
> Dean Long has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix bounds checks

> I think you can make the assertion a little stricter like this [reinrich at 9c3c8a3](https://github.com/reinrich/jdk/commit/9c3c8a33a29b9ae6c4c703992b306dc0cbbcd2f0).

Regarding this stricter version, why are you using is_bottom_frame instead of is_top_frame?  The deoptimization code seems to name the most recent leaf frame "top".  That sounds like what frame::top_ijava_frame_abi_size is for too.

Thanks for the review, Vladimir.

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

PR Comment: https://git.openjdk.org/jdk/pull/23557#issuecomment-2660395298
PR Comment: https://git.openjdk.org/jdk/pull/23557#issuecomment-2660398727


More information about the hotspot-dev mailing list