Use the proper stack aligment for the architecture. Fixes broken asan

tests on i386.
This commit is contained in:
christos 2019-01-17 20:36:51 +00:00
parent 3b6bd9f01b
commit 76718fd7da
2 changed files with 16 additions and 2 deletions

View File

@ -9,6 +9,10 @@
//
// Thread-related code.
//===----------------------------------------------------------------------===//
#define __EXPOSE_STACK
#include <sys/param.h>
#include "asan_allocator.h"
#include "asan_interceptors.h"
#include "asan_poisoning.h"
@ -221,7 +225,10 @@ bool AsanThread::GetStackFrameAccessByAddr(uptr addr,
access->frame_descr = (const char *)((uptr*)bottom)[1];
return true;
}
uptr aligned_addr = addr & ~(SANITIZER_WORDSIZE/8 - 1); // align addr.
#ifndef STACK_ALIGNBYTES
# define STACK_ALIGNBYTES (~(SANITIZER_WORDSIZE/8 - 1))
#endif
uptr aligned_addr = addr & STACK_ALIGNBYTES; // align addr.
u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr);
u8 *shadow_bottom = (u8*)MemToShadow(bottom);

View File

@ -9,6 +9,10 @@
//
// Thread-related code.
//===----------------------------------------------------------------------===//
#define __EXPOSE_STACK
#include <sys/param.h>
#include "asan_allocator.h"
#include "asan_interceptors.h"
#include "asan_poisoning.h"
@ -221,7 +225,10 @@ bool AsanThread::GetStackFrameAccessByAddr(uptr addr,
access->frame_descr = (const char *)((uptr*)bottom)[1];
return true;
}
uptr aligned_addr = addr & ~(SANITIZER_WORDSIZE/8 - 1); // align addr.
#ifndef STACK_ALIGNBYTES
# define STACK_ALIGNBYTES (~(SANITIZER_WORDSIZE/8 - 1))
#endif
uptr aligned_addr = addr & STACK_ALIGNBYTES; // align addr.
u8 *shadow_ptr = (u8*)MemToShadow(aligned_addr);
u8 *shadow_bottom = (u8*)MemToShadow(bottom);