[compiler-rt] r256285 - [cfi] Fix handling of uninstrumented libraries.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 13:40:09 PST 2015


Author: eugenis
Date: Tue Dec 22 15:40:09 2015
New Revision: 256285

URL: http://llvm.org/viewvc/llvm-project?rev=256285&view=rev
Log:
[cfi] Fix handling of uninstrumented libraries.

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

Modified:
    compiler-rt/trunk/lib/cfi/cfi.cc
    compiler-rt/trunk/test/cfi/cross-dso/simple-fail.cpp

Modified: compiler-rt/trunk/lib/cfi/cfi.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/cfi/cfi.cc?rev=256285&r1=256284&r2=256285&view=diff
==============================================================================
--- compiler-rt/trunk/lib/cfi/cfi.cc (original)
+++ compiler-rt/trunk/lib/cfi/cfi.cc Tue Dec 22 15:40:09 2015
@@ -176,7 +176,7 @@ static int dl_iterate_phdr_cb(dl_phdr_in
         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);
       }
     }
   }

Modified: compiler-rt/trunk/test/cfi/cross-dso/simple-fail.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/cross-dso/simple-fail.cpp?rev=256285&r1=256284&r2=256285&view=diff
==============================================================================
--- compiler-rt/trunk/test/cfi/cross-dso/simple-fail.cpp (original)
+++ compiler-rt/trunk/test/cfi/cross-dso/simple-fail.cpp Tue Dec 22 15:40:09 2015
@@ -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.




More information about the llvm-commits mailing list