[PATCH v3] malloc: Fix list_lock/arena lock deadlock [BZ #19182]
Florian Weimer
fweimer@redhat.com
Thu Dec 17 19:18:00 GMT 2015
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).
Florian
More information about the Libc-alpha
mailing list