[cfi] Fix handling of uninstrumented libraries.

CFI shadow for non-CFI libraries should be "unchecked", not "invalid".

llvm-svn: 256285
This commit is contained in:
Evgeniy Stepanov 2015-12-22 21:40:09 +00:00
parent 30747f72eb
commit f02b782aa7
2 changed files with 6 additions and 1 deletions

View File

@ -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);
}
}
}

View File

@ -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.