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

            Bug ID: 33501
           Summary: [BUG] A SEGV in bfd_putl64 at libbfd.c:989
           Product: binutils
           Version: 2.46 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: yfzhang23 at stu dot pku.edu.cn
  Target Milestone: ---

Created attachment 16392
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16392&action=edit
POC

## Description

- Version: Binutils latest commit 9af366e0d3b7bc5802295bb001d17483033de87b
- Environment: Ubuntu 20.04.6 LTS, Clang 12.0.0

## Steps to reproduce

export CC="clang"
export CFLAGS="-g -fsanitize=address"
./configure
make -j
./ld/ld-new --gc-sections --no-print-gc-sections -w $POC

## Sanitizer output

==67225==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000007 (pc
0x0000005dbf90 bp 0x7fff23268fd0 sp 0x7fff23268f30 T0)
==67225==The signal is caused by a WRITE memory access.
==67225==Hint: address points to the zero page.
    #0 0x5dbf90 in bfd_putl64
/benchmark/bin/DAFL/binutils-gdb/bfd/libbfd.c:989:11
    #1 0x68d12d in bfd_elf64_swap_reloca_out
/benchmark/bin/DAFL/binutils-gdb/bfd/./elfcode.h:470:3
    #2 0x7858af in elf_append_rela
/benchmark/bin/DAFL/binutils-gdb/bfd/elflink.c:15692:3
    #3 0x634f78 in elf_x86_64_relocate_section
/benchmark/bin/DAFL/binutils-gdb/bfd/elf64-x86-64.c:4659:8
    #4 0x7628ec in elf_link_input_bfd
/benchmark/bin/DAFL/binutils-gdb/bfd/elflink.c:11963:10
    #5 0x7547ff in bfd_elf_final_link
/benchmark/bin/DAFL/binutils-gdb/bfd/elflink.c:13222:11
    #6 0x542f2e in ldwrite /benchmark/bin/DAFL/binutils-gdb/ld/ldwrite.c:548:8
    #7 0x53acdf in main /benchmark/bin/DAFL/binutils-gdb/ld/./ldmain.c:905:3
    #8 0x79c61fc95d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    #9 0x79c61fc95e3f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    #10 0x41d6c4 in _start
(/benchmark/bin/DAFL/binutils-gdb/ld/ld-new+0x41d6c4)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
/benchmark/bin/DAFL/binutils-gdb/bfd/libbfd.c:989:11 in bfd_putl64
==67225==ABORTING

## Credit

Reported by Yifan Zhang, [PLL](https://pl.cs.pku.edu.cn/en/)

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

Reply via email to