This is an archive of the discontinued LLVM Phabricator instance.

Make sure globals created by UBSan are not instrumented by ASan.
ClosedPublic

Authored by samsonov on Jul 17 2014, 5:21 PM.

Details

Summary

This change adds description of globals created by UBSan
instrumentation (UBSan handlers, type descriptors, filenames) to
llvm.asan.globals metadata, effectively "blacklisting" them. This can
dramatically decrease the data section in binaries built with UBSan+ASan,
as UBSan tends to create a lot of handlers, and ASan instrumentation
increases the global size to at least 64 bytes.

Diff Detail

Event Timeline

samsonov updated this revision to Diff 11618.Jul 17 2014, 5:21 PM
samsonov retitled this revision from to Make sure globals created by UBSan are not instrumented by ASan..
samsonov updated this object.
samsonov edited the test plan for this revision. (Show Details)
samsonov added a reviewer: rsmith.
samsonov added subscribers: kcc, byoungyoung, Unknown Object (MLST).
rsmith added inline comments.Jul 17 2014, 5:38 PM
lib/CodeGen/CGExpr.cpp
2179–2180

I'm concerned about this one: these strings may be shared by other parts of the program, where ASan instrumentation is important. How much does instrumenting these strings cost us?

samsonov added inline comments.Jul 17 2014, 5:55 PM
lib/CodeGen/CGExpr.cpp
2179–2180

Yeah, we might get false negatives on out-of-bound access to stuff like FILE. I don't think it's a big deal, though. We already create several global strings in ASan instrumentation (including the string with filename for the global, name for the global etc.) and call setUnnamedAddr(true), allowing to merge them.

rsmith accepted this revision.Jul 17 2014, 10:11 PM
rsmith edited edge metadata.

OK, if you're not concerned about that then LGTM.

This revision is now accepted and ready to land.Jul 17 2014, 10:11 PM
samsonov closed this revision.Jul 18 2014, 10:58 AM