This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Reduce redzone size for small size global objects
ClosedPublic

Authored by condy on May 14 2021, 12:06 AM.

Details

Summary

currently 1 byte global object has a ridiculous 63 bytes redzone. This patch reduces the redzone size to be less than 32 if the size of global object is less than half of 32 (the minimal size of redzone). So that a 12 bytes object has a 20 bytes redzone, a 20 bytes object has a 44 bytes redzone.

Diff Detail

Event Timeline

condy created this revision.May 14 2021, 12:06 AM
condy requested review of this revision.May 14 2021, 12:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 12:06 AM
condy edited the summary of this revision. (Show Details)May 14 2021, 12:13 AM
condy added a reviewer: Restricted Project.May 14 2021, 12:19 AM
condy updated this revision to Diff 345361.May 14 2021, 12:42 AM

Fix tests

condy updated this revision to Diff 345365.May 14 2021, 1:04 AM

Fix all tests

condy updated this revision to Diff 345386.May 14 2021, 3:44 AM

Fix clang/codegen tests

Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 3:44 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
vitalybuka accepted this revision.May 17 2021, 12:04 PM
vitalybuka added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556–2559
This revision is now accepted and ready to land.May 17 2021, 12:04 PM
condy updated this revision to Diff 346055.May 17 2021, 11:32 PM

Update as suggected

condy marked an inline comment as done.May 17 2021, 11:33 PM
condy added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556–2559

Updated

MaskRay accepted this revision.May 19 2021, 1:27 PM
MaskRay added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556

I wonder whether 16-byte array should use this optimization as well (i.e. < => <=)

@vitalybuka

vitalybuka added inline comments.May 19 2021, 2:14 PM
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556

Agree, <= cutoff looks better here

vitalybuka added a comment.EditedMay 19 2021, 2:15 PM

Do you need help with landing this?

condy updated this revision to Diff 346612.May 19 2021, 6:44 PM

Apply optimization when SizeInBytes <= MinRZ/2

condy marked 3 inline comments as done.May 19 2021, 6:48 PM
condy added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556
This revision was landed with ongoing or failed builds.May 19 2021, 7:18 PM
This revision was automatically updated to reflect the committed changes.