[PATCH] posix: Call internal free on fallback p{read,write}v on Linux (BZ#22457)

Florian Weimer fweimer@redhat.com
Thu Nov 23 12:25:00 GMT 2017


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



More information about the Libc-alpha mailing list