Bug 26496 - ASAN error: in sh_elf_relocate_section bfd/elf32-sh.c:3405
Summary: ASAN error: in sh_elf_relocate_section bfd/elf32-sh.c:3405
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-20 12:41 UTC by Martin Liska
Modified: 2020-08-25 07:01 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liska 2020-08-20 12:41:38 UTC
The following fails when I build binutils with:
configure --build=x86_64-linux --disable-nls --disable-gdb --disable-gdbserver --disable-sim --disable-readline --disable-libdecnumber --enable-obsolete --target=sh-linux CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: sh-linux
PASS: SH simple relaxing
Executing on host: sh -c {./ld-new   -o tmpdir/sh1.s1 -Ttext  0x00400060 -relax --oformat srec tmpdir/sh1.o 2>&1}  /dev/null ld.tmp (timeout = 300)
==26560==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x607000000068 at pc 0x0000005be054 bp 0x7fffffffb870 sp 0x7fffffffb868
    #0 0x5be053 in sh_elf_relocate_section /home/mliska/Programming/binutils/bfd/elf32-sh.c:3405
    #1 0x5c1794 in sh_elf_get_relocated_section_contents /home/mliska/Programming/binutils/bfd/elf32-sh.c:5139
    #2 0x5271a7 in default_indirect_link_order /home/mliska/Programming/binutils/bfd/linker.c:2649
    #3 0x53200e in _bfd_generic_final_link /home/mliska/Programming/binutils/bfd/linker.c:1927
    #4 0x49d599 in ldwrite /home/mliska/Programming/binutils/ld/ldwrite.c:545
    #5 0x415e09 in main /home/mliska/Programming/binutils/ld/ldmain.c:510
    #6 0x7ffff6adacc9 in __libc_start_main (/lib64/libc.so.6+0x26cc9)
    #7 0x4183a9 in _start (/dev/shm/hsrjc11n/ld/ld-new+0x4183a9)
Comment 1 Alan Modra 2020-08-25 07:01:14 UTC
This was fixed with git commit 0f55320bc468.