summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-17 19:15:54 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2015-09-17 19:15:54 +0000
commit6e663a1e3208f964b7b72be136aad268207c9761 (patch)
treedc0e1b8c8143ea4f4eba37a4844945cb8769dbb3 /compiler-rt/lib
parentd2e2137b4c2603934fcbdc321359009b2df65b17 (diff)
downloadbcm5719-llvm-6e663a1e3208f964b7b72be136aad268207c9761.tar.gz
bcm5719-llvm-6e663a1e3208f964b7b72be136aad268207c9761.zip
Revert "ubsan: Implement memory permission validation for vtables."
This reverts r247484 and two follow-up commits. Breaks ppc and x86_64 sanitizer bots. llvm-svn: 247921
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r--compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc39
1 files changed, 0 insertions, 39 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc
index 3687c533e99..b84e88d4c71 100644
--- a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc
+++ b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc
@@ -17,7 +17,6 @@
#include "ubsan_type_hash.h"
#include "sanitizer_common/sanitizer_common.h"
-#include "sanitizer_common/sanitizer_procmaps.h"
// The following are intended to be binary compatible with the definitions
// given in the Itanium ABI. We make no attempt to be ODR-compatible with
@@ -192,45 +191,7 @@ struct VtablePrefix {
/// The type_info object describing the most-derived class type.
std::type_info *TypeInfo;
};
-
-#if SANITIZER_LINUX && !defined(__powerpc64__)
-bool isValidVptr(void *Vtable) {
- // Validate the memory permissions of the vtable pointer and the first
- // function pointer in the vtable. They should be r-- or r-x and r-x
- // respectively. Only enabled for Linux; this hasn't been tested on FreeBSD,
- // and vtables are writable on Mac (PR24782) so this won't work there.
- uptr FirstFunctionPtr = *reinterpret_cast<uptr *>(Vtable);
- bool ValidVtable = false, ValidFirstFunctionPtr = false;
- MemoryMappingLayout Layout(/*cache_enabled=*/true);
- uptr Start, End, Prot;
- while (Layout.Next(&Start, &End, 0, 0, 0, &Prot)) {
- if (Start <= ((uptr)Vtable) && ((uptr)Vtable) <= End &&
- (Prot == MemoryMappingLayout::kProtectionRead ||
- Prot == (MemoryMappingLayout::kProtectionRead |
- MemoryMappingLayout::kProtectionExecute)))
- ValidVtable = true;
- if (Start <= FirstFunctionPtr && FirstFunctionPtr <= End &&
- Prot == (MemoryMappingLayout::kProtectionRead |
- MemoryMappingLayout::kProtectionExecute))
- ValidFirstFunctionPtr = true;
- if (ValidVtable && ValidFirstFunctionPtr)
- return true;
- }
- return false;
-}
-#else // !SANITIZER_LINUX || __powerpc64__
-bool isValidVptr(void *Vtable) {
- return true;
-}
-#endif
-
VtablePrefix *getVtablePrefix(void *Vtable) {
- if (!IsAccessibleMemoryRange((uptr)Vtable, sizeof(void *)))
- return 0;
-
- if (!isValidVptr(Vtable))
- return 0;
-
VtablePrefix *Vptr = reinterpret_cast<VtablePrefix*>(Vtable);
if (!Vptr)
return 0;
OpenPOWER on IntegriCloud