OSDN Git Service

Merge "Make default namespace handle the 'visible' flag." into oc-mr1-dev
authorTreeHugger Robot <treehugger-gerrit@google.com>
Fri, 18 Aug 2017 06:18:00 +0000 (06:18 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 18 Aug 2017 06:18:00 +0000 (06:18 +0000)
libc/private/CFIShadow.h
libdl/libdl.arm.map
libdl/libdl.arm64.map
libdl/libdl.map.txt
libdl/libdl.mips.map
libdl/libdl.mips64.map
libdl/libdl.x86.map
libdl/libdl.x86_64.map
libdl/libdl_cfi.cpp
tests/cfi_test.cpp

index 26351db..1423d86 100644 (file)
@@ -61,10 +61,8 @@ class CFIShadow {
   // Alignment of __cfi_check.
   static constexpr uintptr_t kCfiCheckAlign = 1UL << kCfiCheckGranularity;  // 4K
 
-#if defined(__aarch64__)
-  static constexpr uintptr_t kMaxTargetAddr = 0x7fffffffff;
-#elif defined (__LP64__)
-  static constexpr uintptr_t kMaxTargetAddr = 0x7fffffffffff;
+#if defined (__LP64__)
+  static constexpr uintptr_t kMaxTargetAddr = 0xffffffffffff;
 #else
   static constexpr uintptr_t kMaxTargetAddr = 0xffffffff;
 #endif
index 292bd97..9fc9d23 100644 (file)
@@ -36,6 +36,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 2fe2c7b..bde6cab 100644 (file)
@@ -35,6 +35,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 408d4dc..d1f4ab8 100644 (file)
@@ -35,6 +35,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 2fe2c7b..bde6cab 100644 (file)
@@ -35,6 +35,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 2fe2c7b..bde6cab 100644 (file)
@@ -35,6 +35,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 2fe2c7b..bde6cab 100644 (file)
@@ -35,6 +35,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 2fe2c7b..bde6cab 100644 (file)
@@ -35,6 +35,7 @@ LIBC_N {
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
index 8458564..483364f 100644 (file)
@@ -38,6 +38,11 @@ extern "C" uintptr_t* __cfi_init(uintptr_t shadow_base) {
   return &shadow_base_storage.v;
 }
 
+// Returns the size of the CFI shadow mapping, or 0 if CFI is not (yet) used in this process.
+extern "C" size_t __cfi_shadow_size() {
+  return shadow_base_storage.v != 0 ? CFIShadow::kShadowSize : 0;
+}
+
 static uint16_t shadow_load(void* p) {
   uintptr_t addr = reinterpret_cast<uintptr_t>(p);
   uintptr_t ofs = CFIShadow::MemToShadowOffset(addr);
index 5e627a7..088dda6 100644 (file)
@@ -26,6 +26,7 @@
 extern "C" {
 void __cfi_slowpath(uint64_t CallSiteTypeId, void* Ptr);
 void __cfi_slowpath_diag(uint64_t CallSiteTypeId, void* Ptr, void* DiagData);
+size_t __cfi_shadow_size();
 }
 
 static void f() {}
@@ -36,6 +37,8 @@ TEST(cfi_test, basic) {
   handle = dlopen("libcfi-test.so", RTLD_NOW | RTLD_LOCAL);
   ASSERT_TRUE(handle != nullptr) << dlerror();
 
+  EXPECT_NE(0U, __cfi_shadow_size());
+
 #define SYM(type, name) auto name = reinterpret_cast<type>(dlsym(handle, #name))
   SYM(int (*)(), get_count);
   SYM(uint64_t(*)(), get_last_type_id);