This is the mail archive of the libc-alpha@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]

Re: [PATCH 4/5] Fix deadlock in _int_free consistency check


On 10/12/2017 12:18 PM, Wilco Dijkstra wrote:
Florian Weimer wrote:
I don't think the subject line is correct.  What is the deadlock?  I
don't see it.

-	if (!have_lock
-	    || ({ __libc_lock_lock (av->mutex);

It's right there. Have_lock means you've just done __libc_lock_lock (av->mutex),
so doing it again (same thread) implies deadlock.

Hmm.

So if we enter this code path with have_lock, we don't have to re-do the check, but malloc_printerr will be called in the end anyway, so this is not the interesting case.

In practice, without heap corruption, the lock will be acquired here and re-checking is needed, so I think your cleanup is okay after all. The logic is indeed much clearer.

Thanks,
Florian


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