summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-12-22 21:40:09 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-12-22 21:40:09 +0000
commitea15da9a96b8e31612a631221b4342a3eed63d9a (patch)
tree00ea0f21d0dfe1868f1bc5fb7586ab9b38e59cf1
parent32f16ac9c2115863331d5615f9472e93cd6d072b (diff)
downloadcompiler-rt-ea15da9a96b8e31612a631221b4342a3eed63d9a.tar.gz
[cfi] Fix handling of uninstrumented libraries.
CFI shadow for non-CFI libraries should be "unchecked", not "invalid". git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256285 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/cfi/cfi.cc2
-rw-r--r--test/cfi/cross-dso/simple-fail.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/cfi/cfi.cc b/lib/cfi/cfi.cc
index e6249e606..0e2a09190 100644
--- a/lib/cfi/cfi.cc
+++ b/lib/cfi/cfi.cc
@@ -176,7 +176,7 @@ static int dl_iterate_phdr_cb(dl_phdr_info *info, size_t size, void *data) {
VReport(1, " %zx .. %zx\n", cur_beg, cur_end);
fill_shadow(cur_beg, cur_end, cfi_check ? cfi_check : (uptr)(-1));
} else {
- fill_shadow_constant(cur_beg, cur_end, kInvalidShadow);
+ fill_shadow_constant(cur_beg, cur_end, kUncheckedShadow);
}
}
}
diff --git a/test/cfi/cross-dso/simple-fail.cpp b/test/cfi/cross-dso/simple-fail.cpp
index dda57d2a8..64db288a9 100644
--- a/test/cfi/cross-dso/simple-fail.cpp
+++ b/test/cfi/cross-dso/simple-fail.cpp
@@ -23,6 +23,11 @@
// RUN: %t5 2>&1 | FileCheck --check-prefix=NCFI %s
// RUN: %t5 x 2>&1 | FileCheck --check-prefix=NCFI %s
+// RUN: %clangxx -DBM -DSHARED_LIB %s -fPIC -shared -o %t6-so.so
+// RUN: %clangxx_cfi_dso -DBM %s -o %t6 %t6-so.so
+// RUN: %t6 2>&1 | FileCheck --check-prefix=NCFI %s
+// RUN: %t6 x 2>&1 | FileCheck --check-prefix=NCFI %s
+
// Tests that the CFI mechanism crashes the program when making a virtual call
// to an object of the wrong class but with a compatible vtable, by casting a
// pointer to such an object and attempting to make a call through it.