This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to detect symbol interposition?


On 28 Jun 2016 20:01, Florian Weimer wrote:
> 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.

just getline ?  or that's just where you want to start ?

> 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.

i guess this kind of tails into the other discussion about how we don't
document interposing memory symbols and how today, you can't just replace
a single one and have it work.  and how sometimes you can get away with
just a few, but in reality if you don't do them all, bad things happen.
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]