From bfdb9b2ec68f3f9997724bd6c3bb593576ee8f16 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 11 Nov 2013 09:27:20 +0000 Subject: [PATCH] [msan] Sanity check for non-PIE. llvm-svn: 194370 --- compiler-rt/lib/msan/msan_linux.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler-rt/lib/msan/msan_linux.cc b/compiler-rt/lib/msan/msan_linux.cc index ff5fc735bf16..46f501e488c5 100644 --- a/compiler-rt/lib/msan/msan_linux.cc +++ b/compiler-rt/lib/msan/msan_linux.cc @@ -45,6 +45,12 @@ static const uptr kOriginsBeg = kBad2Beg; static const uptr kOriginsEnd = kBad2End; bool InitShadow(bool prot1, bool prot2, bool map_shadow, bool init_origins) { + if ((uptr) & InitShadow < kMemBeg) { + Printf("FATAL: Code below application range: %p < %p. Non-PIE build?\n", + &InitShadow, (void *)kMemBeg); + return false; + } + if (common_flags()->verbosity) { Printf("__msan_init %p\n", &__msan_init); Printf("Memory : %p %p\n", kMemBeg, kMemEnd);