public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler.
@ 2013-04-11 15:02 xavier.bru at bull dot net
  2013-04-12  8:35 ` [Bug gdb/15358] " jan.kratochvil at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: xavier.bru at bull dot net @ 2013-04-11 15:02 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

             Bug #: 15358
           Summary: gdb deadlock due to gdb calling calloc() in signal
                    handler.
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: xavier.bru@bull.net
    Classification: Unclassified


Created attachment 6976
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6976
Traces of manually reprucing the deadlock in calloc()

gdb calls calloc() in signal hanler. It seems that this function is not
reentrant.
If gdb catches a signal in calloc(), it can sometimes deadlock, due to calling
calloc() in the signal handler. 


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


How reproducible: Can be reproduced manually using gdb to stop in calloc().
See attached traces .


Steps to Reproduce:
1. run gdb on gdb
2. set a breakpoint in calloc() after the cmpxchg instruction
3.  send a SIGTERM to gdb

Actual results:
gdb deadlocks


Expected results:
gdb should catch the signal and exit

Additional info:
On HPC cluster, gdb is used a lot by padb, ddt, etc with
a lot of parallel applications and it's very difficult to reproduce the issue
in a testcase, but it has already been found in the deadlock (hereafter a trace
on RHEL 6.1) :

# ps -ef | grep gdb
user   85753    1  0 15:04 ? 00:00:01 gdb --interpreter=mi -q
# gstack 85753
#0 0x000003405ef542e in __lll__lock_wait_private () from /lib64/libc.so.6
#1 0x000003405e7943b in _L_lock_8926 () from /lib64/libc.so.6
#2 0x000003405e7943b in calloc () from /lib64/libc.so.6
#3 0x0000000004159f9 in ?? ()
#4 0x000000000513b7b in ?? ()
#5 0x000000000513cbe in ?? ()
#6 0x0000000004134b7 in ?? ()
#7 <signal handler called>
#8 0x000003405e7a6e4 in _int_realloc () from /lib64/libc.so.6
#9 0x000003405e7aaf5 in realloc () from /lib64/libc.so.6
#10 0x000000000415a5d in ?? ()
#11 0x00000000054e873 in ?? ()
#12 0x000000000557094 in ?? ()
....
#41 0x000000000409869 in ?? ()
#42 0x000003405e1ecdd in __libc_start_main () from /lib64/libc.so.6
....
#50 0x000000000000000 in ?? ()
#

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
@ 2013-04-12  8:35 ` jan.kratochvil at redhat dot com
  2013-04-15  5:10 ` xavier.bru at bull dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-04-12  8:35 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com
         Depends on|                            |15297

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2013-04-12 08:35:19 UTC ---
See also Bug 15297.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
  2013-04-12  8:35 ` [Bug gdb/15358] " jan.kratochvil at redhat dot com
@ 2013-04-15  5:10 ` xavier.bru at bull dot net
  2013-06-17  6:30 ` jan.kratochvil at redhat dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: xavier.bru at bull dot net @ 2013-04-15  5:10 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

Xavier Bru <xavier.bru at bull dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xavier.bru at bull dot net

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
  2013-04-12  8:35 ` [Bug gdb/15358] " jan.kratochvil at redhat dot com
  2013-04-15  5:10 ` xavier.bru at bull dot net
@ 2013-06-17  6:30 ` jan.kratochvil at redhat dot com
  2013-06-17 14:00 ` tromey at redhat dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-06-17  6:30 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
There still may be some issues you describe but doesn't your case rather happen
fore remote gdbserver?  Such case should be fixed by the following pending
patch:
[patch] Fix CTRL-C for remote.c (PR remote/15297)
http://sourceware.org/ml/gdb-patches/2013-06/msg00363.html

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (2 preceding siblings ...)
  2013-06-17  6:30 ` jan.kratochvil at redhat dot com
@ 2013-06-17 14:00 ` tromey at redhat dot com
  2013-07-01 20:36 ` jan.kratochvil at redhat dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tromey at redhat dot com @ 2013-06-17 14:00 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (3 preceding siblings ...)
  2013-06-17 14:00 ` tromey at redhat dot com
@ 2013-07-01 20:36 ` jan.kratochvil at redhat dot com
  2013-07-03  5:31 ` jan.kratochvil at redhat dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-07-01 20:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |jan.kratochvil at redhat dot com

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (4 preceding siblings ...)
  2013-07-01 20:36 ` jan.kratochvil at redhat dot com
@ 2013-07-03  5:31 ` jan.kratochvil at redhat dot com
  2014-03-14 18:38 ` jan.kratochvil at redhat dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-07-03  5:31 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15358

--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
[patch] Fix SIGTERM signal safety (PR gdb/15358)
http://sourceware.org/ml/gdb-patches/2013-07/msg00094.html

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (5 preceding siblings ...)
  2013-07-03  5:31 ` jan.kratochvil at redhat dot com
@ 2014-03-14 18:38 ` jan.kratochvil at redhat dot com
  2014-03-14 18:46 ` jan.kratochvil at redhat dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2014-03-14 18:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
just a new post:

[patch] Fix SIGTERM signal safety (PR gdb/15358) [refresh]
https://sourceware.org/ml/gdb-patches/2014-03/msg00336.html

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (6 preceding siblings ...)
  2014-03-14 18:38 ` jan.kratochvil at redhat dot com
@ 2014-03-14 18:46 ` jan.kratochvil at redhat dot com
  2014-03-18 21:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2014-03-14 18:46 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
[patchv2] Fix SIGTERM signal safety (PR gdb/15358) [refresh]
https://sourceware.org/ml/gdb-patches/2014-03/msg00337.html
Message-ID: <20140314184535.GA30853@host2.jankratochvil.net>

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (7 preceding siblings ...)
  2014-03-14 18:46 ` jan.kratochvil at redhat dot com
@ 2014-03-18 21:51 ` cvs-commit at gcc dot gnu.org
  2014-03-18 21:52 ` jan.kratochvil at redhat dot com
  2023-02-15 21:34 ` pedro at palves dot net
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-03-18 21:51 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  06c868a8dc5ef46ab7dd6601c8bc2f417e415af9 (commit)
      from  dea80df0999ae0bad56e79af2a88a30be38bb8e4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=06c868a8dc5ef46ab7dd6601c8bc2f417e415af9

commit 06c868a8dc5ef46ab7dd6601c8bc2f417e415af9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Mar 18 22:48:06 2014 +0100

    Fix SIGTERM signal safety (PR gdb/15358).

    gdb/
    2014-03-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

        PR gdb/15358
        * defs.h (sync_quit_force_run): New declaration.
        (QUIT): Check also SYNC_QUIT_FORCE_RUN.
        * event-top.c (async_sigterm_handler): New declaration.
        (async_sigterm_token): New variable.
        (async_init_signals): Create also async_sigterm_token.
        (async_sigterm_handler): New function.
        (sync_quit_force_run): New variable.
        (handle_sigterm): Replace quit_force call by other calls.
        * utils.c (quit): Call quit_force if SYNC_QUIT_FORCE_RUN.

    gdb/testsuite/
    2014-03-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

        PR gdb/15358
        * gdb.base/gdb-sigterm.c: New file.
        * gdb.base/gdb-sigterm.exp: New file.

    Message-ID: <20140316135334.GA30698@host2.jankratochvil.net>

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                          |   13 ++++
 gdb/defs.h                             |    5 +-
 gdb/event-top.c                        |   27 ++++++++-
 gdb/testsuite/ChangeLog                |    6 ++
 gdb/testsuite/gdb.base/gdb-sigterm.c   |   26 +++++++++
 gdb/testsuite/gdb.base/gdb-sigterm.exp |   96 ++++++++++++++++++++++++++++++++
 gdb/utils.c                            |    6 ++
 7 files changed, 176 insertions(+), 3 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/gdb-sigterm.c
 create mode 100644 gdb/testsuite/gdb.base/gdb-sigterm.exp

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (8 preceding siblings ...)
  2014-03-18 21:51 ` cvs-commit at gcc dot gnu.org
@ 2014-03-18 21:52 ` jan.kratochvil at redhat dot com
  2023-02-15 21:34 ` pedro at palves dot net
  10 siblings, 0 replies; 12+ messages in thread
From: jan.kratochvil at redhat dot com @ 2014-03-18 21:52 UTC (permalink / raw)
  To: gdb-prs

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

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.8

--- Comment #7 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Checked in.

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


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

* [Bug gdb/15358] gdb deadlock due to gdb calling calloc() in signal handler.
  2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
                   ` (9 preceding siblings ...)
  2014-03-18 21:52 ` jan.kratochvil at redhat dot com
@ 2023-02-15 21:34 ` pedro at palves dot net
  10 siblings, 0 replies; 12+ messages in thread
From: pedro at palves dot net @ 2023-02-15 21:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15358
Bug 15358 depends on bug 15297, which changed state.

Bug 15297 Summary: CTRL-C with set debug remote often crashes GDB
https://sourceware.org/bugzilla/show_bug.cgi?id=15297

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

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

end of thread, other threads:[~2023-02-15 21:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-11 15:02 [Bug gdb/15358] New: gdb deadlock due to gdb calling calloc() in signal handler xavier.bru at bull dot net
2013-04-12  8:35 ` [Bug gdb/15358] " jan.kratochvil at redhat dot com
2013-04-15  5:10 ` xavier.bru at bull dot net
2013-06-17  6:30 ` jan.kratochvil at redhat dot com
2013-06-17 14:00 ` tromey at redhat dot com
2013-07-01 20:36 ` jan.kratochvil at redhat dot com
2013-07-03  5:31 ` jan.kratochvil at redhat dot com
2014-03-14 18:38 ` jan.kratochvil at redhat dot com
2014-03-14 18:46 ` jan.kratochvil at redhat dot com
2014-03-18 21:51 ` cvs-commit at gcc dot gnu.org
2014-03-18 21:52 ` jan.kratochvil at redhat dot com
2023-02-15 21:34 ` pedro at palves dot net

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).