RFR: 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown [v2]

Thomas Stuefe stuefe at openjdk.org
Wed Sep 3 14:02:46 UTC 2025


On Fri, 29 Aug 2025 01:02:43 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> `ostream_exit` was deleting the stream underlying the `xtty` prior to nulling the `xtty` global variable, resulting in a use-after-free-error. Due to races during VM shutdown we cannot make use of `xtty` perfectly safe, but we can certainly narrow the window during which use-after-free is possible.
>> 
>> Testing:
>>  - tiers 1-3 sanity
>> 
>> Thanks
>
> David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'master' into 8364735-xtty
>  - 8364735: [asan] heap-use-after-free error detected in defaultStream::writer during VM shutdown

I still am not sure how the OrderAccess helps. A concurrent thread can see xtty != null and start printing while the terminating thread deletes the defaultStream under xtty? Sorry if I am slow.

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

PR Review: https://git.openjdk.org/jdk/pull/26832#pullrequestreview-3180819270


More information about the hotspot-dev mailing list