This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 770
  possible deadlock on double-free logging Last modified: 2008-04-30 20:27:35
     Query page      Enter new bug
Bug#: 770   Hardware:   Reporter: Jakub Bogusz <qboosh@pld-linux.org>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: NEW   Priority:  
Resolution:   Severity:  
Assigned To: GOTO Masanori <gotom@debian.or.jp>   Target Milestone:  
Flags: Requestee:
  backport ()
  examined ()
  testsuite ()
Summary:
Keywords:

Attachment Description Type Created Actions
doublefree-deadlock.c testcase for deadlock on double-free logging text/x-c 2005-02-26 21:35 Edit None
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 770 depends on: Show dependency tree
Show dependency graph
Bug 770 blocks:

Additional Comments:


Leave as NEW 
Mark bug as waiting for feedback
Mark bug as suspended
Accept bug (change status to ASSIGNED)
Resolve bug, changing resolution to
Resolve bug, mark it as duplicate of bug #
Reassign bug to
Reassign bug to owner of selected component

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2005-02-26 21:29
_int_free() (malloc/malloc.c), which is called from free() with arena mutex
locked, checks and eventually prints/logs error message.
So if malloc_printerr() handling do some malloc()/free() on the same memory
arena, deadlock can occur.
vsyslog() can call free() during tz manipulation.

Yes, this deadlock is triggered by buggy code.
But it's all inside libc, not caused by actual memory corruption.

------- Additional Comment #1 From Jakub Bogusz 2005-02-26 21:35 -------
Created an attachment (id=424)
testcase for deadlock on double-free logging

Simplified testcase to trigger deadlock (originally it was detected in daemon
which didn't want to exit on SIGPIPE when run on NPTL libc - it tried to do
double shutdown).

Deadlock occurs on NPTL libc or when it's linked with linuxthreads libpthread.
When run on just linuxthreads libc it logs double-free error and aborts
(as there is no real locking in single-thread code).

------- Additional Comment #2 From Jakub Bogusz 2005-02-26 21:37 -------
*** Bug 771 has been marked as a duplicate of this bug. ***

------- Additional Comment #3 From Jakub Bogusz 2005-02-26 21:38 -------
*** Bug 772 has been marked as a duplicate of this bug. ***

------- Additional Comment #4 From Nick Lamb 2008-04-30 20:27 -------
This happens to us once a day or so (obviously the double-free that causes the
problem is periodic in some fashion). For us deadlocking is mostly worse than
just allowing some potential corruption due to a double-free.

We are using glibc-2.5-12 x86-64 on a CentOS 5 machine.

Here are some musings from #glibc IRC where I reported that I had seen this bug.

<ryanarn> hrm.. that one's been about for a while.  I wonder why there's been no
movement on it.
<sjmunroe> the mutex it locked in free which calls _int_free(), so _int_free
does not know about the lock
<sjmunroe> to avoid this _int_free would have to report the error back to free
so free could do the unlock before reposting the error

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In