This is an archive of the discontinued LLVM Phabricator instance.

[hwasan] Fix allocator alignment.
ClosedPublic

Authored by eugenis on May 8 2020, 4:44 PM.

Details

Summary

Fix hwasan allocator not respecting the requested alignment when it is
higher than a page, but still within primary (i.e. [2048, 65536]).

Diff Detail

Event Timeline

eugenis created this revision.May 8 2020, 4:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2020, 4:44 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cryptoad accepted this revision.May 8 2020, 6:27 PM
cryptoad added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
79–83

Since we had the discussion, I understand the need to be aligned, but maybe a comment to clarify why for later readers?

compiler-rt/lib/sanitizer_common/sanitizer_common.cpp
328 ↗(On Diff #262979)

Maybe a safe guard check that align is a power of 2?
With SizeClassMap::kMaxSize it's the case, but if it's used somewhere else, it might slip through.

This revision is now accepted and ready to land.May 8 2020, 6:27 PM
eugenis updated this revision to Diff 263267.May 11 2020, 1:49 PM

address comments

eugenis updated this revision to Diff 263295.May 11 2020, 3:34 PM

One more CHECK + fix a broken test.

This revision was automatically updated to reflect the committed changes.