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 libc/10560] New: [PATCH] Avoid malloc deadlocks in assert() and friends


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.


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