[PATCH] Don't fall back to mmap if the original arena is not corrupt
Mike Frysinger
vapier@gentoo.org
Wed Aug 19 13:50:00 GMT 2015
On 19 Aug 2015 14:32, Siddhesh Poyarekar wrote:
> The new logic to find an uncontended non-corrupt arena misses a case
> where the current arena is contended, but is not corrupt. In the
> degenerate case, this is the only arena. In both cases, the logic
> falls back to using mmap despite there being an available arena.
>
> Attached patch by Josef Bacik makes sure that all arenas are indeed
> corrupt before falling back to malloc. Verified on x86_64.
verified how ?
> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -823,16 +823,21 @@ reused_arena (mstate avoid_arena)
>
> /* Make sure that the arena we get is not corrupted. */
> mstate begin = result;
> + bool looped = false;
> +
> while (arena_is_corrupt (result) || result == avoid_arena)
> {
> result = result->next;
> if (result == begin)
> - break;
> + {
> + looped = true;
> + break;
> + }
> }
>
> /* We could not find any arena that was either not corrupted or not the one
> we wanted to avoid. */
> - if (result == begin || result == avoid_arena)
> + if (looped)
> return NULL;
doesn't this comment explicitly say you don't want to use the avoid arena ?
doesn't it need updating now with this change in logic ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150819/44fd6694/attachment.sig>
More information about the Libc-alpha
mailing list