forked from OSchip/llvm-project
d954601f63
Clang's control flow integrity implementation works by conceptually attaching "tags" (in the form of bitset entries) to each virtual table, identifying the names of the classes that the virtual table is compatible with. Under the Itanium ABI, it is simple to assign tags to virtual tables; they are simply the address points, which are available via VTableLayout. Because any overridden methods receive an entry in the derived class's virtual table, a check for an overridden method call can always be done by checking the tag of whichever derived class overrode the method call. The Microsoft ABI is a little different, as it does not directly use address points, and overrides in a derived class do not cause new virtual table entries to be added to the derived class; instead, the slot in the base class is reused, and the compiler needs to adjust the this pointer at the call site to (generally) the base class that initially defined the method. After the this pointer has been adjusted, we cannot check for the derived class's tag, as the virtual table may not be compatible with the derived class. So we need to determine which base class we have been adjusted to. Specifically, at each call site, we use ASTRecordLayout to identify the most derived class whose virtual table is laid out at the "this" pointer offset we are using to make the call, and check the virtual table for that tag. Because address point information is unavailable, we "reconstruct" it as follows: any virtual tables we create for a non-derived class receive a tag for that class, and virtual tables for a base class inside a derived class receive a tag for the base class, together with tags for any derived classes which are laid out at the same position as the derived class (and therefore have compatible virtual tables). Differential Revision: http://reviews.llvm.org/D10520 llvm-svn: 240117 |
||
---|---|---|
.. | ||
APValue.cpp | ||
ASTConsumer.cpp | ||
ASTContext.cpp | ||
ASTDiagnostic.cpp | ||
ASTDumper.cpp | ||
ASTImporter.cpp | ||
ASTTypeTraits.cpp | ||
AttrImpl.cpp | ||
CMakeLists.txt | ||
CXXABI.h | ||
CXXInheritance.cpp | ||
Comment.cpp | ||
CommentBriefParser.cpp | ||
CommentCommandTraits.cpp | ||
CommentLexer.cpp | ||
CommentParser.cpp | ||
CommentSema.cpp | ||
Decl.cpp | ||
DeclBase.cpp | ||
DeclCXX.cpp | ||
DeclFriend.cpp | ||
DeclGroup.cpp | ||
DeclObjC.cpp | ||
DeclOpenMP.cpp | ||
DeclPrinter.cpp | ||
DeclTemplate.cpp | ||
DeclarationName.cpp | ||
Expr.cpp | ||
ExprCXX.cpp | ||
ExprClassification.cpp | ||
ExprConstant.cpp | ||
ExternalASTSource.cpp | ||
InheritViz.cpp | ||
ItaniumCXXABI.cpp | ||
ItaniumMangle.cpp | ||
Makefile | ||
Mangle.cpp | ||
MicrosoftCXXABI.cpp | ||
MicrosoftMangle.cpp | ||
NSAPI.cpp | ||
NestedNameSpecifier.cpp | ||
ParentMap.cpp | ||
RawCommentList.cpp | ||
RecordLayout.cpp | ||
RecordLayoutBuilder.cpp | ||
SelectorLocationsKind.cpp | ||
Stmt.cpp | ||
StmtIterator.cpp | ||
StmtPrinter.cpp | ||
StmtProfile.cpp | ||
StmtViz.cpp | ||
TemplateBase.cpp | ||
TemplateName.cpp | ||
Type.cpp | ||
TypeLoc.cpp | ||
TypePrinter.cpp | ||
VTTBuilder.cpp | ||
VTableBuilder.cpp |