-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike Frysinger wrote:
> On Friday 17 July 2009 01:36:37 Carmelo AMOROSO wrote:
>> I've recently added for testing hidden_proto in {m,re,c}alloc functions to
>> ensure that from within the libc we always called the hidden __GI_xxx
>> symbols.
>>
>> Using this uClibc with firefox and bash I found a problem.
>> Both bash and firefox provide a their own implementation of memory
>> allocation functions (bash internally, firefox by libejmalloc.so).
>>
>> Because the dynamic linker will search undefined symbols firstly in the
>> application, any reference to malloc/free functions will be resolved by the
>> application's symbols.
>>
>> If we use the hidden_protos, calls to malloc/free from libc are resolved
>> inside libc itslef at it is expected.
>>
>> Now we have getcwd and strdup that use malloc for allocate memory and
>> return the pointer to the caller. This memory is after freed by the
>> application, calling free(), that is not the libc one implementation,
>> leading to error, sigbus and so on.
>>
>> Do you think it is wrong to use the hidden_protos for this class of
>> functions, or we should think better at how internal symbols are actually
>> used by uClibc ?
> 

Hi Mike,

> i didnt quite understand this e-mail originally.  i thought you were saying 
> you added tests only, not that you also added the hidden aliases to the 
> allocation functions.  

I added them indeed,
> if you want to make a new config option ("Allow malloc 
> to be overridden dynamically"), that's fine. 

No, I don't.

> but the default should be what 
> we have today -- the malloc symbols can be resolved dynamically at runtime.  
> this is how many debugging libraries work in the first place -- they provide 
> the malloc() and related symbols.
> 

this is the answer I was looking for. I thought to remove the relocation for 
malloc too,
but I was wrong.

> i dont know what you mean by "think better" as the current stuff should be 
> correct already.  the number of relocs in the C library is very small for 
> functions which is the point of these hidden aliases. 

> looking at latest git i
> see one or two missing, but those should be easy to fix.
> -mike

Thanks a lot.
Carmelo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkpkVkgACgkQoRq/3BrK1s8EWwCfal0HukKy/x2wrIx1BpS1dz62
BlQAn2Rsd/5ddVZ5So9QFY9AQ09EU0gh
=3ZCF
-----END PGP SIGNATURE-----
_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to