Bug 1708192

Summary: gdb-add-index Segmentation fault
Product: [Fedora] Fedora Reporter: Josef Kubin <jkubin>
Component: gdbAssignee: Sergio Durigan Junior <sergiodj>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 29CC: jan.kratochvil, keiths, kevinb, niki.guldbrand, pmuldoon, sergiodj, v.rumjantsev
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-8.3-2.fc30 gdb-8.2-7.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-17 01:06:56 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:
Attachments:
Description Flags
rpmbuild output + last coredump none

Description Josef Kubin 2019-05-09 10:55:54 UTC
Created attachment 1566091 [details]
rpmbuild output + last coredump

Description of problem:

Several segfaults occurred during rpmbuild process

Version-Release number of selected component (if applicable):

$ rpm -qf /usr/bin/gdb-add-index
gdb-headless-8.2-6.fc29.x86_64

How reproducible:
always

Steps to Reproduce:

$ rpmdev-setuptree
$ rpm -ivh grub2-2.02-62.fc29.src.rpm
$ cd rpmbuild/SPECS
$ rpmbuild -ba grub2.spec |& tee output.txt
...
$ grep 'Segmentation fault' output.txt
/usr/bin/gdb-add-index: line 67:  5278 Segmentation fault      (core dumped) $GDB --batch -nx -iex 'set auto-load no' -ex "file $file" -ex "save gdb-index $dwarf5 $dir"
/usr/bin/gdb-add-index: line 67:  5292 Segmentation fault      (core dumped) $GDB --batch -nx -iex 'set auto-load no' -ex "file $file" -ex "save gdb-index $dwarf5 $dir"
/usr/bin/gdb-add-index: line 67:  5485 Segmentation fault      (core dumped) $GDB --batch -nx -iex 'set auto-load no' -ex "file $file" -ex "save gdb-index $dwarf5 $dir"

---

$ coredumpctl dump --output=coredump
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
           PID: 5485 (gdb)
           UID: 1000 (kb)
           GID: 1001 (kb)
        Signal: 11 (SEGV)
     Timestamp: Thu 2019-05-09 12:17:23 CEST (25min ago)
  Command Line: gdb --batch -nx -iex set auto-load no -ex file /home/kb/rpmbuild/BUILD/grub-2.02/debug/usr/sbin/grub2-probe -ex save gdb-index  /home/kb/rpmbuild/BUILD/grub-2.02/debug/usr/sbin
    Executable: /usr/libexec/gdb
 Control Group: /user.slice/user-0.slice/session-6.scope
          Unit: session-6.scope
         Slice: user-0.slice
       Session: 6 
     Owner UID: 0 (root)
       Boot ID: 3223255ee06b4abfbfd5744370087f26
    Machine ID: 55cf1e6795614ff1b9f015d61e4d6751
      Hostname: fosil
       Storage: /var/lib/systemd/coredump/core.gdb.1000.3223255ee06b4abfbfd5744370087f26.5485.1557397043000000.lz4
       Message: Process 5485 (gdb) of user 1000 dumped core.
                
                Stack trace of thread 5485:
                #0  0x000055d351d12e60 n/a (gdb)
                #1  0x000055d351d12f50 n/a (gdb)
                #2  0x000055d351d1366d n/a (gdb)
                #3  0x000055d351d271d4 n/a (gdb)
                #4  0x000055d351d2c558 n/a (gdb)
                #5  0x000055d351d2dbdf n/a (gdb)
                #6  0x000055d351dcb777 n/a (gdb)
                #7  0x000055d351dcf220 n/a (gdb)
                #8  0x000055d351e2b3fc n/a (gdb)
                #9  0x000055d351e2b573 n/a (gdb)
                #10 0x000055d351db4b61 n/a (gdb)
                #11 0x000055d351e30b51 n/a (gdb)
                #12 0x000055d351e30727 n/a (gdb)
                #13 0x000055d351e30963 n/a (gdb)
                #14 0x000055d351e1d416 n/a (gdb)
                #15 0x000055d351e22b8c n/a (gdb)
                #16 0x000055d351c5063e n/a (gdb)
                #17 0x000055d351bba4ba n/a (gdb)
                #18 0x000055d351e5e4a1 n/a (gdb)
                #19 0x000055d351d9d528 n/a (gdb)
                #20 0x000055d351d9e932 n/a (gdb)
                #21 0x000055d351aee89f n/a (gdb)
                #22 0x00007f80e8a88413 __libc_start_main (libc.so.6)
                #23 0x000055d351af220e n/a (gdb)
                
                Stack trace of thread 5490:
                #0  0x00007f80e90c472c pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0)
                #1  0x00007f80e88938db GC_wait_marker (libgc.so.1)
                #2  0x00007f80e8888dea GC_help_marker (libgc.so.1)
                #3  0x00007f80e889388f GC_mark_thread (libgc.so.1)
                #4  0x00007f80e90be58e start_thread (libpthread.so.0)
                #5  0x00007f80e8b61683 __clone (libc.so.6)
More than one entry matches, ignoring rest.

---

Expected results:
no segfault

Comment 1 Sergio Durigan Junior 2019-05-09 18:20:37 UTC
This is actually not a GDB bug, but apparently a Linux kernel bug.  I'm closing this as duplicate of Bug 1535174; feel free to follow the progress there.

As a workaround, you can try using -g (and not -g3) when building grub2; this is the default RPM build flag to use anyway.

Thanks.

*** This bug has been marked as a duplicate of bug 1535174 ***

Comment 2 Sergio Durigan Junior 2019-05-09 18:30:10 UTC
Sorry, please disregard my last comment.

Comment 3 Sergio Durigan Junior 2019-05-10 20:23:24 UTC
(In reply to Sergio Durigan Junior from comment #2)
> Sorry, please disregard my last comment.

Not all of it, though.  The workaround mentioned (-g instead of -g3) is still valid.  I will propose a patch to the grub2 package which does that.

Comment 4 Sergio Durigan Junior 2019-05-10 20:36:26 UTC
I've created Bug 1708780 to fix this on grub2.

GDB should also not crash on invalid DWARF; I'll submit a patch upstream soon.

Comment 5 Sergio Durigan Junior 2019-05-10 21:10:02 UTC
Patch submitted: https://sourceware.org/ml/gdb-patches/2019-05/msg00268.html

Comment 6 Sergio Durigan Junior 2019-05-15 15:20:16 UTC
*** Bug 1709864 has been marked as a duplicate of this bug. ***

Comment 7 Sergio Durigan Junior 2019-05-15 15:20:44 UTC
*** Bug 1662401 has been marked as a duplicate of this bug. ***

Comment 8 Fedora Update System 2019-05-15 15:34:19 UTC
gdb-8.3-2.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-fb32e9729e

Comment 9 Fedora Update System 2019-05-15 15:51:28 UTC
gdb-8.2-7.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-7568356d76

Comment 10 Fedora Update System 2019-05-16 02:36:45 UTC
gdb-8.3-2.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-fb32e9729e

Comment 11 Fedora Update System 2019-05-16 04:39:54 UTC
gdb-8.2-7.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-7568356d76

Comment 12 Fedora Update System 2019-05-17 01:06:56 UTC
gdb-8.3-2.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2019-05-18 03:21:03 UTC
gdb-8.2-7.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.