[llvm] r223306 - Move tests for llvm-objdump for universal files to X86 directory to fix build bots.

Kevin Enderby enderby at apple.com
Wed Dec 3 16:38:08 PST 2014


Hi Rafael,

I talked to Jim Grosbach on this and we think we have a fix.  I’ll wait till tomorrow and let all the build bots get settled again with the revert you did before I try another submission with a fix to this.

Thanks,
Kev

On Dec 3, 2014, at 3:38 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:

> And asan gives a really nice diagnostic:
> 
> ==2421==ERROR: AddressSanitizer: heap-use-after-free on address
> 0x60300000daf8 at pc 0x7f5e9732ec7a bp 0x7fff28bc2530 sp
> 0x7fff28bc1ce8
> READ of size 6 at 0x60300000daf8 thread T0
>    #0 0x7f5e9732ec79 in __interceptor_write
> /home/espindola/llvm/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:457:16
>    #1 0x1eb8681 in llvm::raw_fd_ostream::write_impl(char const*,
> unsigned long) /home/espindola/llvm/llvm/lib/Support/raw_ostream.cpp:569:13
>    #2 0x1eae999 in llvm::raw_ostream::write(char const*, unsigned
> long) /home/espindola/llvm/llvm/lib/Support/raw_ostream.cpp:301:9
>    #3 0x416511 in llvm::raw_ostream::operator<<(llvm::StringRef)
> /home/espindola/llvm/llvm/include/llvm/Support/raw_ostream.h:169:14
>    #4 0x4fcc14 in DisassembleInputMachO2(llvm::StringRef,
> llvm::object::MachOObjectFile*, llvm::StringRef, llvm::StringRef)
> /home/espindola/llvm/llvm/tools/llvm-objdump/MachODump.cpp:1899:5
>    #5 0x4f3f55 in llvm::DisassembleInputMachO(llvm::StringRef)
> /home/espindola/llvm/llvm/tools/llvm-objdump/MachODump.cpp:425:11
>    #6 0x41c09f in DumpInput(llvm::StringRef)
> /home/espindola/llvm/llvm/tools/llvm-objdump/llvm-objdump.cpp:837:5
>    #7 0x41aec9 in void
> (*std::for_each<__gnu_cxx::__normal_iterator<std::string*,
> std::vector<std::string, std::allocator<std::string> > >, void
> (*)(llvm::StringRef)>(__gnu_cxx::__normal_iterator<std::string*,
> std::vector<std::string, std::allocator<std::string> > >,
> __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
> std::allocator<std::string> > >, void
> (*)(llvm::StringRef)))(llvm::StringRef)
> /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/bits/stl_algo.h:4417:2
>    #8 0x419874 in main
> /home/espindola/llvm/llvm/tools/llvm-objdump/llvm-objdump.cpp:897:3
>    #9 0x3d12221d64 in __libc_start_main (/lib64/libc.so.6+0x3d12221d64)
>    #10 0x411bd4 in _start
> (/home/espindola/llvm/build-asan/bin/llvm-objdump+0x411bd4)
> 
> 0x60300000daf8 is located 24 bytes inside of 31-byte region
> [0x60300000dae0,0x60300000daff)
> freed by thread T0 here:
>    #0 0x7f5e97398e29 in operator delete(void*)
> /home/espindola/llvm/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:94:3
>    #1 0x3d216be1c2 in std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::~basic_string()
> (/lib64/libstdc++.so.6+0x3d216be1c2)
>    #2 0x41c09f in DumpInput(llvm::StringRef)
> /home/espindola/llvm/llvm/tools/llvm-objdump/llvm-objdump.cpp:837:5
>    #3 0x41aec9 in void
> (*std::for_each<__gnu_cxx::__normal_iterator<std::string*,
> std::vector<std::string, std::allocator<std::string> > >, void
> (*)(llvm::StringRef)>(__gnu_cxx::__normal_iterator<std::string*,
> std::vector<std::string, std::allocator<std::string> > >,
> __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
> std::allocator<std::string> > >, void
> (*)(llvm::StringRef)))(llvm::StringRef)
> /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/bits/stl_algo.h:4417:2
>    #4 0x419874 in main
> /home/espindola/llvm/llvm/tools/llvm-objdump/llvm-objdump.cpp:897:3
>    #5 0x3d12221d64 in __libc_start_main (/lib64/libc.so.6+0x3d12221d64)
> 
> previously allocated by thread T0 here:
>    #0 0x7f5e973988a9 in operator new(unsigned long)
> /home/espindola/llvm/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62:35
>    #1 0x3d216be048 in std::string::_Rep::_S_create(unsigned long,
> unsigned long, std::allocator<char> const&)
> (/lib64/libstdc++.so.6+0x3d216be048)
>    #2 0x3d216bf9bc in std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::basic_string(char const*, unsigned long,
> std::allocator<char> const&) (/lib64/libstdc++.so.6+0x3d216bf9bc)
>    #3 0x5dc6a0 in llvm::StringRef::operator std::string() const
> /home/espindola/llvm/llvm/include/llvm/ADT/StringRef.h:200:14
>    #4 0x508ef5 in
> llvm::object::MachOUniversalBinary::ObjectForArch::getArchTypeName()
> const /home/espindola/llvm/llvm/include/llvm/Object/MachOUniversal.h:56:14
>    #5 0x4f3a06 in llvm::DisassembleInputMachO(llvm::StringRef)
> /home/espindola/llvm/llvm/tools/llvm-objdump/MachODump.cpp:421:28
>    #6 0x41c09f in DumpInput(llvm::StringRef)
> /home/espindola/llvm/llvm/tools/llvm-objdump/llvm-objdump.cpp:837:5
>    #7 0x41aec9 in void
> (*std::for_each<__gnu_cxx::__normal_iterator<std::string*,
> std::vector<std::string, std::allocator<std::string> > >, void
> (*)(llvm::StringRef)>(__gnu_cxx::__normal_iterator<std::string*,
> std::vector<std::string, std::allocator<std::string> > >,
> __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
> std::allocator<std::string> > >, void
> (*)(llvm::StringRef)))(llvm::StringRef)
> /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/bits/stl_algo.h:4417:2
>    #8 0x419874 in main
> /home/espindola/llvm/llvm/tools/llvm-objdump/llvm-objdump.cpp:897:3
>    #9 0x3d12221d64 in __libc_start_main (/lib64/libc.so.6+0x3d12221d64)
> 
> On 3 December 2014 at 18:26, Rafael Espíndola
> <rafael.espindola at gmail.com> wrote:
>> There is uninitialized memory at play. With valgrind I get:
>> 
>> /home/espindola/llvm/llvm/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386
>> (architecture ==12447== Syscall param write(buf) points to
>> unaddressable byte(s)
>> ==12447==    at 0x3D1260E780: __write_nocancel (syscall-template.S:81)
>> ==12447==    by 0x796392: llvm::raw_fd_ostream::write_impl(char
>> const*, unsigned long) (raw_ostream.cpp:569)
>> ==12447==    by 0x7957E9: llvm::raw_ostream::write(char const*,
>> unsigned long) (raw_ostream.cpp:301)
>> ==12447==    by 0x4074E5:
>> llvm::raw_ostream::operator<<(llvm::StringRef) (raw_ostream.h:169)
>> ==12447==    by 0x427CB1: DisassembleInputMachO2(llvm::StringRef,
>> llvm::object::MachOObjectFile*, llvm::StringRef, llvm::StringRef)
>> (MachODump.cpp:1899)
>> ==12447==    by 0x422BDB: llvm::DisassembleInputMachO(llvm::StringRef)
>> (MachODump.cpp:425)
>> ==12447==    by 0x40D083: DumpInput(llvm::StringRef) (llvm-objdump.cpp:837)
>> ==12447==    by 0x4113BB: void
>> (*std::for_each<__gnu_cxx::__normal_iterator<std::string*,
>> std::vector<std::string, std::allocator<std::string> > >, void
>> (*)(llvm::StringRef)>(__gnu_cxx::__normal_iterator<std::string*,
>> std::vector<std::string, std::allocator<std::string> > >,
>> __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
>> std::allocator<std::string> > >, void
>> (*)(llvm::StringRef)))(llvm::StringRef) (stl_algo.h:4417)
>> ==12447==    by 0x40D519: main (llvm-objdump.cpp:898)
>> ==12447==  Address 0x4c34538 is 24 bytes inside a block of size 31 free'd
>> ==12447==    at 0x4A07991: operator delete(void*) (in
>> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>> ==12447==    by 0x3D216BE1C2: std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >::~basic_string()
>> (basic_string.h:539)
>> ==12447==    by 0x422B34: llvm::DisassembleInputMachO(llvm::StringRef)
>> (MachODump.cpp:421)
>> ==12447==    by 0x40D083: DumpInput(llvm::StringRef) (llvm-objdump.cpp:837)
>> ==12447==    by 0x4113BB: void
>> (*std::for_each<__gnu_cxx::__normal_iterator<std::string*,
>> std::vector<std::string, std::allocator<std::string> > >, void
>> (*)(llvm::StringRef)>(__gnu_cxx::__normal_iterator<std::string*,
>> std::vector<std::string, std::allocator<std::string> > >,
>> __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
>> std::allocator<std::string> > >, void
>> (*)(llvm::StringRef)))(llvm::StringRef) (stl_algo.h:4417)
>> ==12447==    by 0x40D519: main (llvm-objdump.cpp:898)
>> 
>> I will revert for now.
>> 
>> 
>> On 3 December 2014 at 18:20, Rafael Espíndola
>> <rafael.espindola at gmail.com> wrote:
>>> It didn't work. On linux I am getting:
>>> 
>>> /home/espindola/llvm/build/./bin/llvm-objdump
>>> /home/espindola/llvm/llvm/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386
>>> -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch all
>>> /home/espindola/llvm/llvm/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386
>>> (architecture � ):
>>> 
>>> On 3 December 2014 at 18:00, Kevin Enderby <enderby at apple.com> wrote:
>>>> Author: enderby
>>>> Date: Wed Dec  3 17:00:16 2014
>>>> New Revision: 223306
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=223306&view=rev
>>>> Log:
>>>> Move tests for llvm-objdump for universal files to X86 directory to fix build bots.
>>>> 
>>>> Added:
>>>>    llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal-archive.x86_64.i386   (with props)
>>>>    llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386   (with props)
>>>>    llvm/trunk/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test
>>>> Removed:
>>>>    llvm/trunk/test/tools/llvm-objdump/Inputs/macho-universal-archive.x86_64.i386
>>>>    llvm/trunk/test/tools/llvm-objdump/Inputs/macho-universal.x86_64.i386
>>>>    llvm/trunk/test/tools/llvm-objdump/macho-universal-x86_64.i386.test
>>>> 
>>>> Removed: llvm/trunk/test/tools/llvm-objdump/Inputs/macho-universal-archive.x86_64.i386
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/Inputs/macho-universal-archive.x86_64.i386?rev=223305&view=auto
>>>> ==============================================================================
>>>> Binary file - no diff available.
>>>> 
>>>> Removed: llvm/trunk/test/tools/llvm-objdump/Inputs/macho-universal.x86_64.i386
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/Inputs/macho-universal.x86_64.i386?rev=223305&view=auto
>>>> ==============================================================================
>>>> Binary file - no diff available.
>>>> 
>>>> Added: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal-archive.x86_64.i386
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal-archive.x86_64.i386?rev=223306&view=auto
>>>> ==============================================================================
>>>> Binary file - no diff available.
>>>> 
>>>> Propchange: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal-archive.x86_64.i386
>>>> ------------------------------------------------------------------------------
>>>>    svn:mime-type = application/octet-stream
>>>> 
>>>> Added: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386?rev=223306&view=auto
>>>> ==============================================================================
>>>> Binary file - no diff available.
>>>> 
>>>> Propchange: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386
>>>> ------------------------------------------------------------------------------
>>>>    svn:executable = *
>>>> 
>>>> Propchange: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/macho-universal.x86_64.i386
>>>> ------------------------------------------------------------------------------
>>>>    svn:mime-type = application/octet-stream
>>>> 
>>>> Added: llvm/trunk/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test?rev=223306&view=auto
>>>> ==============================================================================
>>>> --- llvm/trunk/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test (added)
>>>> +++ llvm/trunk/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test Wed Dec  3 17:00:16 2014
>>>> @@ -0,0 +1,25 @@
>>>> +RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch all \
>>>> +RUN: | FileCheck %s -check-prefix UEXE-all
>>>> +RUN: llvm-objdump %p/Inputs/macho-universal-archive.x86_64.i386 -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch i386 \
>>>> +RUN: | FileCheck %s -check-prefix UArchive-i386
>>>> +
>>>> +UEXE-all: macho-universal.x86_64.i386 (architecture x86_64):
>>>> +UEXE-all: (__TEXT,__text) section
>>>> +UEXE-all: _main:
>>>> +UEXE-all: 0000000100000f60     pushq   %rbp
>>>> +UEXE-all: 0000000100000f61     movq    %rsp, %rbp
>>>> +UEXE-all: macho-universal.x86_64.i386 (architecture i386):
>>>> +UEXE-all: (__TEXT,__text) section
>>>> +UEXE-all: _main:
>>>> +UEXE-all: 00001fa0     pushl   %ebp
>>>> +UEXE-all: 00001fa1     movl    %esp, %ebp
>>>> +
>>>> +UArchive-i386: Archive : {{.*}}/macho-universal-archive.x86_64.i386
>>>> +UArchive-i386: macho-universal-archive.x86_64.i386(foo.o):
>>>> +UArchive-i386: (__TEXT,__text) section
>>>> +UArchive-i386: _foo:
>>>> +UArchive-i386: 00000000        pushl   %ebp
>>>> +UArchive-i386: 00000001        movl    %esp, %ebp
>>>> +UArchive-i386: 00000003        popl    %ebp
>>>> +UArchive-i386: 00000004        retl
>>>> +
>>>> 
>>>> Removed: llvm/trunk/test/tools/llvm-objdump/macho-universal-x86_64.i386.test
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/macho-universal-x86_64.i386.test?rev=223305&view=auto
>>>> ==============================================================================
>>>> --- llvm/trunk/test/tools/llvm-objdump/macho-universal-x86_64.i386.test (original)
>>>> +++ llvm/trunk/test/tools/llvm-objdump/macho-universal-x86_64.i386.test (removed)
>>>> @@ -1,25 +0,0 @@
>>>> -RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch all \
>>>> -RUN: | FileCheck %s -check-prefix UEXE-all
>>>> -RUN: llvm-objdump %p/Inputs/macho-universal-archive.x86_64.i386 -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -arch i386 \
>>>> -RUN: | FileCheck %s -check-prefix UArchive-i386
>>>> -
>>>> -UEXE-all: macho-universal.x86_64.i386 (architecture x86_64):
>>>> -UEXE-all: (__TEXT,__text) section
>>>> -UEXE-all: _main:
>>>> -UEXE-all: 0000000100000f60     pushq   %rbp
>>>> -UEXE-all: 0000000100000f61     movq    %rsp, %rbp
>>>> -UEXE-all: macho-universal.x86_64.i386 (architecture i386):
>>>> -UEXE-all: (__TEXT,__text) section
>>>> -UEXE-all: _main:
>>>> -UEXE-all: 00001fa0     pushl   %ebp
>>>> -UEXE-all: 00001fa1     movl    %esp, %ebp
>>>> -
>>>> -UArchive-i386: Archive : {{.*}}/macho-universal-archive.x86_64.i386
>>>> -UArchive-i386: macho-universal-archive.x86_64.i386(foo.o):
>>>> -UArchive-i386: (__TEXT,__text) section
>>>> -UArchive-i386: _foo:
>>>> -UArchive-i386: 00000000        pushl   %ebp
>>>> -UArchive-i386: 00000001        movl    %esp, %ebp
>>>> -UArchive-i386: 00000003        popl    %ebp
>>>> -UArchive-i386: 00000004        retl
>>>> -
>>>> 
>>>> 
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list