[llvm-bugs] [Bug 37303] New: LLD + -fsanitize=address segfaults in scandir.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 1 04:51:09 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37303

            Bug ID: 37303
           Summary: LLD + -fsanitize=address segfaults in scandir.
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jeanmichael.celerier at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hi,

the following fails when compiled with -fsanitize=address -fuse-ld=lld : 

bug.c: 

    #include <dirent.h>
    #include <fcntl.h>

    int filter(const struct dirent *dirent) { return 0; }
    int main() {
      struct dirent **namelist;
      scandir("/usr/lib", &namelist, filter, versionsort);
    }

    $ clang -D_GNU_SOURCE -O0 foo.c -fsanitize=address -fuse-ld=lld
    $ ./a.out


    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==23603==ERROR: AddressSanitizer: SEGV on unknown address 0x0000fffd2f8a
(pc 0x55bd8515b3b3 bp 0x7ffecc9d0cd0 sp 0x7ffecc9d0450 T0)
    ==23603==The signal is caused by a WRITE memory access.
        #0 0x55bd8515b3b2 in __interceptor_scandir.part.106
(/tmp/a.out+0xa73b2)
        #1 0x55bd85201c5e in main (/tmp/a.out+0x14dc5e)
        #2 0x7fb2e5c819a6 in __libc_start_main (/usr/lib/libc.so.6+0x219a6)
        #3 0x55bd85105029 in _start (/tmp/a.out+0x51029)

It works fine with -fuse-ld=gold/bfd

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180501/5feda98d/attachment.html>


More information about the llvm-bugs mailing list