Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/lib/asan/asan_fake_stack.cc
Show All 22 Lines | |||||
static const u64 kMagic4 = (kMagic2 << 16) | kMagic2; | static const u64 kMagic4 = (kMagic2 << 16) | kMagic2; | ||||
static const u64 kMagic8 = (kMagic4 << 32) | kMagic4; | static const u64 kMagic8 = (kMagic4 << 32) | kMagic4; | ||||
static const u64 kAllocaRedzoneSize = 32UL; | static const u64 kAllocaRedzoneSize = 32UL; | ||||
static const u64 kAllocaRedzoneMask = 31UL; | static const u64 kAllocaRedzoneMask = 31UL; | ||||
// For small size classes inline PoisonShadow for better performance. | // For small size classes inline PoisonShadow for better performance. | ||||
ALWAYS_INLINE void SetShadow(uptr ptr, uptr size, uptr class_id, u64 magic) { | ALWAYS_INLINE void SetShadow(uptr ptr, uptr size, uptr class_id, u64 magic) { | ||||
CHECK_EQ(SHADOW_SCALE, 3); // This code expects SHADOW_SCALE=3. | |||||
u64 *shadow = reinterpret_cast<u64*>(MemToShadow(ptr)); | u64 *shadow = reinterpret_cast<u64*>(MemToShadow(ptr)); | ||||
if (class_id <= 6) { | if (SHADOW_SCALE == 3 && class_id <= 6) { | ||||
// This code expects SHADOW_SCALE=3. | |||||
for (uptr i = 0; i < (((uptr)1) << class_id); i++) { | for (uptr i = 0; i < (((uptr)1) << class_id); i++) { | ||||
shadow[i] = magic; | shadow[i] = magic; | ||||
// Make sure this does not become memset. | // Make sure this does not become memset. | ||||
SanitizerBreakOptimization(nullptr); | SanitizerBreakOptimization(nullptr); | ||||
} | } | ||||
} else { | } else { | ||||
// The size class is too big, it's cheaper to poison only size bytes. | // The size class is too big, it's cheaper to poison only size bytes. | ||||
PoisonShadow(ptr, size, static_cast<u8>(magic)); | PoisonShadow(ptr, size, static_cast<u8>(magic)); | ||||
▲ Show 20 Lines • Show All 242 Lines • Show Last 20 Lines |