This is an archive of the discontinued LLVM Phabricator instance.

Implement CFI type checks for non-virtual calls.
ClosedPublic

Authored by pcc on Mar 31 2015, 7:09 PM.

Details

Summary

This uses the same class metadata currently used for virtual call and
cast checks.

The new flag is -fsanitize=cfi-nvcall. For consistency, the -fsanitize=cfi-vptr
flag has been renamed -fsanitize=cfi-vcall.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 23024.Mar 31 2015, 7:09 PM
pcc retitled this revision from to Implement CFI type checks for non-virtual calls..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added reviewers: kcc, jfb.
pcc added a subscriber: Unknown Object (MLST).
kcc edited edge metadata.Apr 1 2015, 1:27 PM

LGTM, but please also add compiler-rt test(s)

jfb added inline comments.Apr 1 2015, 1:46 PM
test/CodeGenCXX/cfi-nvcall.cpp
31 ↗(On Diff #23024)

Could you add a comment that explains the difference between these two calls to g(), and why the strict check looks for C specifically here whereas the non-strict one accepts A? If c is actually an A then the code is still wrong, but if it's a B then the programmer is technically wrong but a lot of code does this like LLVM itself (I think you had an explanation with examples in an email?).

pcc updated this revision to Diff 23104.Apr 1 2015, 5:08 PM
pcc edited edge metadata.
  • Add a comment regarding strictness
test/CodeGenCXX/cfi-nvcall.cpp
31 ↗(On Diff #23024)

Done

pcc added a comment.Apr 1 2015, 5:10 PM
In D8756#150707, @kcc wrote:

LGTM, but please also add compiler-rt test(s)

D8792

jfb accepted this revision.Apr 1 2015, 5:17 PM
jfb edited edge metadata.

lgtm

This revision is now accepted and ready to land.Apr 1 2015, 5:17 PM
This revision was automatically updated to reflect the committed changes.
cfe/trunk/test/CodeGenCXX/cfi-vcall.cpp