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

            Bug ID: 33478
           Summary: [BUG] A SEGV in _bfd_elf_write_section_eh_frame at
                    elf-eh-frame.c:2127
           Product: binutils
           Version: 2.45
            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 16376
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16376&action=edit
POC

## Description

- Version: Binutils 2.45 with patches in bug 33451, bug 33455, and bug 33457.
- 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 --version-exports-section symbol --shared $POC

## Sanitizer output

==149922==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000001c (pc
0x0000007c0799 bp 0x7fff015955d0 sp 0x7fff01594960 T0)
==149922==The signal is caused by a READ memory access.
==149922==Hint: address points to the zero page.
    #0 0x7c0799 in _bfd_elf_write_section_eh_frame
/benchmark/bin/binutils-2.45/bfd/elf-eh-frame.c:2127:9
    #1 0x677ea2 in _bfd_x86_elf_finish_dynamic_sections
/benchmark/bin/binutils-2.45/bfd/elfxx-x86.c:2899:10
    #2 0x642cef in elf_x86_64_finish_dynamic_sections
/benchmark/bin/binutils-2.45/bfd/elf64-x86-64.c:5637:10
    #3 0x760c13 in bfd_elf_final_link
/benchmark/bin/binutils-2.45/bfd/elflink.c:13730:13
    #4 0x545133 in ldwrite /benchmark/bin/binutils-2.45/ld/ldwrite.c:548:8
    #5 0x53cc51 in main /benchmark/bin/binutils-2.45/ld/./ldmain.c:912:3
    #6 0x7fac294fe082 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x24082)
    #7 0x41d6ad in _start (/benchmark/bin/binutils-2.45/ld/ld-new+0x41d6ad)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
/benchmark/bin/binutils-2.45/bfd/elf-eh-frame.c:2127:9 in
_bfd_elf_write_section_eh_frame
==149922==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