This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] malloc: Rewrite dumped heap for compatibility in __malloc_set_state
- From: DJ Delorie <dj at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 11 May 2016 17:18:13 -0400
- Subject: Re: [PATCH] malloc: Rewrite dumped heap for compatibility in __malloc_set_state
- Authentication-results: sourceware.org; auth=none
Florian Weimer <fweimer@redhat.com> writes:
> (do_check_chunk): Skip dumped fake mmaped chunks.
mmapped or mmap'd ? Given we have chunk_is_mmapped() "mmapped" should
be preferred over "mmaped".
Based on the code changes, I see that you're simply discarding anything
that used to be in the various free lists, so they can never be returned
by malloc, and thus never violate the new ABI. I suggest a comment to
that effect in _malloc_set_state(), since it won't be obvious if you're
only looking at new code (it's obvious when you compare old-v-new).
Otherwise, assuming your intent is "throw away everything from before
the dump", I think you've nailed it :-)
We should probabably document the wasted memory in the
_malloc_set_state() documentation, if we had documentation for it...
Your code changes data in the main heap, but doesn't lock the main heap.
Is _malloc_set_state() supposed to be thread-safe? If so, you should
lock the heap just to ensure that the changes are visible to other
threads.