public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94972] New: Function multi-versioning binary may crash dynamic linker
@ 2020-05-06 13:37 d at ilvokhin dot com
  2020-05-06 14:42 ` [Bug target/94972] " marxin at gcc dot gnu.org
  2024-02-21  0:52 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: d at ilvokhin dot com @ 2020-05-06 13:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94972

            Bug ID: 94972
           Summary: Function multi-versioning binary may crash dynamic
                    linker
           Product: gcc
           Version: 9.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d at ilvokhin dot com
  Target Milestone: ---

Created attachment 48468
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48468&action=edit
Simplified version of function multi-versioning example

I compiled simple binary (a simplified version of function multi-versioning
example from gcc.gnu.org) and do ldd -u -r on result.

This leads to ldd segfault in __cpu_indicator_init from libgcc_s.so.

Behaviour is observed at least for GCC 9.1.1 and 7.3.1 (both from Red Hat
devtoolset).

$ g++ --version
g++ (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ tt.cpp -o cpp
$ ldd -u -r ./cpp
/usr/bin/ldd: line 116:  6148 Segmentation fault      (core dumped)
LD_TRACE_LOADED_OBJECTS=1 LD_WARN=yes LD_BIND_NOW=yes
LD_LIBRARY_VERSION=$verify_out LD_VERBOSE= LD_DEBUG="unused" "$@

Backtrace is looks like that:
(gdb) bt
#0  0x00007efccf094c87 in __cpu_indicator_init () from /lib64/libgcc_s.so.1
#1  0x0000000000401178 in ?? ()
#2  0x00007fff5f97e220 in ?? ()
#3  0x00007efccf8bce5f in _dl_relocate_object () from
/lib64/ld-linux-x86-64.so.2 
(gdb) disass
Dump of assembler code for function __cpu_indicator_init:
   0x00007efccf094c70 <+0>:     push   %r15
   0x00007efccf094c72 <+2>:     push   %r14
   0x00007efccf094c74 <+4>:     push   %r13
   0x00007efccf094c76 <+6>:     push   %r12
   0x00007efccf094c78 <+8>:     push   %rbp
   0x00007efccf094c79 <+9>:     xor    %ebp,%ebp
   0x00007efccf094c7b <+11>:    push   %rbx
   0x00007efccf094c7c <+12>:    sub    $0x18,%rsp
   0x00007efccf094c80 <+16>:    mov    0x212351(%rip),%rax        #
0x7efccf2a6fd8
=> 0x00007efccf094c87 <+23>:    mov    (%rax),%eax
   0x00007efccf094c89 <+25>:    test   %eax,%eax

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/94972] Function multi-versioning binary may crash dynamic linker
  2020-05-06 13:37 [Bug target/94972] New: Function multi-versioning binary may crash dynamic linker d at ilvokhin dot com
@ 2020-05-06 14:42 ` marxin at gcc dot gnu.org
  2024-02-21  0:52 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-06 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94972

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-05-06
             Status|UNCONFIRMED                 |WAITING
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jwakely.gcc at gmail dot com,
                   |                            |marxin at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Can't reproduce that on openSUSE Tumbleweed with:

marxin@marxinbox:~/Programming/testcases> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/9/lto-wrapper
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d
--enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver
--disable-werror --with-gxx-include-dir=/usr/include/c++/9 --enable-ssp
--disable-libssp --disable-libvtv --disable-cet --disable-libcc1
--enable-plugin --with-bugurl=https://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-libphobos
--enable-version-specific-runtime-libs --with-gcc-major-version-only
--enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function
--program-suffix=-9 --without-system-libunwind --enable-multilib
--with-arch-32=x86-64 --with-tune=generic
--with-build-config=bootstrap-lto-lean --enable-link-mutex
--build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 9.3.1 20200406 [revision 6db837a5288ee3ca5ec504fbd5a765817e556ac2]
(SUSE Linux) 
marxin@marxinbox:~/Programming/testcases> ldd --version
ldd (GNU libc) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

I'm adding RedHat guys to CC.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/94972] Function multi-versioning binary may crash dynamic linker
  2020-05-06 13:37 [Bug target/94972] New: Function multi-versioning binary may crash dynamic linker d at ilvokhin dot com
  2020-05-06 14:42 ` [Bug target/94972] " marxin at gcc dot gnu.org
@ 2024-02-21  0:52 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-21  0:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94972

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=20019
         Resolution|---                         |MOVED
             Status|WAITING                     |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like it was fixed in dynamic linker.

Anyways no feedback in almost 4 years so closing as moved.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-21  0:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 13:37 [Bug target/94972] New: Function multi-versioning binary may crash dynamic linker d at ilvokhin dot com
2020-05-06 14:42 ` [Bug target/94972] " marxin at gcc dot gnu.org
2024-02-21  0:52 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).