Merge changes from topic "cfi-shadow-size"
* changes: Revert "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses"" [cfi] Export __cfi_shadow_size.
This commit is contained in:
commit
fc89237b77
10 changed files with 17 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -36,6 +36,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -35,6 +35,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -35,6 +35,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -35,6 +35,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -35,6 +35,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -35,6 +35,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -35,6 +35,7 @@ LIBC_N {
|
|||
|
||||
LIBC_OMR1 { # future
|
||||
global:
|
||||
__cfi_shadow_size; # future
|
||||
__cfi_slowpath; # future
|
||||
__cfi_slowpath_diag; # future
|
||||
} LIBC_N;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue