From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19061 invoked by alias); 19 Jan 2015 18:33:55 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18454 invoked by uid 48); 19 Jan 2015 18:33:47 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/64435] [5 Regression] Bootstrap failure in libsanitizer on AArch64 with Linux kernel <= 3.15 Date: Mon, 19 Jan 2015 18:33:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: build X-Bugzilla-Severity: major X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg01879.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64435 --- Comment #19 from Jakub Jelinek --- So, with: --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h.jj 2014-11-14 00:10:33.000000000 +0100 +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2015-01-19 19:22:43.777780408 +0100 @@ -167,7 +167,7 @@ namespace __sanitizer { unsigned __seq; u64 __unused1; u64 __unused2; -#elif defined(__mips__) +#elif defined(__mips__) || defined(__aarch64__) unsigned int mode; unsigned short __seq; unsigned short __pad1; --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.jj 2015-01-19 09:39:09.000000000 +0100 +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2015-01-19 19:21:57.608564325 +0100 @@ -1059,7 +1059,13 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); CHECK_SIZE_AND_OFFSET(ipc_perm, gid); CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); +#ifndef __GLIBC_PREREQ +#define __GLIBC_PREREQ(x, y) 0 +#endif +#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) +/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ CHECK_SIZE_AND_OFFSET(ipc_perm, mode); +#endif CHECK_TYPE_SIZE(shmid_ds); CHECK_SIZE_AND_OFFSET(shmid_ds, shm_perm); --- libsanitizer/sanitizer_common/sanitizer_posix.cc.jj 2014-11-14 00:10:33.000000000 +0100 +++ libsanitizer/sanitizer_common/sanitizer_posix.cc 2015-01-19 19:24:14.636237703 +0100 @@ -76,16 +76,15 @@ static uptr GetKernelAreaSize() { uptr GetMaxVirtualAddress() { #if SANITIZER_WORDSIZE == 64 -# if defined(__powerpc64__) +# if defined(__powerpc64__) || defined(__aarch64__) // On PowerPC64 we have two different address space layouts: 44- and 46-bit. // We somehow need to figure out which one we are using now and choose // one of 0x00000fffffffffffUL and 0x00003fffffffffffUL. // Note that with 'ulimit -s unlimited' the stack is moved away from the top // of the address space, so simply checking the stack address is not enough. // This should (does) work for both PowerPC64 Endian modes. + // Similarly, aarch64 has multiple address space layouts: 39, 42 and 48-bit. return (1ULL << (MostSignificantSetBitIndex(GET_CURRENT_FRAME()) + 1)) - 1; -# elif defined(__aarch64__) - return (1ULL << 39) - 1; # elif defined(__mips64) return (1ULL << 40) - 1; # else the layout looks reasonable: || `[0x009000000000, 0x03ffffffffff]` || HighMem || || `[0x002200000000, 0x008fffffffff]` || HighShadow || || `[0x001200000000, 0x0021ffffffff]` || ShadowGap || || `[0x001000000000, 0x0011ffffffff]` || LowShadow || || `[0x000000000000, 0x000fffffffff]` || LowMem || MemToShadow(shadow): 0x001200000000 0x00123fffffff 0x001440000000 0x0021ffffffff and should accomodate the different addresses I saw for 42-bit address space so far: <4GB, 0x10000000000 (place where libraries are mapped with ulimit -s unlimited), 0x2aaXXXXXXXX (PIEs), 0x3ffXXXXXXXX (stack, normal mmap area for limited ulimit -s). But it still doesn't work: ==4746==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000028 (pc 0x0000004008f8 bp 0x03fff8078fc0 sp 0x03fff8078fc0 T0) ==4746==AddressSanitizer CHECK failed: ../../../../libsanitizer/sanitizer_common/sanitizer_allocator.h:835 "((res)) < ((kNumPossibleRegions))" (0x3ffa33, 0x80000) I've tried to change #if SANITIZER_CAN_USE_ALLOCATOR64 # if defined(__powerpc64__) const uptr kAllocatorSpace = 0xa0000000000ULL; const uptr kAllocatorSize = 0x20000000000ULL; // 2T. # else const uptr kAllocatorSpace = 0x600000000000ULL; const uptr kAllocatorSize = 0x40000000000ULL; // 4T. # endif from the non-ppc64 values to the ppc64 values (i.e. added " || defined(__aarch64__)"), but strangely that didn't change anything. So I'm out of ideas on what else needs to be tweaked. Kostya?