RFR(XS) 8252521: possible race in java_suspend_self_with_safepoint_check

Robbin Ehn robbin.ehn at oracle.com
Thu Sep 3 10:02:49 UTC 2020


Looks good, ship it!

Thanks for fixing!

/Robbin

On 2020-09-02 17:15, Reingruber, Richard wrote:
> Hi,
> 
> please help review this fix for a race condition in
> JavaThread::java_suspend_self_with_safepoint_check() that allows a suspended
> thread to continue executing java for an arbitrary long time (see repro test
> attached to bug report).
> 
> Webrev: http://cr.openjdk.java.net/~rrich/webrevs/8252521/webrev.0/
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8252521
> 
> The fix is to add a do-while-loop to java_suspend_self_with_safepoint_check()
> that checks if the current thread was suspended again after returning from
> java_suspend_self() and before restoring the original thread state. The check is
> performed after restoring the original state because then we are guaranteed to
> see the suspend request issued before the requester observed that target to be
> _thread_blocked and executed VM_ThreadSuspend.
> 
> Thanks, Richard.
> 


More information about the hotspot-runtime-dev mailing list