[PATCH] D34233: [CFI] Add ability to explicitly link classes

Enes Goktas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 22:48:03 PDT 2017


egoktas created this revision.
egoktas created this object with visibility "All Users".

User can explicitly specify classlinks in a sanitizer blacklist file. During compilation with Control-Flow Integrity (CFI), the specified classes will be linked so that (vtables of) the class type Y can be used at virtual callsites that have the class type X. An example of a classlink in the sanitizer blacklist file would be:
 classlink:_ZTS1X=_ZTS1Y
Note that this is a one-way link. For example, if (vtables of) the class type X can be used at a virtual callsite with the class type Y, then the following line specifying the classlink should be added to the sanitizer blacklist file:
 classlink:_ZTS1Y=_ZTS1X

This is a solution for the CFI errors that can occur when there is no inheritance link between two classes but one class is used as the other at runtime.

This patch requires the new function "getEntriesInSection" in SpecialCaseList which is submitted for revision under Differential https://reviews.llvm.org/D34231.


https://reviews.llvm.org/D34233

Files:
  include/clang/Basic/SanitizerBlacklist.h
  lib/Basic/SanitizerBlacklist.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34233.102638.patch
Type: text/x-patch
Size: 5947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170615/a23a1b74/attachment-0001.bin>


More information about the cfe-commits mailing list