This is an archive of the discontinued LLVM Phabricator instance.

Fix `asan/TestCases/Darwin/scrible.cpp` to work on platforms where `long` is not 64-bits.
ClosedPublic

Authored by delcypher on Sep 7 2021, 6:31 PM.

Details

Summary

Previously the test was failing on platforms where long was less than
64-bits wide (e.g. older WatchOS simulators and arm64_32) because the
padding field was too small.

The test currently relies on the my_object->isa being scribbled or
left unmodified after my_object is freed. However, this was not the
case because the isa pointer intersected with
ChunkHeader::free_context_id. free_context_id starts at the
beginning of user memory but it only initialized once the memory is
freed. This caused the isa pointer to change after it was freed
leading to the test crashing.

To fix this the padding field has been made explicitly 64-bits wide
(same size as ChunkHeader::free_context_id).

rdar://75806757

Diff Detail

Event Timeline

delcypher created this revision.Sep 7 2021, 6:31 PM
delcypher requested review of this revision.Sep 7 2021, 6:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 7 2021, 6:31 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
aralisza accepted this revision.Sep 7 2021, 6:48 PM
This revision is now accepted and ready to land.Sep 7 2021, 6:48 PM
This revision was landed with ongoing or failed builds.Sep 8 2021, 9:53 AM
This revision was automatically updated to reflect the committed changes.