Patchwork libsanitizer merge from upstream r175042

login
register
mail settings
Submitter H.J. Lu
Date Feb. 13, 2013, 6:29 p.m.
Message ID <CAMe9rOp4Rmv35Hv1hDPkTY2n9JDvpyVxRpG2-eEh-xKVT48q7w@mail.gmail.com>
Download mbox | patch
Permalink /patch/220225/
State New
Headers show

Comments

H.J. Lu - Feb. 13, 2013, 6:29 p.m.
On Wed, Feb 13, 2013 at 1:19 AM, Konstantin Serebryany
<konstantin.s.serebryany@gmail.com> wrote:
> Hi,
>
> The attached patch is the libsanitizer merge from upstream r175042.
>
> Lots of changes. Among other things:
>  - x86_64 linux: change the shadow offset to 0x7fff8000 (~5% speedup)
>  - the new asan allocator is enabled on Mac (was enabled on Linux before).
>  - tsan finds races between atomic and plain accesses
>  - better scanf interceptor, enabled by default
>  - don't include linux/futex.h (fixes PR56128)
>  - simple tests seem to work (again?) on PowerPC64 with 44-bit address
> space (46 AS not tested)
>
> Patch for libsanitizer is automatically generated by libsanitizer/merge.sh
> Tested with
> rm -rf */{*/,}libsanitizer \
>   && make -j 50 \
>   && make -C gcc check-g{cc,++}
> RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} asan.exp'
>
> Our internal LLVM bots (Linux, Mac and Android) are green.
>
> Ok to commit?
>
> --kcc

This breaks build on Linux/x32 where off_t is 64bit:

In file included from
/export/gnu/import/git/gcc/libsanitizer/interception/interception.h:20:0,
                 from
/export/gnu/import/git/gcc/libsanitizer/interception/interception_type_test.cc:15:
/export/gnu/import/git/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:221:72:
error: size of array ‘assertion_failed__34’ is negative
     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                                        ^
/export/gnu/import/git/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:215:30:
note: in expansion of macro ‘IMPL_COMPILER_ASSERT’
 #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                              ^
/export/gnu/import/git/gcc/libsanitizer/interception/interception_type_test.cc:34:1:
note: in expansion of macro ‘COMPILER_CHECK’
 COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
 ^
make[7]: *** [interception_type_test.lo] Error 1

This patch fixes it.  OK to install?

Thanks.
Konstantin Serebryany - Feb. 14, 2013, 8:07 a.m.
On Wed, Feb 13, 2013 at 10:29 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Feb 13, 2013 at 1:19 AM, Konstantin Serebryany
> <konstantin.s.serebryany@gmail.com> wrote:
>> Hi,
>>
>> The attached patch is the libsanitizer merge from upstream r175042.
>>
>> Lots of changes. Among other things:
>>  - x86_64 linux: change the shadow offset to 0x7fff8000 (~5% speedup)
>>  - the new asan allocator is enabled on Mac (was enabled on Linux before).
>>  - tsan finds races between atomic and plain accesses
>>  - better scanf interceptor, enabled by default
>>  - don't include linux/futex.h (fixes PR56128)
>>  - simple tests seem to work (again?) on PowerPC64 with 44-bit address
>> space (46 AS not tested)
>>
>> Patch for libsanitizer is automatically generated by libsanitizer/merge.sh
>> Tested with
>> rm -rf */{*/,}libsanitizer \
>>   && make -j 50 \
>>   && make -C gcc check-g{cc,++}
>> RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} asan.exp'
>>
>> Our internal LLVM bots (Linux, Mac and Android) are green.
>>
>> Ok to commit?
>>
>> --kcc
>
> This breaks build on Linux/x32 where off_t is 64bit:

Sorry. I've committed your patch upstream as
http://llvm.org/viewvc/llvm-project?rev=175140&view=rev
Feel free to submit the same directly to gcc.

Thanks!

--kcc

>
> In file included from
> /export/gnu/import/git/gcc/libsanitizer/interception/interception.h:20:0,
>                  from
> /export/gnu/import/git/gcc/libsanitizer/interception/interception_type_test.cc:15:
> /export/gnu/import/git/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:221:72:
> error: size of array ‘assertion_failed__34’ is negative
>      typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
>                                                                         ^
> /export/gnu/import/git/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:215:30:
> note: in expansion of macro ‘IMPL_COMPILER_ASSERT’
>  #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
>                               ^
> /export/gnu/import/git/gcc/libsanitizer/interception/interception_type_test.cc:34:1:
> note: in expansion of macro ‘COMPILER_CHECK’
>  COMPILER_CHECK(sizeof(OFF_T) == sizeof(off_t));
>  ^
> make[7]: *** [interception_type_test.lo] Error 1
>
> This patch fixes it.  OK to install?
>
> Thanks.
>
> --
> H.J.
> ---
> diff --git a/libsanitizer/interception/interception.h
> b/libsanitizer/interception/interception.h
> index b4c4137..c4c5026 100644
> --- a/libsanitizer/interception/interception.h
> +++ b/libsanitizer/interception/interception.h
> @@ -28,8 +28,8 @@ typedef __sanitizer::s64  INTMAX_T;
>  // WARNING: OFF_T may be different from OS type off_t, depending on
> the value of
>  // _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
>  // like pread and mmap, as opposed to pread64 and mmap64.
> -// Mac is special.
> -#ifdef __APPLE__
> +// Mac and Linux/x86-64 are special.
> +#if defined(__APPLE__) || (defined(__linux__) && defined(__x86_64__))
>  typedef __sanitizer::u64 OFF_T;
>  #else
>  typedef __sanitizer::uptr OFF_T;

Patch

diff --git a/libsanitizer/interception/interception.h
b/libsanitizer/interception/interception.h
index b4c4137..c4c5026 100644
--- a/libsanitizer/interception/interception.h
+++ b/libsanitizer/interception/interception.h
@@ -28,8 +28,8 @@  typedef __sanitizer::s64  INTMAX_T;
 // WARNING: OFF_T may be different from OS type off_t, depending on
the value of
 // _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
 // like pread and mmap, as opposed to pread64 and mmap64.
-// Mac is special.
-#ifdef __APPLE__
+// Mac and Linux/x86-64 are special.
+#if defined(__APPLE__) || (defined(__linux__) && defined(__x86_64__))
 typedef __sanitizer::u64 OFF_T;
 #else