This is an archive of the discontinued LLVM Phabricator instance.

[hwasan] Fix incorrect candidate matching for stack OOB.
ClosedPublic

Authored by fmayer on Jun 30 2021, 8:00 AM.

Details

Summary

We would find an address with matching tag, only to discover in
ShowCandidate that it's very far away from [stack].

Diff Detail

Event Timeline

fmayer created this revision.Jun 30 2021, 8:00 AM
fmayer published this revision for review.Jun 30 2021, 8:26 AM
fmayer added a reviewer: eugenis.
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2021, 8:26 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis accepted this revision.Jun 30 2021, 12:54 PM

LGTM

compiler-rt/lib/hwasan/hwasan_report.cpp
438–439

I'd rather check AddrIsInStack instead of num_descriptions_printed, or record the result of the stack check in a bool variable and look at that. Otherwise this depends on the order of the checks and will become confusing later if the code is moved.

439–440

rename ShowCandidate to ShowHeapOrGlobalCandidate

This revision is now accepted and ready to land.Jun 30 2021, 12:54 PM
fmayer updated this revision to Diff 356664.Jul 6 2021, 3:28 AM
fmayer marked 2 inline comments as done.

Address comments.

This revision was automatically updated to reflect the committed changes.