[PATCH] D64890: hwasan: Use C++ driver for cfi.cc test.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 15:25:58 PDT 2019


pcc created this revision.
pcc added a reviewer: eugenis.
Herald added subscribers: Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.

It turns out that this test was only passing by accident. It was relying on
the optimizer to remove the only reference to A's vtable by realizing that
the CFI check will always fail. The vtable contains a reference to RTTI in
libc++, which will be unresolved because the C driver won't link against it.

This was found by my prototype implementation of HWASAN for globals, which
happens to end up preserving the reference.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64890

Files:
  compiler-rt/test/hwasan/TestCases/cfi.cc


Index: compiler-rt/test/hwasan/TestCases/cfi.cc
===================================================================
--- compiler-rt/test/hwasan/TestCases/cfi.cc
+++ compiler-rt/test/hwasan/TestCases/cfi.cc
@@ -1,4 +1,4 @@
-// RUN: %clang_hwasan -fsanitize=cfi -fno-sanitize-trap=cfi -flto -fvisibility=hidden -fuse-ld=lld %s -o %t
+// RUN: %clangxx_hwasan -fsanitize=cfi -fno-sanitize-trap=cfi -flto -fvisibility=hidden -fuse-ld=lld %s -o %t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 // REQUIRES: android


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64890.210438.patch
Type: text/x-patch
Size: 507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190717/071d68f3/attachment.bin>


More information about the llvm-commits mailing list