This is the mail archive of the 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/
#2  0x009ef8b4 in _L_lock_9686 () from /lib/
#3  0x009ed914 in malloc () from /lib/
#4  0x009e1718 in vasprintf () from /lib/
#5  0x009c3eeb in asprintf () from /lib/
#6  0x0099dc3d in __assert_fail () from /lib/
#7  0x009ec47d in _int_malloc () from /lib/
#8  0x009ed91e in malloc () from /lib/
#9  0x0095ba15 in pcfReadFont () from /usr/lib/
#10 0x0095667b in ?? () from /usr/lib/
#11 0x00949d03 in ?? () from /usr/lib/
#12 0x0095a11f in BitmapOpenScalable () from /usr/lib/

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

------- 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]