This is an archive of the discontinued LLVM Phabricator instance.

[asan] Added -inline-small-callbacks LLVM flag, which would force inline code for 8 and 16 byte data types when otherwise a callback would have been used.
AbandonedPublic

Authored by kstoimenov on Aug 18 2021, 12:42 PM.

Details

Reviewers
vitalybuka
kda
kcc
Summary

The reason to inline the 8 and 16 byte access checks is that the code for those is smaller than the 1, 2 and 4 byte checks. This allows to have a balanced, middle ground setting between size and speed.

Diff Detail

Event Timeline

kstoimenov created this revision.Aug 18 2021, 12:42 PM
kstoimenov requested review of this revision.Aug 18 2021, 12:42 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 18 2021, 12:42 PM
kcc added a comment.Aug 18 2021, 3:36 PM

What's the code size implications?

clang/test/CodeGen/asan-use-callbacks.cpp
15

As we introduce a difference in behavior for small and large accesses,
I would extend this test to have 1, 2, 4, and 16-byte accesses.

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
310

The flag semantics are weird. We first say "use callbacks", then we say "but not for small callbacks".
Perhaps, instead, introduce a flag asan-short-instrumentation-with-call-threshold
and when present use this flag for 8/16 instead of the asan-instrumentation-with-call-threshold?

1749

perhaps move this logic to where UseCalls is computed initially?
(see my other comment too)

1751

for single-statement if bodies this code base does not use {}

vitalybuka added inline comments.Aug 19 2021, 2:18 AM
clang/test/CodeGen/asan-use-callbacks.cpp
15

changes in llvm/lib should be tested in corresponding llvm/test, not clang/test

vitalybuka requested changes to this revision.Aug 20 2021, 12:54 PM
This revision now requires changes to proceed.Aug 20 2021, 12:54 PM
kstoimenov abandoned this revision.Aug 24 2021, 12:25 PM