This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How to detect symbol interposition?
- From: Florian Weimer <fweimer at redhat dot com>
- To: libc-help <libc-help at sourceware dot org>
- Date: Tue, 28 Jun 2016 20:01:30 +0200
- Subject: Re: How to detect symbol interposition?
- Authentication-results: sourceware.org; auth=none
- References: <82beb432-5022-3b05-0877-8b9883cb004c at redhat dot com> <20160628175618 dot GC4685 at vapier dot lan>
On 06/28/2016 07:56 PM, Mike Frysinger wrote:
On 28 Jun 2016 16:12, Florian Weimer wrote:
I need a way to detect symbol interposition from within libc.
why ?
I want to add a hardened variant of getline which uses
malloc_usable_size to check chunk size and specified size for consistency.
Not all interposed mallocs interpose malloc_usable_size as well, so I
need to check for
(malloc == __libc_malloc)
== (malloc_usable_size == _libc_malloc_usable_size)
and only do this if equality holds.
Another application is initialization for glibc malloc. To reduce the
number of function pointers, I would like to remove the malloc hooks.
But this means that we need to remove lazy initialization of malloc. I
want to add an explicit call into malloc to perform basically what
ptmalloc_init does today, but only if glibc malloc has not been interposed.
Thanks,
Florian