This is an archive of the discontinued LLVM Phabricator instance.

Test triangle inheritance member poisoning
ClosedPublic

Authored by nmusgrave on Aug 13 2015, 5:29 PM.

Diff Detail

Event Timeline

nmusgrave updated this revision to Diff 32116.Aug 13 2015, 5:29 PM
nmusgrave retitled this revision from to Test triangle inheritance member poisoning.
nmusgrave updated this object.
nmusgrave added reviewers: eugenis, kcc.
eugenis edited edge metadata.Aug 13 2015, 5:57 PM

Please run through clang-format.
Also, the title should say "diamond", not "triangle" inheritance.
And you probably want to test shadow in all destructors, otherwise this test does not do much.

test/msan/dtor-multiple-inheritance.cc
69

typo: d->w

nmusgrave updated this revision to Diff 32181.Aug 14 2015, 1:53 PM
nmusgrave edited edge metadata.
  • testing virtual functions and virtual bases poisoning proper size
  • Runtime testing of destroying diamond inheritance
nmusgrave updated this revision to Diff 32182.Aug 14 2015, 1:55 PM
nmusgrave marked an inline comment as done.

Removed changes to previous test file

nmusgrave updated this revision to Diff 32183.Aug 14 2015, 1:57 PM
  • Removing more changes to previous test file
nmusgrave updated this revision to Diff 32184.Aug 14 2015, 1:59 PM
  • linted test file
nmusgrave updated this revision to Diff 32185.Aug 14 2015, 2:00 PM
  • removed extraneous comments
nmusgrave updated this revision to Diff 32204.Aug 14 2015, 5:10 PM
  • fixed filecheck
nmusgrave updated this revision to Diff 32359.Aug 17 2015, 5:11 PM

Explicit testing for 0 optimizations.

I'd remove all testing of pointer values, like this one:
(&d->y_ptr, sizeof(d->y_ptr))

It does not add any value and only makes the test longer. The interesting ones are x, y, z and w.

nmusgrave updated this revision to Diff 32596.Aug 19 2015, 12:47 PM
  • Simplify test to only test interesting values.

LGTM but please wait until the implementation in clang is submitted

eugenis edited subscribers, added: llvm-commits; removed: cfe-commits.

+llvm-commits (please don't forget adding llvm-commits or cfe-commits (as appropriate) to the subscribers).

nmusgrave updated this revision to Diff 32618.Aug 19 2015, 2:17 PM
  • Removed linting errors on FileCheck directives.
nmusgrave updated this revision to Diff 32870.Aug 21 2015, 3:09 PM
  • Test poisoning on multiple inheritance with nontrivial and trivial members.

Verify that sanitization on member-by-member basis correctly poisons
trivial members, and skips nontrivial members.

nmusgrave updated this revision to Diff 32872.Aug 21 2015, 3:27 PM
  • Removed unnecessary header.
nmusgrave updated this revision to Diff 33958.Sep 3 2015, 11:18 AM
  • Testing (anonymous/)bit fields.
eugenis added inline comments.Sep 3 2015, 11:27 AM
test/msan/dtor-bit-fields.cc
2

Please remove this in all new tests:

%t.out 2>&1

This is not needed when not running FileCheck, and can make failure logs less verbose.

24

Add a TODO to remove these empty destructors once the problem is fixed.

49

UB, a destructor is called twice.

nmusgrave marked 2 inline comments as done.Sep 3 2015, 11:30 AM
nmusgrave added inline comments.
test/msan/dtor-bit-fields.cc
49

I know the destructor is invoked here and when main exits, but how is that undefined behavior?

eugenis added inline comments.Sep 3 2015, 11:33 AM
test/msan/dtor-bit-fields.cc
49

The second destructor call qualifies as access after the end of the object lifetime, I think. That's exactly what we are trying to detect here; in this simple case the destructor does not actually read the object memory, so we do not catch the problem.

nmusgrave updated this revision to Diff 33962.Sep 3 2015, 11:40 AM
  • Revised object instantiation in test to avoid undefined behavior.
nmusgrave marked 2 inline comments as done.Sep 3 2015, 11:46 AM
eugenis accepted this revision.Sep 3 2015, 3:37 PM
eugenis edited edge metadata.
eugenis added inline comments.
test/msan/dtor-bit-fields.cc
2

Please remove this in other 2 tests as well.

This revision is now accepted and ready to land.Sep 3 2015, 3:37 PM
nmusgrave closed this revision.Sep 3 2015, 4:08 PM