This is an archive of the discontinued LLVM Phabricator instance.

[Ubsan] link minimal Ubsan into full Ubsan
Needs ReviewPublic

Authored by sugak on Oct 30 2018, 4:38 PM.

Details

Reviewers
eugenis
pcc
kcc
Summary

This enables minimal Ubsan with other sanitizers. It's accomplished by removing restrictions of -fsanitize-minimal-runtime and linking minimal Ubsan into full Ubsan and other sanitizers where full Ubsan is used.

As discussed in [1] the motivation here is to reduce the code bloat caused by full UBsan instrumentation and allow reasonable for development diagnostics.

  1. http://lists.llvm.org/pipermail/llvm-dev/2018-October/127182.html

Diff Detail

Event Timeline

sugak created this revision.Oct 30 2018, 4:38 PM
sugak added a comment.Oct 30 2018, 4:41 PM

Hi @eugenis, I think I've implemented this as you suggested on the mailing list, please let me know if this makes sense.

Another alternative implementation could be the way it's done for scudo where the driver adds dependency onto minimal Ubsan runtime only when -fsanitize-minimal-runtime.

Now -fsanitize-minimal-runtime is confusing.
Should we rename this into something ubsan specific?

sugak added a comment.Oct 30 2018, 5:30 PM

@vitalybuka I was thinking of this too, we could rename -fsanitize-minimal-runtime flag, or convert it into something similar how -fsanitize= or -fsanitize-trap= works:

-fsanitize=bool -fsanitize-minimal=null

FYI, regarding -fsanitize-minimal-runtime it's also used for Scudo to link the lib that doesn't include RTUBsan & the symbolizer & stacktraces RT.

I agree, now that -fsanitize-minimal-runtime does not enforce that _only_ minimal runtime is used, it makes sense to split it per-sanitizer, with -fsanitize-minimal=<name>.

Do we need to add RTUBsan_minimal to SCUDO_MINIMAL_OBJECT_LIBS, or at least to SCUDO_OBJECT_LIBS?

sugak added a comment.Oct 31 2018, 3:23 PM

Great, let me create another iteration and add the -fsanitize-minimal flag, I'll see if I can split it up into small changes.