[compiler-rt] r198017 - [ASan] Make sure none of the __asan_gen_ global strings end up in the symbol table, add a test.

Kostya Serebryany kcc at google.com
Mon Feb 23 11:47:41 PST 2015


I've started seeing this too.


% clang -m32 -fsanitize=address
 ~/llvm/projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c  -o
- -S -emit-llvm | grep asan_gen_.=
@__asan_gen_ = private unnamed_addr constant [16 x i8] c"1 16 4 6
retval\00", align 1
% clang -m32  -fsanitize=address
 ~/llvm/projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c  &&
nm a.out | grep asan_gen
0812bfc7 r .L__asan_gen_

Weird.

And indeed, everything is fine on x86_64

--kcc






On Tue, Feb 17, 2015 at 11:19 AM, David Blaikie <dblaikie at gmail.com> wrote:

> Still seeing this failure. Though for me, the symbol seems to appear for
> both -c and non-c:
>
> $ clang projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c  -c
> -m32  -fsanitize=address -o x.o && nm x.o | grep __asan_gen
> 00000000 r .L__asan_gen_
> $ clang projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c  -c
> -m64  -fsanitize=address -o x.o && nm x.o | grep __asan_gen
> $ clang projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c
> -fsanitize=address -o x.o && nm x.o | grep __asan_gen
> $ clang projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c
>  -m32 -fsanitize=address -o x.o && nm x.o | grep __asan_gen
> 08126ad2 r .L__asan_gen_
>
> On Thu, Dec 18, 2014 at 4:46 AM, Alexander Potapenko <glider at google.com>
> wrote:
>
>> At the same time the result of running `clang ../no_asan_gen_globals.c
>> -fsanitize=address` (without -c) doesn't contain __asan_gen for both -m32
>> and -m64
>>
>> On Thu, Dec 18, 2014 at 1:20 PM, Alexander Potapenko <glider at google.com>
>> wrote:
>>>
>>> Looks like the behavior is different for 32 and 64 bits:
>>>
>>> $ clang ../no_asan_gen_globals.c -c -fsanitize=address -m64 ; nm
>>> no_asan_gen_globals.o | grep __asan_gen
>>> # nothing here
>>> $ clang ../no_asan_gen_globals.c -c -fsanitize=address -m32 ; nm
>>> no_asan_gen_globals.o | grep __asan_gen
>>> 00000000 r .L__asan_gen_
>>>
>>>
>>> On Thu, Dec 18, 2014 at 1:38 AM, David Blaikie <dblaikie at gmail.com>
>>> wrote:
>>>>
>>>> Ping. This is still showing up for me (& one of the reasons (the main
>>>> one being increased build times) I keep removing my projects/compiler-rt
>>>> from time to time).
>>>>
>>>> On Tue, Sep 9, 2014 at 9:20 AM, David Blaikie <dblaikie at gmail.com>
>>>> wrote:
>>>>>
>>>>>>>>>>  no_asan_gen_globals.nm.txt
>>>>> <https://docs.google.com/file/d/0B0jpkch3iC_7WlYwemNsMzVuWmM/edit?usp=drive_web>
>>>>> ​​
>>>>>  no_asan_gen_globals.s
>>>>> <https://docs.google.com/file/d/0B0jpkch3iC_7QWdDbzFhbW9jVnM/edit?usp=drive_web>
>>>>> ​​
>>>>>  no_asan_gen_globals.ll
>>>>> <https://docs.google.com/file/d/0B0jpkch3iC_7eHZkeGtJX1FkSzQ/edit?usp=drive_web>
>>>>>>>>>>
>>>>> On Mon, Sep 8, 2014 at 12:45 AM, Alexander Potapenko <
>>>>> glider at google.com> wrote:
>>>>>
>>>>>> I wonder why __asan_gen_ is prefixed with "L". I'd think you were
>>>>>> targeting Darwin, but looking at the command line it isn't so.
>>>>>> The test passes for me on Ubuntu 12.04.
>>>>>> Do you have local changes in your tree?
>>>>>
>>>>>
>>>>> I don't think so.
>>>>>
>>>>>
>>>>>> Can you please post the IR and the assembly for this test?
>>>>>>
>>>>>
>>>>> Attached the assembly, IR, and the output of 'nm'. Let me know if I
>>>>> can provide more information.
>>>>>
>>>>>
>>>>>>
>>>>>> On Mon, Sep 8, 2014 at 8:37 AM, David Blaikie <dblaikie at gmail.com>
>>>>>> wrote:
>>>>>> > This test is failing for me on Linux (Ubuntu TLS 12.04 I believe) as
>>>>>> > follows:
>>>>>> >
>>>>>> >
>>>>>> /home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/./bin/clang
>>>>>> > -fsanitize=address -mno-omit-leaf-frame-pointer
>>>>>> -fno-omit-frame-pointer
>>>>>> > -fno-optimize-sibling-calls -gline-tables-only -m32
>>>>>> >
>>>>>> /mnt/fast/dev/llvm/src/projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c
>>>>>> > -o
>>>>>> >
>>>>>> /mnt/fast/dev/llvm/build/clang/debug/split/notypes/nostandalone/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/no_asan_gen_globals.c.tmp.exe
>>>>>> > nm
>>>>>> >
>>>>>> /mnt/fast/dev/llvm/build/clang/debug/split/notypes/nostandalone/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/no_asan_gen_globals.c.tmp.exe
>>>>>> > | FileCheck
>>>>>> >
>>>>>> /mnt/fast/dev/llvm/src/projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c
>>>>>> > --
>>>>>> > Exit Code: 1
>>>>>> >
>>>>>> > Command Output (stderr):
>>>>>> > --
>>>>>> > <stdin>:2011:14: error: CHECK-NOT: string occurred!
>>>>>> > 080fb9de r .L__asan_gen_
>>>>>> >              ^
>>>>>> >
>>>>>> /mnt/fast/dev/llvm/src/projects/compiler-rt/test/asan/TestCases/no_asan_gen_globals.c:11:15:
>>>>>> > note: CHECK-NOT: pattern specified here
>>>>>> > // CHECK-NOT: __asan_gen_
>>>>>> >               ^
>>>>>> >
>>>>>> >
>>>>>> > Anything ideas with what the issue is here? Something I should fix?
>>>>>> > Legitimate bug?
>>>>>> >
>>>>>> >
>>>>>> > On Wed, Dec 25, 2013 at 6:22 AM, Alexander Potapenko <
>>>>>> glider at google.com>
>>>>>> > wrote:
>>>>>> >>
>>>>>> >> Author: glider
>>>>>> >> Date: Wed Dec 25 08:22:15 2013
>>>>>> >> New Revision: 198017
>>>>>> >>
>>>>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=198017&view=rev
>>>>>> >> Log:
>>>>>> >> [ASan] Make sure none of the __asan_gen_ global strings end up in
>>>>>> the
>>>>>> >> symbol table, add a test.
>>>>>> >>
>>>>>> >> This should fix http://llvm.org/bugs/show_bug.cgi?id=17976
>>>>>> >> Another test checking for the global variables' locations and
>>>>>> prefixes on
>>>>>> >> Darwin will be committed separately.
>>>>>> >>
>>>>>> >>
>>>>>> >> Added:
>>>>>> >>
>>>>>>  compiler-rt/trunk/lib/asan/lit_tests/TestCases/no_asan_gen_globals.c
>>>>>> >> (with props)
>>>>>> >>
>>>>>> >> Added:
>>>>>> >>
>>>>>> compiler-rt/trunk/lib/asan/lit_tests/TestCases/no_asan_gen_globals.c
>>>>>> >> URL:
>>>>>> >>
>>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/no_asan_gen_globals.c?rev=198017&view=auto
>>>>>> >>
>>>>>> >>
>>>>>> ==============================================================================
>>>>>> >> ---
>>>>>> compiler-rt/trunk/lib/asan/lit_tests/TestCases/no_asan_gen_globals.c
>>>>>> >> (added)
>>>>>> >> +++
>>>>>> compiler-rt/trunk/lib/asan/lit_tests/TestCases/no_asan_gen_globals.c
>>>>>> >> Wed Dec 25 08:22:15 2013
>>>>>> >> @@ -0,0 +1,7 @@
>>>>>> >> +// Make sure __asan_gen_* strings do not end up in the symbol
>>>>>> table.
>>>>>> >> +
>>>>>> >> +// RUN: %clang_asan %s -o %t.exe
>>>>>> >> +// RUN: nm %t.exe | grep __asan_gen_ || exit 0
>>>>>> >> +
>>>>>> >> +int x, y, z;
>>>>>> >> +int main() { return 0; }
>>>>>> >>
>>>>>> >> Propchange:
>>>>>> >>
>>>>>> compiler-rt/trunk/lib/asan/lit_tests/TestCases/no_asan_gen_globals.c
>>>>>> >>
>>>>>> >>
>>>>>> ------------------------------------------------------------------------------
>>>>>> >>     svn:eol-style = LF
>>>>>> >>
>>>>>> >>
>>>>>> >> _______________________________________________
>>>>>> >> llvm-commits mailing list
>>>>>> >> llvm-commits at cs.uiuc.edu
>>>>>> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>> >
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Alexander Potapenko
>>>>>> Software Engineer
>>>>>> Google Moscow
>>>>>>
>>>>>
>>>>>
>>>
>>> --
>>> Alexander Potapenko
>>> Software Engineer
>>> Google Moscow
>>>
>>
>>
>> --
>> Alexander Potapenko
>> Software Engineer
>> Google Moscow
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150223/1940b1ef/attachment.html>


More information about the llvm-commits mailing list