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

David Holmes dholmes at openjdk.org
Thu Aug 28 12:54:43 UTC 2025


On Thu, 28 Aug 2025 07:23:06 GMT, Matthias Baesken <mbaesken 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
>
> Hi David, with your PR added, I do not see the issue any more in our asan - tests  (jtreg and some others) .

@MBaesken thanks for verifying that. Unfortunately I need to revise the fix to avoid the actual deletion ... which I think will look messy as I have to execute the destructor code without using a destructor.

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

PR Comment: https://git.openjdk.org/jdk/pull/26832#issuecomment-3233381277


More information about the hotspot-dev mailing list