https://sourceware.org/bugzilla/show_bug.cgi?id=32601

            Bug ID: 32601
           Summary: ld on Alpha terminated with double free or corruption
                    (!prev) and signal 6
           Product: binutils
           Version: 2.45 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: mcree at orcon dot net.nz
  Target Milestone: ---

LD on Alpha can complete link (artefacts written) but exits with signal 6 and
"double or corruption (!prev)" thereby terminating any subsequent build
process.

Bisected back to commit 1f5e6267aacc (Call bfd_close_all_done in ld_cleanup)
but this is not the offending commit: it has only exposed an already existing
bug.

I built a cross-target ld on x86-64 with the address sanitiser included
targetting alpha-linux-gnu and performed the same link there (after copying all
inputs needed for linking from a build on an Alpha host).  We get the following
heap buffer overflow reported:

=================================================================
==831662==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x62e0002e7d37 at pc 0x55608effc350 bp 0x7fffbe66f8d0 sp 0x7fffbe66f8c8
WRITE of size 1 at 0x62e0002e7d37 thread T0
    #0 0x55608effc34f in bfd_putl64
(/usr/local/bin/alpha-linux-gnu-ld+0x16934f)
    #1 0x55608f04ec18 in elf64_alpha_relocate_section
(/usr/local/bin/alpha-linux-gnu-ld+0x1bbc18)
    #2 0x55608f105aa7 in elf_link_input_bfd
(/usr/local/bin/alpha-linux-gnu-ld+0x272aa7)
    #3 0x55608f10dee0 in bfd_elf_final_link
(/usr/local/bin/alpha-linux-gnu-ld+0x27aee0)
    #4 0x55608f054d44 in elf64_alpha_final_link
(/usr/local/bin/alpha-linux-gnu-ld+0x1c1d44)
    #5 0x55608efa3a8c in ldwrite (/usr/local/bin/alpha-linux-gnu-ld+0x110a8c)
    #6 0x55608ef9c4ae in main (/usr/local/bin/alpha-linux-gnu-ld+0x1094ae)
    #7 0x7fdb6bc46249 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
    #8 0x7fdb6bc46304 in __libc_start_main_impl ../csu/libc-start.c:360
    #9 0x55608ef45b60 in _start (/usr/local/bin/alpha-linux-gnu-ld+0xb2b60)

0x62e0002e7d37 is located 583 bytes to the right of 46832-byte region
[0x62e0002dc400,0x62e0002e7af0)
allocated by thread T0 here:
    #0 0x7fdb6beb89cf in __interceptor_malloc
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x55608f267237 in _objalloc_alloc
(/usr/local/bin/alpha-linux-gnu-ld+0x3d4237)
    #2 0x55608effa5b6 in bfd_alloc (/usr/local/bin/alpha-linux-gnu-ld+0x1675b6)
    #3 0x55608effa63a in bfd_zalloc
(/usr/local/bin/alpha-linux-gnu-ld+0x16763a)
    #4 0x55608f044195 in elf64_alpha_late_size_sections
(/usr/local/bin/alpha-linux-gnu-ld+0x1b1195)
    #5 0x55608f0e7382 in bfd_elf_size_dynamic_sections
(/usr/local/bin/alpha-linux-gnu-ld+0x254382)
    #6 0x55608efcd6a5 in ldelf_before_allocation
(/usr/local/bin/alpha-linux-gnu-ld+0x13a6a5)
    #7 0x55608efc07ff in gldelf64alpha_before_allocation
(/usr/local/bin/alpha-linux-gnu-ld+0x12d7ff)
    #8 0x55608efc03da in alpha_before_allocation
(/usr/local/bin/alpha-linux-gnu-ld+0x12d3da)
    #9 0x55608efabe77 in ldemul_before_allocation
(/usr/local/bin/alpha-linux-gnu-ld+0x118e77)
    #10 0x55608ef8dbd1 in lang_process
(/usr/local/bin/alpha-linux-gnu-ld+0xfabd1)
    #11 0x55608ef9c294 in main (/usr/local/bin/alpha-linux-gnu-ld+0x109294)
    #12 0x7fdb6bc46249 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: heap-buffer-overflow
(/usr/local/bin/alpha-linux-gnu-ld+0x16934f) in bfd_putl64
Shadow bytes around the buggy address:
  0x0c5c80054f50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa fa
  0x0c5c80054f60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054f70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054f90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c5c80054fa0: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa
  0x0c5c80054fb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5c80054ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==831662==ABORTING

I hope that might help in narrowing down where memory corruption might be
occuring.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to