This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Do not unpoison stack before !nosanitize calls
AbandonedPublic

Authored by yln on Jan 23 2019, 6:24 PM.

Details

Summary

ASan inserts calls to __asan_handle_noreturn in front of all calls to noreturn
functions. This is needed for functions that move SP without going through ASan
epilogue, in order to maintain the requirement that stack below SP has clean
shadow.
(Thanks to Evgenii for the explanation.)

However, UBSan does not violate the above contract. The additional
instrumentation added by ASan before __ubsan_handle_builtin_unreachable is
therefore unnecessary. This patch changes ASan to not instrument call sites
marked with !nosanitize.

rdar://problem/40723397

Event Timeline

yln created this revision.Jan 23 2019, 6:24 PM
yln added a project: Restricted Project.Jan 23 2019, 6:28 PM
yln added a comment.Jan 23 2019, 6:33 PM

I just noticed that the previous revision was marked with

This revision was not accepted when it landed; it landed in state Needs Review.

I apologize for that. It was not my intention to land the revision before a formal accept. (Somehow I was under the impression that it was "green" already.)
Please voice it here if there is any cleanup or additional testing you want me to do.

yln retitled this revision from [ASan] Do not unpoisoning stack before !nosanitize calls to [ASan] Do not unpoison stack before !nosanitize calls.Jan 24 2019, 10:07 AM
yln added a subscriber: llvm-commits.