[PATCH v3] malloc: Fix list_lock/arena lock deadlock [BZ #19182]
Torvald Riegel
triegel@redhat.com
Thu Dec 17 19:28:00 GMT 2015
On Thu, 2015-12-17 at 20:18 +0100, Florian Weimer wrote:
> On 12/17/2015 08:05 PM, Torvald Riegel wrote:
>
> >> + (void) mutex_lock (&free_list_lock);
> >> + detach_arena (replaced_arena);
> >> + (void) mutex_unlock (&free_list_lock);
> >> +
> >> + /* Lock this arena. NB: We may not have exclusive access to this
> >> + arena anymore because the arena is now accessible from the
> >> + main_arena.next list and could have been picked by reused_arena
> >> + in the meantime. This can only happen for the last arena created
> >> + (before the arena limit is reached). This seems unlikely, so we
> >> + do not protect against this special case. */
> >
> > "This seems unlikely" is not sufficient for correctness, IMO.
>
> Just one quick comment: It's not a correctness issue. I will clarify
> that the new arena can be attached to multiple threads (not a problem
> because there is proper locking, it's just a surprising aspect we should
> document).
OK. Pointing out that this is just a relevant for performance and not a
correctness issue would be good.
More information about the Libc-alpha
mailing list