This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Check for nullptr on user_alloc_usable_size_fast
ClosedPublic

Authored by Northbadge on Jun 12 2023, 3:33 PM.

Details

Summary

MBlock could be null (in the context of a call from RunFreeHooks)
if a static object was runtime initialized before tsan finished
initializing and that object later did a free().

While having the check isn't strictly required by
__sanitizer_get_allocated_size_fast's contract, a user's static object
would expect ptrs returned from malloc to be valid inputs.

Diff Detail

Event Timeline

Northbadge created this revision.Jun 12 2023, 3:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 3:33 PM
Herald added a subscriber: Enna1. · View Herald Transcript
Northbadge edited the summary of this revision. (Show Details)Jun 12 2023, 3:35 PM
Northbadge edited the summary of this revision. (Show Details)Jun 12 2023, 4:03 PM
Northbadge edited the summary of this revision. (Show Details)

Add comments

Northbadge published this revision for review.Jun 12 2023, 4:04 PM
Northbadge edited the summary of this revision. (Show Details)
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2023, 4:04 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jun 12 2023, 4:56 PM
This revision is now accepted and ready to land.Jun 12 2023, 4:56 PM