This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Allow option to build with asan/tsan/ubsan
ClosedPublic

Authored by aeubanks on Sep 21 2020, 4:29 PM.

Diff Detail

Event Timeline

aeubanks created this revision.Sep 21 2020, 4:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2020, 4:29 PM
aeubanks requested review of this revision.Sep 21 2020, 4:29 PM
aeubanks updated this revision to Diff 293282.

format

I got asan to fire on some out of bounds stuff with this change, but couldn't get ubsan to trigger on integer overflow for some reason. -fsanitize=undefined is in the ninja files, so maybe I just didn't trip it in the right way.

I got asan to fire on some out of bounds stuff with this change, but couldn't get ubsan to trigger on integer overflow for some reason. -fsanitize=undefined is in the ninja files, so maybe I just didn't trip it in the right way.

maybe because "-fsanitize=local-bounds is not included in -fsanitize=undefined" https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html

I got asan to fire on some out of bounds stuff with this change, but couldn't get ubsan to trigger on integer overflow for some reason. -fsanitize=undefined is in the ninja files, so maybe I just didn't trip it in the right way.

I assume you are asking about the same code which triggers asan and you expect some ubsan report there.
Never mind if the question was about -fsanitize=signed-integer-overflow

I got asan to fire on some out of bounds stuff with this change, but couldn't get ubsan to trigger on integer overflow for some reason. -fsanitize=undefined is in the ninja files, so maybe I just didn't trip it in the right way.

I assume you are asking about the same code which triggers asan and you expect some ubsan report there.
Never mind if the question was about -fsanitize=signed-integer-overflow

Poorly worded on my part, I meant -fsanitize=signed-integer-overflow on different code. (I was trying to repro a bot failure caught by ubsan but couldn't repro it with this, I was wondering if I got something wrong, but separately was able to get asan to trigger on some bad code, so at least I know that the flags are probably correct)

rnk added a comment.Sep 22 2020, 10:54 AM

Looks good to me. My only question is whether to optimistically assume these work out of the box on Mac, and to relax the asserts. Let's wait for input from Nico, though.

thakis accepted this revision.Sep 23 2020, 10:23 AM

I believe I used this (by hacking up the gn files) locally on mac a while ago, but I'm not sure. LG, I'll try asan on mac and relax the assert if it works.

Naming-wise, it's maybe unclear if use_?san turns on the sanitizer for building llvm itself or for the output of clang or what, but it's consistent with the existing is_clang so maybe let's not worry about this too much for now.

This revision is now accepted and ready to land.Sep 23 2020, 10:23 AM
This revision was automatically updated to reflect the committed changes.