This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: Call internal free on fallback p{read,write}v on Linux (BZ#22457)
- From: Florian Weimer <fweimer at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Thu, 23 Nov 2017 13:25:43 +0100
- Subject: Re: [PATCH] posix: Call internal free on fallback p{read,write}v on Linux (BZ#22457)
- Authentication-results: sourceware.org; auth=none
- References: <1511438786-32436-1-git-send-email-adhemerval.zanella@linaro.org>
On 11/23/2017 01:06 PM, Adhemerval Zanella wrote:
As described in BZ#22457 an interpose malloc can free an invalid
pointer for fallback preadv implementation. Fortunately this is
just and issue on microblaze-linux-gnu running kernels older than
3.15.
This patch fixes it by calling internal free (__libc_free). Another
possible option would be replace posix_memalign/free with a mmap/unmap,
however this is pessimization since it will two more syscalls necessary
for each preadv/pwritev call.
This will break static malloc interposition because some of the
functions in malloc/malloc.o are not weak.
With an interposed malloc, the glibc malloc may not have been
initialized, so you will have to supply your own locking here, too.
I think you should use mmap/munmap.
Thanks,
Florian