Bug 26452 - ASAN error: in som_compute_checksum bfd/som.c:4293
Summary: ASAN error: in som_compute_checksum bfd/som.c:4293
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:
: 26451 26454 26456 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-08-20 12:24 UTC by Martin Liska
Modified: 2020-08-26 08:38 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:24:17 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=hppa-hp-hpux10 CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: hppa-hp-hpux10
| 	exit( YY_EXIT_FAILURE );
Executing on host: sh -c {../as-new    /home/mliska/Programming/binutils/gas/testsuite/gas/all/p2425.s 2>&1}  /dev/null gas.out (timeout = 300)
==15525==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffbea0 at pc 0x00000058738b bp 0x7fffffffbb30 sp 0x7fffffffbb28
    #0 0x58738a in som_compute_checksum /home/mliska/Programming/binutils/bfd/som.c:4293
    #1 0x58738a in som_finish_writing /home/mliska/Programming/binutils/bfd/som.c:4228
    #2 0x51cede in bfd_close /home/mliska/Programming/binutils/bfd/opncls.c:775
    #3 0x46a6e1 in output_file_close /home/mliska/Programming/binutils/gas/output-file.c:64
    #4 0x41a8cf in close_output_file /home/mliska/Programming/binutils/gas/as.c:1158
    #5 0x6afad3 in xatexit_cleanup /home/mliska/Programming/binutils/libiberty/xatexit.c:98
    #6 0x6afea4 in xexit /home/mliska/Programming/binutils/libiberty/xexit.c:50
    #7 0x411b35 in main /home/mliska/Programming/binutils/gas/as.c:1499
    #8 0x7ffff6adacc9 in __libc_start_main (/lib64/libc.so.6+0x26cc9)
    #9 0x4136d9 in _start (/dev/shm/3krqkl3k/gas/as-new+0x4136d9)
Comment 1 cvs-commit@gcc.gnu.org 2020-08-25 13:38:22 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 2186273ac4ba9fa4c56dc8c5d47ab3a7e358cec9
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 25 15:46:02 2020 +0930

    PR26452, ASAN: som_compute_checksum som.c:4293
    
            PR 26452
            * som.c (som_compute_checksum): XOR 32-bit words in header,
            not unsigned long sized words.
Comment 2 Alan Modra 2020-08-25 13:43:02 UTC
Fixed
Comment 3 Alan Modra 2020-08-26 08:33:06 UTC
*** Bug 26454 has been marked as a duplicate of this bug. ***
Comment 4 Alan Modra 2020-08-26 08:37:54 UTC
*** Bug 26451 has been marked as a duplicate of this bug. ***
Comment 5 Alan Modra 2020-08-26 08:38:12 UTC
*** Bug 26456 has been marked as a duplicate of this bug. ***