[compiler-rt] r244054 - [asan] Enable asan for aarch64

Adhemerval Zanella adhemerval.zanella at linaro.org
Wed Aug 5 08:13:33 PDT 2015


Author: azanella
Date: Wed Aug  5 10:13:33 2015
New Revision: 244054

URL: http://llvm.org/viewvc/llvm-project?rev=244054&view=rev
Log:
[asan] Enable asan for aarch64

This patch enables asan for aarch64/linux.  It marks it as 'unstable-release',
since some tests are failing due either kernel missing support of non-executable
pages in mmap or environment instability (infinite loop in juno reference
boards).

It sets decorate_proc_maps test to require stable-release, since the test expects
the shadow memory to not be executable and the support for aarch64 is only
added recently by Linux (da141706aea52c1a9 - 4.0).

It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call
as a TLS optimization.

Modified:
    compiler-rt/trunk/cmake/config-ix.cmake
    compiler-rt/trunk/lib/asan/asan_mapping.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
    compiler-rt/trunk/test/asan/TestCases/Linux/read_binary_name_regtest.c
    compiler-rt/trunk/test/asan/TestCases/Linux/static_tls.cc
    compiler-rt/trunk/test/asan/lit.cfg
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Wed Aug  5 10:13:33 2015
@@ -254,10 +254,7 @@ filter_available_targets(LSAN_COMMON_SUP
 filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH
   ${SANITIZER_COMMON_SUPPORTED_ARCH})
 filter_available_targets(ASAN_SUPPORTED_ARCH
-  x86_64 i386 i686 powerpc64 powerpc64le arm mips mipsel mips64 mips64el)
-if(ANDROID)
-  filter_available_targets(ASAN_SUPPORTED_ARCH aarch64)
-endif()
+  x86_64 i386 i686 powerpc64 powerpc64le arm mips mipsel mips64 mips64el aarch64)
 filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64 mips64 mips64el aarch64)
 filter_available_targets(LSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)
 filter_available_targets(MSAN_SUPPORTED_ARCH x86_64 mips64 mips64el)

Modified: compiler-rt/trunk/lib/asan/asan_mapping.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mapping.h?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mapping.h (original)
+++ compiler-rt/trunk/lib/asan/asan_mapping.h Wed Aug  5 10:13:33 2015
@@ -73,6 +73,13 @@
 // || `[0x2000000000, 0x23ffffffff]` || LowShadow  ||
 // || `[0x0000000000, 0x1fffffffff]` || LowMem     ||
 //
+// Default Linux/AArch64 (39-bit VMA) mapping:
+// || `[0x2000000000, 0x7fffffffff]` || highmem    ||
+// || `[0x1400000000, 0x1fffffffff]` || highshadow ||
+// || `[0x1200000000, 0x13ffffffff]` || shadowgap  ||
+// || `[0x1000000000, 0x11ffffffff]` || lowshadow  ||
+// || `[0x0000000000, 0x0fffffffff]` || lowmem     ||
+//
 // Shadow mapping on FreeBSD/x86-64 with SHADOW_OFFSET == 0x400000000000:
 // || `[0x500000000000, 0x7fffffffffff]` || HighMem    ||
 // || `[0x4a0000000000, 0x4fffffffffff]` || HighShadow ||

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Wed Aug  5 10:13:33 2015
@@ -130,7 +130,7 @@
 #define SANITIZER_USES_UID16_SYSCALLS 0
 #endif
 
-#ifdef __mips__
+#if defined(__mips__) || defined(__aarch64__)
 # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 10)
 #else
 # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12)

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/read_binary_name_regtest.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/read_binary_name_regtest.c?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/read_binary_name_regtest.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/read_binary_name_regtest.c Wed Aug  5 10:13:33 2015
@@ -14,6 +14,10 @@
 #include <linux/filter.h>
 #include <linux/seccomp.h>
 
+#ifndef __NR_readlink
+# define __NR_readlink __NR_readlinkat
+#endif
+
 #define syscall_nr (offsetof(struct seccomp_data, nr))
 
 void corrupt() {

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/static_tls.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/static_tls.cc?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/static_tls.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/static_tls.cc Wed Aug  5 10:13:33 2015
@@ -9,7 +9,7 @@
 // CHECK: __tls_get_addr: static tls
 // CHECK: after
 
-// XFAIL: powerpc64
+// XFAIL: powerpc64, aarch64
 
 #ifndef SHARED
 #include <stdio.h>

Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Wed Aug  5 10:13:33 2015
@@ -164,7 +164,7 @@ config.substitutions.append( ("%xdynamic
 
 # Allow tests to use REQUIRES=stable-runtime.  For use when you cannot use XFAIL
 # because the test hangs.
-if config.target_arch != 'arm':
+if config.target_arch != 'arm' or config.target_arch != 'aarch64':
   config.available_features.add('stable-runtime')
 
 # Turn on leak detection on 64-bit Linux.

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc?rev=244054&r1=244053&r2=244054&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc Wed Aug  5 10:13:33 2015
@@ -1,5 +1,6 @@
 // RUN: %clangxx -g %s -o %t
 // RUN: %tool_options=decorate_proc_maps=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%tool_name
+// REQUIRES: stable-release
 #include <errno.h>
 #include <fcntl.h>
 #include <pthread.h>




More information about the llvm-commits mailing list