OSDN Git Service

malloc: checked_request2size failure deadlocks
authorZhiqiang Zhang <zhangzhiqiang.zhang@huawei.com>
Wed, 18 Mar 2015 10:44:50 +0000 (18:44 +0800)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wed, 18 Mar 2015 21:33:43 +0000 (22:33 +0100)
commit85cfbc035370d2a3715ea9de3e590ba83fae52d1
tree068f977c2a1ec798f062d3b6f2a9d023572350bc
parent6c4538905e65ceb203f59aaa9a61728e81c6bc0a
malloc: checked_request2size failure deadlocks

For some rarely cases(almost App bugs), calling malloc with
a very largre size, checked_request2size check will fail,set
ENOMEM, and return 0 to caller.

But this will let __malloc_lock futex locked and owned by the
caller. In multithread circumstance, other thread calling
malloc/calloc will NOT succeed and get locked.

Signed-off-by: Zhiqiang Zhang <zhangzhiqiang.zhang@huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/stdlib/malloc-standard/malloc.c
libc/stdlib/malloc-standard/memalign.c
libc/stdlib/malloc-standard/realloc.c