This is an archive of the discontinued LLVM Phabricator instance.

[Asan] Return nullptr for invalid chunks
ClosedPublic

Authored by vitalybuka on Sep 4 2020, 4:08 AM.

Details

Summary

CHUNK_ALLOCATED. CHUNK_QUARANTINE are only states
which make AsanChunk useful for GetAsanChunk callers.
In either case member of AsanChunk are not useful.

Fix few cases which didn't expect nullptr. Most of the callers are already
expects nullptr.

Diff Detail

Event Timeline

vitalybuka created this revision.Sep 4 2020, 4:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2020, 4:08 AM
Herald added subscribers: Restricted Project, jfb. · View Herald Transcript
vitalybuka requested review of this revision.Sep 4 2020, 4:08 AM
vitalybuka retitled this revision from [Asan] GetAsanChunk returns nullptr for CHUNK_INVALID to [Asan] Return nullptr for CHUNK_INVALID.
morehouse added inline comments.Sep 8 2020, 4:53 PM
compiler-rt/lib/asan/asan_allocator.cpp
757

Are we guaranteed that chunk_state == CHUNK_INVALID when p = alloc_beg?

If so, this seems tricky. Please add a comment explaining why this is the case.

vitalybuka retitled this revision from [Asan] Return nullptr for CHUNK_INVALID to [Asan] Return nullptr for invalid chunks.Sep 8 2020, 11:49 PM
vitalybuka edited the summary of this revision. (Show Details)
vitalybuka added inline comments.Sep 8 2020, 11:53 PM
compiler-rt/lib/asan/asan_allocator.cpp
757

Actually I cannot to guaranty that.
Still the patch should be useful.

In followup I'll try to guaranty.

vitalybuka updated this revision to Diff 290668.Sep 9 2020, 1:43 AM
vitalybuka edited the summary of this revision. (Show Details)

fixes

This revision is now accepted and ready to land.Sep 9 2020, 2:03 PM
This revision was automatically updated to reflect the committed changes.