Bug 1190506

Summary: ppc64: segv in `gdb -q /lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko`
Product: Red Hat Enterprise Linux 7 Reporter: Martin Cermak <mcermak>
Component: gdbAssignee: Sergio Durigan Junior <sergiodj>
Status: CLOSED ERRATA QA Contact: Miroslav Franc <mfranc>
Severity: medium Docs Contact: Robert Krátký <rkratky>
Priority: medium    
Version: 7.1CC: gdb-bugs, jan.kratochvil, law, mfranc, mnewsome, msebor, ohudlick, palves, qe-baseos-tools-bugs, sergiodj
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-7.6.1-68.el7 Doc Type: Bug Fix
Doc Text:
GDB on IBM Power Systems no longer fails when accessing the symbol table Previously, GDB on 64-bit IBM Power Systems incorrectly deallocated an important variable that held the symbol table for the binary being debugged, which caused a segmentation fault when GDB tried to access that symbol table. To solve this issue, this specific variable has been made persistent, and GDB can now access the needed information later during the debugging session, without reading an invalid memory region.
Story Points: ---
Clone Of: 1172766 Environment:
Last Closed: 2015-11-19 13:02:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1205796    

Description Martin Cermak 2015-02-08 20:17:02 UTC
+++ This bug was initially created as a clone of Bug #1172766 +++

... stuff deleted ...

--- Additional comment from Martin Cermak on 2014-12-10 18:19:11 CET ---

Similarly using gdb:

 7.1 S ppc64 # rpm -q gdb
gdb-7.6.1-64.el7.ppc64
 7.1 S ppc64 # gdb -q /lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko
Reading symbols from /usr/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko...Reading symbols from /usr/lib/debug/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko.debug...Segmentation fault
 7.1 S ppc64 # 


 7.1 S ppc64 # gdb -q --args gdb -q /lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko
Reading symbols from /usr/bin/gdb...Reading symbols from /usr/lib/debug/usr/bin/gdb.debug...done.
done.
(gdb) r
Starting program: /usr/bin/gdb -q /lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/power8/libthread_db.so.1".
Detaching after fork from child process 40699.
Reading symbols from /usr/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko...Reading symbols from /usr/lib/debug/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko.debug...
Program received signal SIGSEGV, Segmentation fault.
0x0000000010393bf0 in ppc64_elf_get_synthetic_symtab (abfd=<optimized out>, static_count=<optimized out>, static_syms=<optimized out>, dyn_count=<optimized out>, dyn_syms=<optimized out>, ret=0x3fffffffdd40) at ../../bfd/elf64-ppc.c:3138
3138              if (!sym_exists_at (syms, opdsymend, symcount,
Missing separate debuginfos, use: debuginfo-install pcre-8.32-14.el7.ppc64
(gdb) 
(gdb) bt
#0  0x0000000010393bf0 in ppc64_elf_get_synthetic_symtab (abfd=<optimized out>, static_count=<optimized out>, static_syms=<optimized out>, dyn_count=<optimized out>, dyn_syms=<optimized out>, ret=0x3fffffffdd40) at ../../bfd/elf64-ppc.c:3138
#1  0x000000001014803c in elf_symfile_read (objfile=0x10999260, symfile_flags=<optimized out>) at ../../gdb/elfread.c:2369
#2  0x00000000101e3698 in read_symbols (objfile=<optimized out>, objfile@entry=0x10999260, add_flags=<optimized out>, add_flags@entry=6) at ../../gdb/symfile.c:827
#3  0x00000000101e2678 in syms_from_objfile_1 (objfile=objfile@entry=0x10999260, addrs=addrs@entry=0x10955ac0, offsets=offsets@entry=0x0, num_offsets=num_offsets@entry=0, add_flags=add_flags@entry=6) at ../../gdb/symfile.c:1027
#4  0x00000000101e2cac in syms_from_objfile (add_flags=6, num_offsets=0, offsets=0x0, addrs=0x10955ac0, objfile=0x10999260) at ../../gdb/symfile.c:1045
#5  symbol_file_add_with_addrs_or_offsets (abfd=abfd@entry=0x10938750, add_flags=<optimized out>, addrs=addrs@entry=0x10955ac0, flags=<optimized out>, parent=parent@entry=0x1093a800, num_offsets=0, offsets=0x0) at ../../gdb/symfile.c:1144
#6  0x00000000101e360c in symbol_file_add_separate (bfd=0x10938750, symfile_flags=<optimized out>, objfile=0x1093a800) at ../../gdb/symfile.c:1214
#7  0x00000000101482d0 in elf_symfile_read (objfile=0x1093a800, symfile_flags=<optimized out>) at ../../gdb/elfread.c:2490
#8  0x00000000101e3698 in read_symbols (objfile=<optimized out>, objfile@entry=0x1093a800, add_flags=<optimized out>, add_flags@entry=6) at ../../gdb/symfile.c:827
#9  0x00000000101e2678 in syms_from_objfile_1 (objfile=objfile@entry=0x1093a800, addrs=0x108a4740, addrs@entry=0x0, offsets=offsets@entry=0x0, num_offsets=num_offsets@entry=0, add_flags=add_flags@entry=6) at ../../gdb/symfile.c:1027
#10 0x00000000101e2cac in syms_from_objfile (add_flags=6, num_offsets=0, offsets=0x0, addrs=0x0, objfile=0x1093a800) at ../../gdb/symfile.c:1045
#11 symbol_file_add_with_addrs_or_offsets (abfd=abfd@entry=0x1089a9b0, add_flags=<optimized out>, addrs=0x0, flags=<optimized out>, parent=parent@entry=0x0, num_offsets=0, offsets=0x0) at ../../gdb/symfile.c:1144
#12 0x00000000101e2ebc in symbol_file_add_from_bfd (parent=0x0, flags=<optimized out>, addrs=<optimized out>, add_flags=<optimized out>, abfd=0x1089a9b0) at ../../gdb/symfile.c:1234
#13 symbol_file_add (name=name@entry=0x3ffffffff1d8 "/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko", add_flags=<optimized out>, addrs=addrs@entry=0x0, flags=flags@entry=0) at ../../gdb/symfile.c:1250
#14 0x00000000101e2f5c in symbol_file_add_main_1 (args=0x3ffffffff1d8 "/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko", from_tty=<optimized out>, flags=<optimized out>) at ../../gdb/symfile.c:1276
#15 0x00000000102127b4 in catch_command_errors (command=@0x10637480: 0x101e2fc0 <symbol_file_add_main>, arg=0x3ffffffff1d8 "/lib/modules/3.10.0-215.el7.ppc64/kernel/fs/nfsd/nfsd.ko", from_tty=<optimized out>, mask=<optimized out>) at ../../gdb/exceptions.c:573
#16 0x00000000102165a8 in captured_main (data=<optimized out>) at ../../gdb/main.c:1013
#17 0x0000000010212660 in catch_errors (func=@0x10639420: 0x102153a0 <captured_main>, func_args=0x3fffffffe978, errstring=0x10452028 "", mask=<optimized out>) at ../../gdb/exceptions.c:546
#18 0x0000000010216c84 in gdb_main (args=<optimized out>) at ../../gdb/main.c:1144
#19 0x0000000010056c64 in main (argc=<error reading variable: value has been optimized out>, argv=<optimized out>) at ../../gdb/gdb.c:34
(gdb)

--- Additional comment from Martin Cermak on 2014-12-10 18:20:25 CET ---

Reproducer files also available at https://bugzilla.redhat.com/show_bug.cgi?id=1171823#c4

Comment 1 Martin Sebor 2015-02-18 00:12:27 UTC
Patch for GDB 7.9.50.20150213-cvs:
http://sourceware.org/ml/gdb-patches/2015-02/msg00458.html

Comment 7 errata-xmlrpc 2015-11-19 13:02:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2089.html