Page MenuHomePhabricator

CFI: blacklist STL allocate() from unrelated-casts
ClosedPublic

Authored by vlad.tsyrklevich on Aug 3 2017, 4:17 PM.

Details

Summary

Previously, STL allocators were blacklisted in compiler_rt's
cfi_blacklist.txt because they mandated a cast from void* to T* before
object initialization completed. This change moves that logic into the
front end because C++ name mangling supports a substitution compression
mechanism for symbols that makes it difficult to blacklist the mangled
symbol for allocate() using a regular expression.

Motivated by crbug.com/751385.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc added a subscriber: cfe-commits.Aug 3 2017, 4:30 PM
pcc added inline comments.
lib/CodeGen/CodeGenFunction.cpp
785 ↗(On Diff #109652)

The comment should explain why.

789 ↗(On Diff #109652)

Should this also match the C++17 allocate function which takes a single argument?

794 ↗(On Diff #109652)

Maybe better to compare against ASTContext::getSizeType(), which should return the builtin type that corresponds to size_t.

vlad.tsyrklevich marked 2 inline comments as done.

Address pcc's comments

vlad.tsyrklevich marked an inline comment as done.Aug 3 2017, 5:52 PM
vlad.tsyrklevich added inline comments.
lib/CodeGen/CodeGenFunction.cpp
789 ↗(On Diff #109652)

absolutely, thanks for catching this!

pcc accepted this revision.Aug 3 2017, 6:00 PM

LGTM

This revision is now accepted and ready to land.Aug 3 2017, 6:00 PM
This revision was automatically updated to reflect the committed changes.