public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends
@ 2009-08-25 19:03 ajax at redhat dot com
  2009-08-25 19:04 ` [Bug libc/10560] " ajax at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ajax at redhat dot com @ 2009-08-25 19:03 UTC (permalink / raw)
  To: glibc-bugs

In chasing a malloc bookkeeping corruption bug in X, I hit the following deadlock:

#1  0x00a66873 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x009ef8b4 in _L_lock_9686 () from /lib/libc.so.6
#3  0x009ed914 in malloc () from /lib/libc.so.6
#4  0x009e1718 in vasprintf () from /lib/libc.so.6
#5  0x009c3eeb in asprintf () from /lib/libc.so.6
#6  0x0099dc3d in __assert_fail () from /lib/libc.so.6
#7  0x009ec47d in _int_malloc () from /lib/libc.so.6
#8  0x009ed91e in malloc () from /lib/libc.so.6
#9  0x0095ba15 in pcfReadFont () from /usr/lib/libXfont.so.1
#10 0x0095667b in ?? () from /usr/lib/libXfont.so.1
#11 0x00949d03 in ?? () from /usr/lib/libXfont.so.1
#12 0x0095a11f in BitmapOpenScalable () from /usr/lib/libXfont.so.1
[...]

Not awesome.  There's a number of ways around this, the most straightforward of
which seems to be gcc variable-length arrays and sprintf'ing the error string
into that.  Attached patch does this.

Other options would include walking the args to __assert_fail() directly.  I
don't really have an opinion, and am willing to implement whatever is preferred.

-- 
           Summary: [PATCH] Avoid malloc deadlocks in assert() and friends
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: ajax at redhat dot com
                CC: glibc-bugs at sources dot redhat dot com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10560] [PATCH] Avoid malloc deadlocks in assert() and friends
  2009-08-25 19:03 [Bug libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends ajax at redhat dot com
@ 2009-08-25 19:04 ` ajax at redhat dot com
  2009-08-25 19:19 ` roland at gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ajax at redhat dot com @ 2009-08-25 19:04 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ajax at redhat dot com  2009-08-25 19:03 -------
Created an attachment (id=4150)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4150&action=view)
glibc-mallocless-assert.patch


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10560] [PATCH] Avoid malloc deadlocks in assert() and friends
  2009-08-25 19:03 [Bug libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends ajax at redhat dot com
  2009-08-25 19:04 ` [Bug libc/10560] " ajax at redhat dot com
@ 2009-08-25 19:19 ` roland at gnu dot org
  2009-08-31 11:46 ` drepper at redhat dot com
  2009-08-31 11:57 ` drepper at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: roland at gnu dot org @ 2009-08-25 19:19 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From roland at gnu dot org  2009-08-25 19:19 -------
It's not at all clear to me why it doesn't use __fxprintf directly, or indeed
just use __dprintf.

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10560] [PATCH] Avoid malloc deadlocks in assert() and friends
  2009-08-25 19:03 [Bug libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends ajax at redhat dot com
  2009-08-25 19:04 ` [Bug libc/10560] " ajax at redhat dot com
  2009-08-25 19:19 ` roland at gnu dot org
@ 2009-08-31 11:46 ` drepper at redhat dot com
  2009-08-31 11:57 ` drepper at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2009-08-31 11:46 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2009-08-31 11:46 -------
The reason malloc is used is so that in case you see a core file but no console
output you know what was going on.  Using the stack memory is not sufficient in
this case.  The __abort_msg variable was deliberately introduced and is visible
to the debugger and other tools.

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10560] [PATCH] Avoid malloc deadlocks in assert() and friends
  2009-08-25 19:03 [Bug libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends ajax at redhat dot com
                   ` (2 preceding siblings ...)
  2009-08-31 11:46 ` drepper at redhat dot com
@ 2009-08-31 11:57 ` drepper at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2009-08-31 11:57 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2009-08-31 11:57 -------
Fixed upstream.

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


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2009-08-31 11:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-25 19:03 [Bug libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends ajax at redhat dot com
2009-08-25 19:04 ` [Bug libc/10560] " ajax at redhat dot com
2009-08-25 19:19 ` roland at gnu dot org
2009-08-31 11:46 ` drepper at redhat dot com
2009-08-31 11:57 ` drepper at redhat dot com

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