Page MenuHomePhabricator

[asan][clang] Add flag to outline instrumentation
ClosedPublic

Authored by kstoimenov on Jul 9 2021, 12:47 PM.

Details

Summary

Summary This option can be used to reduce the size of the
binary. The trade-off in this case would be the run-time
performance.

Diff Detail

Event Timeline

kstoimenov created this revision.Jul 9 2021, 12:47 PM
kstoimenov requested review of this revision.Jul 9 2021, 12:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2021, 12:47 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
vitalybuka added a subscriber: kcc.Jul 9 2021, 1:05 PM

Why do we need this? I thought the plan to have instrumentation with better callbacks which will be small and close to efficiency to inlined instrumentation. In this case we will make it default and can avoid another frontend switch?
cc @kcc

kstoimenov removed a reviewer: kda.Jul 13 2021, 8:19 AM
kstoimenov added a subscriber: kda.
vitalybuka accepted this revision.Jul 13 2021, 11:22 AM
This revision is now accepted and ready to land.Jul 13 2021, 11:22 AM
vitalybuka requested changes to this revision.Jul 13 2021, 11:41 AM

I took another looks and noticed:
also clang/docs/UsersManual.rst
and maybe clang/docs/AddressSanitizer.rst
also could you add some trivial test that the flag affects generated code, similar to clang/test/CodeGen/asan-use-after-return.cpp

This revision now requires changes to proceed.Jul 13 2021, 11:41 AM

Modified UsersManual.rst and added a test. Couldn't find a relevant section in
AddressSanitizer.rst and adding a new one is outside of the scope of this change.

Modified UsersManual.rst and added a test. Couldn't find a relevant section in
AddressSanitizer.rst and adding a new one is outside of the scope of this change.

something like:
Limitations
....
AddressSanitizer increases binary size. Use -fsanitize-address-instrument... to reduce the overhead.

clang/docs/UsersManual.rst
1652

Here "Callback" here does not match common meaning of this term and it's just out internal detail.

-f[no-]sanitize-address-inline-instrumentation
or even
-f[no-]sanitize-address-inline
or
-f[no-]sanitize-address-outline-instrumentation

clang/include/clang/Driver/Options.td
1564

no-

clang/test/Driver/fsanitize.c
254

Maybe test pairs to make sure the last one is selected
"-fno-sanitize- -fsanitize-"
"-fsanitize- -no-fsanitize-"

Addressed comments.

kstoimenov marked 3 inline comments as done.Jul 14 2021, 12:06 PM
vitalybuka accepted this revision.Jul 14 2021, 12:08 PM

Thanks, LGTM.
Do you have commit access?

This revision is now accepted and ready to land.Jul 14 2021, 12:08 PM
vitalybuka retitled this revision from Added fsanitize-address-instrument-via-callback, which controls if address sanitizer will always use a callback. to [asan][clang] Added flag to outline outlining.Jul 14 2021, 12:39 PM
vitalybuka edited the summary of this revision. (Show Details)
vitalybuka retitled this revision from [asan][clang] Added flag to outline outlining to [asan][clang] Add flag to outline instrumentation.
This revision was landed with ongoing or failed builds.Jul 14 2021, 1:36 PM
This revision was automatically updated to reflect the committed changes.