Bug 26484 - UBSAN error: bfd/elf64-ppc.c:16107:6:
Summary: UBSAN error: bfd/elf64-ppc.c:16107:6:
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:37 UTC by Martin Liska
Modified: 2020-08-26 14:38 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:37:15 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=powerpc-eabisim CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: powerpc-eabisim
FAIL: TLS dynamic exec (--no-tls-optimize)
Executing on host: sh -c {./ld-new   -o tmpdir/tls.so -z norelro -L/home/mliska/Programming/binutils/ld/testsuite/ld-powerpc -shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o   2>&1}  /dev/null ld.tmp (timeout = 300)
/home/mliska/Programming/binutils/bfd/elf64-ppc.c:16107:6: runtime error: member access within null pointer of type 'struct ppc_link_hash_entry'
Comment 1 Sourceware Commits 2020-08-26 13:55:13 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 9e51d549d7901be8b999f8dac86c5efd6a7edef2
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Aug 26 19:43:18 2020 +0930

    PR 26484-26488, 26490 UBSAN &h->elf null pointer
    
            PR 26484
            PR 26485
            PR 26486
            PR 26487
            PR 26488
            PR 26490
            * elf64-ppc.c (is_tls_get_addr): Avoid UB &h->elf when h is NULL.
            (ppc64_elf_tls_setup): Likewise.
            (branch_reloc_hash_match): Likewise.
            (build_plt_stub): Likewise.
            (ppc64_elf_relocate_section): Likewise.
Comment 2 Alan Modra 2020-08-26 14:38:36 UTC
Fixed