[compiler-rt] r276299 - [compiler-rt] Fix memmove/memcpy overlap detection on windows
Bruno Cardoso Lopes via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 22 16:13:21 PDT 2016
It's still failing on the greendragon:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/20456
Had to revert again in r276490 =(
I bisect it and everything points to r276299 + r276311!
On Thu, Jul 21, 2016 at 11:53 AM, Lang Hames via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Fixed - we're compiling successfully now. Thanks very much Etienne. :)
>
> - Lang.
>
> On Thu, Jul 21, 2016 at 11:04 AM, Etienne Bergeron <etienneb at google.com>
> wrote:
>>
>> Got it, the way these macros are defined is not the same on Apple.
>> I'm landing the fix. Could you check everything is fine. Ping me if it is
>> still broken.
>>
>> ```
>> #if !defined(__APPLE__)
>> # define PTR_TO_REAL(x) real_##x
>> # define REAL(x) __interception::PTR_TO_REAL(x)
>> # define FUNC_TYPE(x) x##_f
>>
>> # define DECLARE_REAL(ret_type, func, ...) \
>> typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \
>> namespace __interception { \
>> extern FUNC_TYPE(func) PTR_TO_REAL(func); \
>> }
>> # define ASSIGN_REAL(dst, src) REAL(dst) = REAL(src)
>> #else // __APPLE__
>> # define REAL(x) x
>> # define DECLARE_REAL(ret_type, func, ...) \
>> extern "C" ret_type func(__VA_ARGS__);
>> // This is not working on Apple.
>> # define ASSIGN_REAL(x, y) CHECK(false)
>> #endif // __APPLE__
>> ```
>>
>> On Thu, Jul 21, 2016 at 1:50 PM, Etienne Bergeron <etienneb at google.com>
>> wrote:
>>>
>>> I'm on it. Sorry for the delay.
>>>
>>> On Thu, Jul 21, 2016 at 1:10 PM, Lang Hames <lhames at gmail.com> wrote:
>>>>
>>>> Hi Etienne,
>>>>
>>>> This appears to have caused a compile failure on the bots:
>>>> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/22924/
>>>>
>>>> Could you please investigate and fix or revert as necessary?
>>>>
>>>> Cheers,
>>>> Lang.
>>>>
>>>>
>>>> On Thu, Jul 21, 2016 at 9:06 AM, Etienne Bergeron via llvm-commits
>>>> <llvm-commits at lists.llvm.org> wrote:
>>>>>
>>>>> Author: etienneb
>>>>> Date: Thu Jul 21 11:06:54 2016
>>>>> New Revision: 276299
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=276299&view=rev
>>>>> Log:
>>>>> [compiler-rt] Fix memmove/memcpy overlap detection on windows
>>>>>
>>>>> Summary:
>>>>> The memcpy and memmove functions are the same on windows.
>>>>> The overlap detection logic is incorrect.
>>>>>
>>>>> printf-1 test:
>>>>> ```
>>>>> stdin>:2:114: note: possible intended match here
>>>>> ==877412==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges
>>>>> [0x0000002bf2a8,0x0000002bf2ad) and [0x0000002bf2a9, 0x0000002bf2ae) overlap
>>>>> ```
>>>>> ^
>>>>>
>>>>> Reviewers: rnk
>>>>>
>>>>> Subscribers: llvm-commits, wang0109, kubabrecka, chrisha
>>>>>
>>>>> Differential Revision: https://reviews.llvm.org/D22610
>>>>>
>>>>> Modified:
>>>>> compiler-rt/trunk/lib/asan/asan_interceptors.cc
>>>>> compiler-rt/trunk/lib/asan/tests/asan_str_test.cc
>>>>>
>>>>> Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=276299&r1=276298&r2=276299&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
>>>>> +++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Thu Jul 21 11:06:54
>>>>> 2016
>>>>> @@ -725,11 +725,12 @@ void InitializeAsanInterceptors() {
>>>>> InitializeCommonInterceptors();
>>>>>
>>>>> // Intercept mem* functions.
>>>>> - ASAN_INTERCEPT_FUNC(memcpy);
>>>>> ASAN_INTERCEPT_FUNC(memset);
>>>>> + ASAN_INTERCEPT_FUNC(memmove);
>>>>> if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) {
>>>>> - // In asan, REAL(memmove) is not used, but it is used in msan.
>>>>> - ASAN_INTERCEPT_FUNC(memmove);
>>>>> + ASAN_INTERCEPT_FUNC(memcpy);
>>>>> + } else {
>>>>> + REAL(memcpy) = REAL(memmove);
>>>>> }
>>>>> CHECK(REAL(memcpy));
>>>>>
>>>>>
>>>>> Modified: compiler-rt/trunk/lib/asan/tests/asan_str_test.cc
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_str_test.cc?rev=276299&r1=276298&r2=276299&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- compiler-rt/trunk/lib/asan/tests/asan_str_test.cc (original)
>>>>> +++ compiler-rt/trunk/lib/asan/tests/asan_str_test.cc Thu Jul 21
>>>>> 11:06:54 2016
>>>>> @@ -456,6 +456,7 @@ TEST(AddressSanitizer, StrArgsOverlapTes
>>>>> // memmove().
>>>>> #if !defined(__APPLE__) || !defined(MAC_OS_X_VERSION_10_7) || \
>>>>> (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7)
>>>>> +#if PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE
>>>>> // Check "memcpy". Use Ident() to avoid inlining.
>>>>> memset(str, 'z', size);
>>>>> Ident(memcpy)(str + 1, str + 11, 10);
>>>>> @@ -463,6 +464,7 @@ TEST(AddressSanitizer, StrArgsOverlapTes
>>>>> EXPECT_DEATH(Ident(memcpy)(str, str + 14, 15),
>>>>> OverlapErrorMessage("memcpy"));
>>>>> EXPECT_DEATH(Ident(memcpy)(str + 14, str, 15),
>>>>> OverlapErrorMessage("memcpy"));
>>>>> #endif
>>>>> +#endif
>>>>>
>>>>> // We do not treat memcpy with to==from as a bug.
>>>>> // See http://llvm.org/bugs/show_bug.cgi?id=11763.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Etienne Bergeron
>>> Chrome
>>
>>
>>
>>
>> --
>> Etienne Bergeron
>> Chrome
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
Bruno Cardoso Lopes
http://www.brunocardoso.cc
More information about the llvm-commits
mailing list