Bug 26505 - ASAN error: in xstormy16_elf_relax_section bfd/elf32-xstormy16.c:595
Summary: ASAN error: in xstormy16_elf_relax_section bfd/elf32-xstormy16.c:595
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: 2.36
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-20 12:45 UTC by Martin Liska
Modified: 2020-08-25 13:46 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed: 2020-08-25 00:00:00


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:45:27 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=xstormy16-elf CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: xstormy16-elf
FAIL: ld-elf/pr20528b
Executing on host: sh -c {./ld-new   -L/home/mliska/Programming/binutils/ld/testsuite/ld-elf  -T pr21884.t -o tmpdir/dump tmpdir/pr21884a.o tmpdir/pr21884b.o  2>&1}  /dev/null dump.tmp (timeout = 300)
==39523==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x607000000088 at pc 0x0000005712af bp 0x7fffffffb800 sp 0x7fffffffb7f8
    #0 0x5712ae in xstormy16_elf_relax_section /home/mliska/Programming/binutils/bfd/elf32-xstormy16.c:595
    #1 0x4529b5 in lang_size_sections_1 /home/mliska/Programming/binutils/ld/ldlang.c:6072
    #2 0x4526db in lang_size_sections_1 /home/mliska/Programming/binutils/ld/ldlang.c:5810
    #3 0x471c02 in one_lang_size_sections_pass /home/mliska/Programming/binutils/ld/ldlang.c:6278
    #4 0x471c02 in lang_size_sections /home/mliska/Programming/binutils/ld/ldlang.c:6390
    #5 0x471c02 in lang_relax_sections /home/mliska/Programming/binutils/ld/ldlang.c:7659
    #6 0x4d2ead in ldelf_map_segments /home/mliska/Programming/binutils/ld/ldelfgen.c:40
    #7 0x48290d in lang_process /home/mliska/Programming/binutils/ld/ldlang.c:8164
    #8 0x4132ca in main /home/mliska/Programming/binutils/ld/ldmain.c:494
    #9 0x7ffff6adacc9 in __libc_start_main (/lib64/libc.so.6+0x26cc9)
    #10 0x415819 in _start (/dev/shm/qz6yfmfe/ld/ld-new+0x415819)
Comment 1 cvs-commit@gcc.gnu.org 2020-08-25 13:38:53 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1ab8d928977f4d9f137f972d03e079555d0f29fa

commit 1ab8d928977f4d9f137f972d03e079555d0f29fa
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 25 17:56:08 2020 +0930

    PR26505, ASAN: xstormy16_elf_relax_section elf32-xstormy16.c:595
    
            PR 26505
            * elf32-xstormy16.c (xstormy16_elf_relax_section): Check
            is_elf_hash_table before accessing elf fields.
Comment 2 Alan Modra 2020-08-25 13:46:58 UTC
Fixed