[compiler-rt] r264068 - [tsan] Disable randomized address space on linux aarch64.

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 11:46:02 PDT 2016


Hi Yabin, 

It looks like this commit broke a lint check.  Can you take a look?  Thanks

http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/10829/consoleFull#1178388211a1ca8a51-895e-46c6-af87-ce24fa4cd561

> On Mar 22, 2016, at 10:16 AM, Yabin Cui via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: yabinc
> Date: Tue Mar 22 12:16:26 2016
> New Revision: 264068
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=264068&view=rev
> Log:
> [tsan] Disable randomized address space on linux aarch64.
> 
> Summary:
> After patch https://lkml.org/lkml/2015/12/21/340 is introduced in
> linux kernel, the random gap between stack and heap is increased
> from 128M to 36G on 39-bit aarch64. And it is almost impossible
> to cover this big range. So I think we need to disable randomized
> virtual space on aarch64 linux.
> 
> Reviewers: kcc, llvm-commits, eugenis, zatrazz, dvyukov, rengolin
> 
> Subscribers: rengolin, aemerson, tberghammer, danalbert, srhines, enh
> 
> Differential Revision: http://reviews.llvm.org/D18003
> 
> Modified:
>    compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
> 
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=264068&r1=264067&r2=264068&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Tue Mar 22 12:16:26 2016
> @@ -36,6 +36,7 @@
> #include <string.h>
> #include <stdarg.h>
> #include <sys/mman.h>
> +#include <sys/personality.h>
> #include <sys/syscall.h>
> #include <sys/socket.h>
> #include <sys/time.h>
> @@ -291,6 +292,20 @@ void InitializePlatform() {
>       SetAddressSpaceUnlimited();
>       reexec = true;
>     }
> +    // After patch "arm64: mm: support ARCH_MMAP_RND_BITS." is introduced in
> +    // linux kernel, the random gap between stack and mapped area is increased
> +    // from 128M to 36G on 39-bit aarch64. As it is almost impossible to cover
> +    // this big range, we should disable randomized virtual space on aarch64.
> +#if defined(__aarch64__)
> +    int old_personality = personality(0xffffffff);
> +    if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
> +      Report("WARNING: Program is run with randomized virtual address space,"
> +             " which wouldn't work with ThreadSanitizer.\n");
> +      Report("Re-execing with fixed virtual address space.\n");
> +      CHECK(personality(old_personality | ADDR_NO_RANDOMIZE) != -1);
> +      reexec = true;
> +    }
> +#endif
>     if (reexec)
>       ReExec();
>   }
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list