RFR: 8267842: SIGSEGV in get_current_contended_monitor

Daniel D.Daugherty dcubed at openjdk.java.net
Thu May 27 15:34:10 UTC 2021


On Thu, 27 May 2021 15:29:13 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> We need a fix for crashes in get_current_contended_monitor due to concurrent modification of memory locations which are not declared volatile. See bug for details.
>
> Hi Volker,
> thanks for looking at my proposal.
> 
> I had seen the JVMTIEnvBase version of it. The comment says:
> `  // The ObjectMonitor* can't be async deflated since we are either
>   // at a safepoint or the calling thread is operating on itself so
>   // it cannot leave the underlying wait()/enter() call.`
> 
> The ThreadService version's comment says:
> `  // This function can be called on a target JavaThread that is not  // the caller and we are not at a safepoint. So it is possible for  // the waiting or pending condition to be over/stale and for the  // first stage of async deflation to clear the object field in  // the ObjectMonitor. It is also possible for the object to be  // inflated again and to be associated with a completely different  // ObjectMonitor by the time this object reference is processed  // by the caller.`
> 
> So the affected code is a special usage. I don't know if a more generic fix would be desirable.
> Accessing the ObjectMonitor after it was removed from the thread seems to be intended according to this comment. To verify that it's safe, one would have to check the protocol which is described here: https://wiki.openjdk.java.net/display/HotSpot/Async+Monitor+Deflation
> (not a trivial task!)

@TheRealMDoerr - You should also add the Serviceability group for this reivew.

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

PR: https://git.openjdk.java.net/jdk/pull/4224


More information about the hotspot-runtime-dev mailing list