This is an archive of the discontinued LLVM Phabricator instance.

[HWASAN] Support short granules in __hwasan_test_shadow
ClosedPublic

Authored by vitalybuka on Apr 28 2023, 12:34 AM.

Diff Detail

Event Timeline

vitalybuka created this revision.Apr 28 2023, 12:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2023, 12:34 AM
Herald added a subscriber: Enna1. · View Herald Transcript
vitalybuka requested review of this revision.Apr 28 2023, 12:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2023, 12:34 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
thurston added inline comments.Apr 28 2023, 9:32 AM
compiler-rt/lib/hwasan/hwasan.cpp
469–473
if (LIKELY(tail_sz <= short_size))
  return -1;

sptr offset = sz - tail_sz + short_size;
return offset < 0 ? 0 : offset;

The condition that tail_sz <= short_size makes it impossible for 'offset < 0' (other than if overflow happens? - that should have stricter handling than simply returning a zero offset)

vitalybuka added inline comments.Apr 28 2023, 9:39 AM
compiler-rt/lib/hwasan/hwasan.cpp
469–473

Note that can be "sz < tail_sz" when unaligned begin and end in the same granule.

thurston accepted this revision.Apr 28 2023, 9:51 AM
This revision is now accepted and ready to land.Apr 28 2023, 9:51 AM
vitalybuka reopened this revision.Apr 28 2023, 5:39 PM
This revision is now accepted and ready to land.Apr 28 2023, 5:39 PM
vitalybuka reopened this revision.Apr 28 2023, 6:32 PM
This revision is now accepted and ready to land.Apr 28 2023, 6:32 PM