Commit 129fac28 authored by Chris Palmer's avatar Chris Palmer Committed by Commit Bot

Enable the Oilpan metadata canary in production builds.

BUG=633030

Change-Id: Iaa27af5e6d3b4b55d11e044dc57e23dcf0682b39
Reviewed-on: https://chromium-review.googlesource.com/846356Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Chris Palmer <palmer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532084}
parent d7cc06cf
...@@ -981,7 +981,7 @@ NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::IsValidOrZapped() const { ...@@ -981,7 +981,7 @@ NO_SANITIZE_ADDRESS inline bool HeapObjectHeader::IsValidOrZapped() const {
NO_SANITIZE_ADDRESS inline void HeapObjectHeader::CheckHeader() const { NO_SANITIZE_ADDRESS inline void HeapObjectHeader::CheckHeader() const {
#if defined(ARCH_CPU_64_BITS) #if defined(ARCH_CPU_64_BITS)
DCHECK(IsValid()); CHECK(IsValid());
#endif #endif
} }
...@@ -1034,14 +1034,14 @@ inline uint32_t GetRandomMagic() { ...@@ -1034,14 +1034,14 @@ inline uint32_t GetRandomMagic() {
#pragma warning(disable : 4319) #pragma warning(disable : 4319)
#endif #endif
const uintptr_t random1 = ~(RotateLeft16(reinterpret_cast<uintptr_t>( static const uintptr_t random1 = ~(RotateLeft16(reinterpret_cast<uintptr_t>(
base::trace_event::MemoryAllocatorDump::kNameSize))); base::trace_event::MemoryAllocatorDump::kNameSize)));
#if defined(OS_WIN) #if defined(OS_WIN)
const uintptr_t random2 = static const uintptr_t random2 =
~(RotateLeft16(reinterpret_cast<uintptr_t>(::ReadFile))); ~(RotateLeft16(reinterpret_cast<uintptr_t>(::ReadFile)));
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
const uintptr_t random2 = static const uintptr_t random2 =
~(RotateLeft16(reinterpret_cast<uintptr_t>(::read))); ~(RotateLeft16(reinterpret_cast<uintptr_t>(::read)));
#else #else
#error OS not supported #error OS not supported
...@@ -1050,14 +1050,15 @@ inline uint32_t GetRandomMagic() { ...@@ -1050,14 +1050,15 @@ inline uint32_t GetRandomMagic() {
#if defined(ARCH_CPU_64_BITS) #if defined(ARCH_CPU_64_BITS)
static_assert(sizeof(uintptr_t) == sizeof(uint64_t), static_assert(sizeof(uintptr_t) == sizeof(uint64_t),
"uintptr_t is not uint64_t"); "uintptr_t is not uint64_t");
const uint32_t random = static_cast<uint32_t>( static const uint32_t random = static_cast<uint32_t>(
(random1 & 0x0FFFFULL) | ((random2 >> 32) & 0x0FFFF0000ULL)); (random1 & 0x0FFFFULL) | ((random2 >> 32) & 0x0FFFF0000ULL));
#elif defined(ARCH_CPU_32_BITS) #elif defined(ARCH_CPU_32_BITS)
// Although we don't use heap metadata canaries on 32-bit due to memory // Although we don't use heap metadata canaries on 32-bit due to memory
// pressure, keep this code around just in case we do, someday. // pressure, keep this code around just in case we do, someday.
static_assert(sizeof(uintptr_t) == sizeof(uint32_t), static_assert(sizeof(uintptr_t) == sizeof(uint32_t),
"uintptr_t is not uint32_t"); "uintptr_t is not uint32_t");
const uint32_t random = (random1 & 0x0FFFFUL) | (random2 & 0xFFFF0000UL); static const uint32_t random =
(random1 & 0x0FFFFUL) | (random2 & 0xFFFF0000UL);
#else #else
#error architecture not supported #error architecture not supported
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment