Page MenuHomePhabricator

[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.Mon, May 17, 12:04 PM
vitalybuka added inline comments.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556–2559
This revision is now accepted and ready to land.Mon, May 17, 12:04 PM
condy updated this revision to Diff 346055.Mon, May 17, 11:32 PM

Update as suggected

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

Updated

MaskRay accepted this revision.Wed, May 19, 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.Wed, May 19, 2:14 PM
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
2556

Agree, <= cutoff looks better here

vitalybuka added a comment.EditedWed, May 19, 2:15 PM

Do you need help with landing this?

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

Apply optimization when SizeInBytes <= MinRZ/2

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