Page MenuHomePhabricator

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

Authored by yln on Wed, Jan 30, 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.Wed, Jan 30, 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.Wed, Jan 30, 4:57 PM
vsk added a comment.Thu, Jan 31, 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 TranscriptThu, Jan 31, 4:35 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
yln updated this revision to Diff 184648.Thu, Jan 31, 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 TranscriptThu, Jan 31, 5:17 PM
yln marked an inline comment as done.Thu, Jan 31, 5:17 PM
eugenis accepted this revision.Thu, Jan 31, 6:20 PM

LGTM

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

@vsk Any more comments?

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

Thanks, lgtm!

This revision was automatically updated to reflect the committed changes.