This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/20019] New: Program received signal SIGSEGV, Segmentation fault


https://sourceware.org/bugzilla/show_bug.cgi?id=20019

            Bug ID: 20019
           Summary: Program received signal SIGSEGV, Segmentation fault
           Product: glibc
           Version: 2.24
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

On x86-64, I got

[hjl@gnu-6 now-2]$ cat main.c 
void foo (void);

int
main ()
{
  foo ();
  return 0;
}
[hjl@gnu-6 now-2]$ cat foo.c
void bar (void *dst, void *src);

void
foo (void)
{
  char dst[50];
  char src[50];
  bar (dst, src);
}
[hjl@gnu-6 now-2]$ cat bar.c
void
bar (void *dst, void *src)
{
  __builtin_memmove (dst, src, 40);
}
[hjl@gnu-6 now-2]$ make
gcc -O2   -c -o main.o main.c
gcc -O2 -fPIC   -c -o foo.o foo.c
gcc -O2 -fPIC   -c -o bar.o bar.c
ld.gold -shared  -z now -o libbar.so bar.o
ld.gold -shared  -z now -o libfoo.so foo.o libbar.so
gcc -o foo main.o libfoo.so -Wl,-rpath,. 
./foo
Makefile:7: recipe for target 'all' failed
make: *** [all] Segmentation fault
[hjl@gnu-6 now-2]$ gdb foo
GNU gdb (GDB) Fedora 7.10.1-31.fc23
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from foo...(no debugging symbols found)...done.
(gdb) r
Starting program: /export/home/hjl/bugs/libc/now-2/foo 
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.22-11.6.fc23.x86_64

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7aacc97 in ?? ()
(gdb) bt
#0  0x00007ffff7aacc97 in ?? ()
#1  0x00007ffff7de6b32 in _dl_relocate_object ()
   from /lib64/ld-linux-x86-64.so.2
#2  0x00007ffff7ddda13 in dl_main () from /lib64/ld-linux-x86-64.so.2
#3  0x00007ffff7df222b in _dl_sysdep_start () from /lib64/ld-linux-x86-64.so.2
#4  0x00007ffff7ddebb1 in _dl_start () from /lib64/ld-linux-x86-64.so.2
#5  0x00007ffff7ddac68 in _start () from /lib64/ld-linux-x86-64.so.2
#6  0x0000000000000001 in ?? ()
#7  0x00007fffffffe4df in ?? ()
#8  0x0000000000000000 in ?? ()
(gdb) 

The problem is libbar.so doesn't have DT_NEEDED for libc.so.6.

[hjl@gnu-6 now-2]$ readelf -r libbar.so 

Relocation section '.rela.plt' at offset 0x240 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
000000001410  000200000007 R_X86_64_JUMP_SLO 0000000000000000 memmove + 0
[hjl@gnu-6 now-2]$ 

is resolved due to -z now before libc.so.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]