diff options
| -rw-r--r-- | compiler-rt/lib/dfsan/dfsan.cc | 24 | ||||
| -rw-r--r-- | compiler-rt/lib/dfsan/dfsan.h | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/compiler-rt/lib/dfsan/dfsan.cc b/compiler-rt/lib/dfsan/dfsan.cc index 382c1b5c1a9..3b1e6c43109 100644 --- a/compiler-rt/lib/dfsan/dfsan.cc +++ b/compiler-rt/lib/dfsan/dfsan.cc @@ -96,6 +96,22 @@ SANITIZER_INTERFACE_ATTRIBUTE THREADLOCAL dfsan_label __dfsan_arg_tls[64]; // | reserved by kernel | // +--------------------+ 0x0000000000 +// On Linux/AArch64 (42-bit VMA), memory is laid out as follow: +// +// +--------------------+ 0x40000000000 (top of memory) +// | application memory | +// +--------------------+ 0x3ff00008000 (kAppAddr) +// | | +// | unused | +// | | +// +--------------------+ 0x1200000000 (kUnusedAddr) +// | union table | +// +--------------------+ 0x8000000000 (kUnionTableAddr) +// | shadow memory | +// +--------------------+ 0x0000010000 (kShadowAddr) +// | reserved by kernel | +// +--------------------+ 0x0000000000 + typedef atomic_dfsan_label dfsan_union_table_t[kNumLabels][kNumLabels]; #if defined(__x86_64__) @@ -110,9 +126,17 @@ static const uptr kUnusedAddr = kUnionTableAddr + sizeof(dfsan_union_table_t); static const uptr kAppAddr = 0xF000008000; #elif defined(__aarch64__) static const uptr kShadowAddr = 0x10000; +# if SANITIZER_AARCH64_VMA == 39 static const uptr kUnionTableAddr = 0x1000000000; +# elif SANITIZER_AARCH64_VMA == 42 +static const uptr kUnionTableAddr = 0x8000000000; +# endif static const uptr kUnusedAddr = kUnionTableAddr + sizeof(dfsan_union_table_t); +# if SANITIZER_AARCH64_VMA == 39 static const uptr kAppAddr = 0x7000008000; +# elif SANITIZER_AARCH64_VMA == 42 +static const uptr kAppAddr = 0x3ff00008000; +# endif #else # error "DFSan not supported for this platform!" #endif diff --git a/compiler-rt/lib/dfsan/dfsan.h b/compiler-rt/lib/dfsan/dfsan.h index 5a512a5cbad..df222e49bb1 100644 --- a/compiler-rt/lib/dfsan/dfsan.h +++ b/compiler-rt/lib/dfsan/dfsan.h @@ -49,7 +49,11 @@ inline dfsan_label *shadow_for(void *ptr) { #elif defined(__mips64) return (dfsan_label *) ((((uptr) ptr) & ~0xF000000000) << 1); #elif defined(__aarch64__) +# if SANITIZER_AARCH64_VMA == 39 return (dfsan_label *) ((((uptr) ptr) & ~0x7800000000) << 1); +# elif SANITIZER_AARCH64_VMA == 42 + return (dfsan_label *) ((((uptr) ptr) & ~0x3c000000000) << 1); +# endif #endif } |

