How to detect symbol interposition?
Florian Weimer
fweimer@redhat.com
Tue Jun 28 18:01:00 GMT 2016
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
More information about the Libc-help
mailing list