diff options
author | Reid Kleckner <rnk@google.com> | 2018-04-23 17:26:33 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-04-23 17:26:33 +0000 |
commit | 0ab84bd8d3ee0935bb5368f7db51957106c3b654 (patch) | |
tree | 3ce7fd1e955798445518f658b07eeeb135c484ff /lib/hwasan/hwasan.h | |
parent | fc39236ab190af3435460e028ef7d6028a15a254 (diff) | |
download | compiler-rt-0ab84bd8d3ee0935bb5368f7db51957106c3b654.tar.gz |
Revert r330474 - "[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt)."
This commit causes internal errors with ld.bfd 2.24. My guess is that
the ifunc usage in this commit is causing problems. This is the default
system linker on Trusty Tahr, which is from 2014. I claim it's still in
our support window. Maybe we will decide to drop support for it, but
let's get the bots green while we do the investigation and have that
discussion.
Discovered here: https://crbug.com/835864
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330619 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/hwasan/hwasan.h')
-rw-r--r-- | lib/hwasan/hwasan.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/hwasan/hwasan.h b/lib/hwasan/hwasan.h index 3c6b44f7f..604c97024 100644 --- a/lib/hwasan/hwasan.h +++ b/lib/hwasan/hwasan.h @@ -32,6 +32,16 @@ typedef u8 tag_t; +// Reasonable values are 4 (for 1/16th shadow) and 6 (for 1/64th). +const uptr kShadowScale = 4; +const uptr kShadowAlignment = 1UL << kShadowScale; + +#define MEM_TO_SHADOW_OFFSET(mem) ((uptr)(mem) >> kShadowScale) +#define MEM_TO_SHADOW(mem) ((uptr)(mem) >> kShadowScale) +#define SHADOW_TO_MEM(shadow) ((uptr)(shadow) << kShadowScale) + +#define MEM_IS_APP(mem) MemIsApp((uptr)(mem)) + // TBI (Top Byte Ignore) feature of AArch64: bits [63:56] are ignored in address // translation and can be used to store a tag. const unsigned kAddressTagShift = 56; @@ -59,6 +69,8 @@ extern int hwasan_inited; extern bool hwasan_init_is_running; extern int hwasan_report_count; +bool MemIsApp(uptr p); + bool ProtectRange(uptr beg, uptr end); bool InitShadow(); char *GetProcSelfMaps(); |