[PATCH] Insert poisoned paddings between fields in C++ classes.

Kostya Serebryany kcc at google.com
Wed Oct 8 17:04:22 PDT 2014


Hi samsonov, rnk, rsmith,

In the current state the change is not for commit
(it has several FIXMEs that need to be resolved,
then the tests will need to be added).
A this point I only want to ask you if the approach makes sence
and I've chosen the correct places to implement it.
Please also comment the FIXMEs if you have ideas.

The general approach is to add extra paddings after every field
(except for the last one) in AST/RecordLayoutBuilder.cpp,
then add code to CTORs/DTORs that poisons the paddings
(CodeGen/CGClass.cpp).

This uses a flag -fsanitize-address-field-padding that is under
review separately in http://reviews.llvm.org/D5676

See also https://code.google.com/p/address-sanitizer/wiki/IntraObjectOverflow

http://reviews.llvm.org/D5687

Files:
  lib/AST/RecordLayoutBuilder.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CodeGenFunction.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5687.14613.patch
Type: text/x-patch
Size: 9433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141009/a218c7ba/attachment.bin>


More information about the cfe-commits mailing list