forked from OSchip/llvm-project
[asan] poison the internal asan heap memory, just in case. Change Printf to Report when debugging globals.
llvm-svn: 146663
This commit is contained in:
parent
843e978324
commit
7fb33a3d40
|
@ -117,7 +117,7 @@ static void RegisterGlobal(const Global *g) {
|
|||
l->next = list_of_globals;
|
||||
list_of_globals = l;
|
||||
if (FLAG_report_globals >= 2)
|
||||
Printf("Added Global: beg=%p size=%ld name=%s\n",
|
||||
Report("Added Global: beg=%p size=%ld name=%s\n",
|
||||
g->beg, g->size, g->name);
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ const int kAsanStackPartialRedzoneMagic = 0xf4;
|
|||
const int kAsanStackAfterReturnMagic = 0xf5;
|
||||
const int kAsanUserPoisonedMemoryMagic = 0xf7;
|
||||
const int kAsanGlobalRedzoneMagic = 0xf9;
|
||||
const int kAsanInternalHeapMagic = 0xfe;
|
||||
|
||||
static const uintptr_t kCurrentStackFrameMagic = 0x41B58AB3;
|
||||
static const uintptr_t kRetiredStackFrameMagic = 0x45E0360E;
|
||||
|
|
|
@ -178,6 +178,8 @@ void *LowLevelAllocator::Allocate(size_t size) {
|
|||
MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
CHECK((allocated_current_ != (char*)-1) && "Can't mmap");
|
||||
allocated_end_ = allocated_current_ + size_to_allocate;
|
||||
PoisonShadow((uintptr_t)allocated_current_, size_to_allocate,
|
||||
kAsanInternalHeapMagic);
|
||||
}
|
||||
CHECK(allocated_end_ - allocated_current_ >= size);
|
||||
void *res = allocated_current_;
|
||||
|
|
Loading…
Reference in New Issue