This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Do not instrument other runtime functions with `__asan_handle_no_return`
ClosedPublic

Authored by yln on Jan 30 2019, 4:45 PM.

Details

Summary

Currently, ASan inserts a call to __asan_handle_no_return before every
noreturn function call/invoke. This is unnecessary for calls to other
runtime funtions. This patch changes ASan to skip instrumentation for
functions calls marked with !nosanitize metadata.

Diff Detail

Repository
rC Clang

Event Timeline

yln created this revision.Jan 30 2019, 4:45 PM
yln set the repository for this revision to rL LLVM.
yln added a project: Restricted Project.
yln added a subscriber: llvm-commits.
mcgov added a subscriber: mcgov.Jan 30 2019, 4:57 PM
vsk added a comment.Jan 31 2019, 11:04 AM

Looks reasonable to me.

llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
3 ↗(On Diff #184410)

Could you make this more specific? E.g. 'noreturn calls that aren't inserted by sanitizers'.

Do we have a test that at most one __asan_handle_no_return call is inserted before a [[noreturn]] call?

Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2019, 4:35 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
yln updated this revision to Diff 184648.Jan 31 2019, 5:17 PM

Improve comments.
Use CHECK-NEXT in test to ensure we insert exactly one handler call.

Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2019, 5:17 PM
yln marked an inline comment as done.Jan 31 2019, 5:17 PM
eugenis accepted this revision.Jan 31 2019, 6:20 PM

LGTM

This revision is now accepted and ready to land.Jan 31 2019, 6:20 PM
yln added a comment.Feb 1 2019, 11:38 AM

@vsk Any more comments?

vsk accepted this revision.Feb 1 2019, 12:38 PM

Thanks, lgtm!

This revision was automatically updated to reflect the committed changes.