RFR: 8361103: java_lang_Thread::async_get_stack_trace does not properly protect JavaThread [v4]

David Holmes dholmes at openjdk.org
Fri Jul 11 00:22:41 UTC 2025


On Thu, 10 Jul 2025 23:34:50 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   carrier in TLH
>
> src/hotspot/share/runtime/threadSMR.cpp line 797:
> 
>> 795: // return JavaThread for the carrier thread; if the thread is unmounted
>> 796: // or use_carrier is false, return false.
>> 797: //
> 
> Right after the check on L827 below, what prevents the vthread from being unmounted?
> 
> So we fetch the JavaThread* on L833 and then verify that it is protected by the TLH
> which is good, but that does not prevent the vthread from being unmounted by the
> time that we return the JavaThread* on L853 below.
> 
> Am I missing something?

@dcubed-ojdk No you are not missing anything, the vthread could become unmounted. It is up to the subsequent handshake code to re-check that (as briefly discussed above).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2199076367


More information about the hotspot-dev mailing list