On 26/07/18 12:45 -0400, R P Herrold wrote:
On Thu, 26 Jul 2018, Florian Weimer wrote:
> I would like to request a change of the Packaging Guidelines, advising
> packagers not to interpose malloc.
The use here of 'interpose' is unclear to me -- are you saying
'substitute a different' ?
The usual way to replace 'malloc' is via ELF symbol interposition:
https://www.airs.com/blog/archives/307
This means some library provides a definition for the symbol 'malloc'
and that gets used instead of the 'malloc' in libc.so
Symbol interposition means the code continues to call 'malloc' and
'free' but those calls get redirected to different implementations.
The alternative is to explicitly use a different allocator with a
different API, e.g. calling 'foo_malloc' and 'foo_free' instead of
'malloc' and 'free'. The latter case doesn't hijack the symbol and
affect any other shared libraries which want to use malloc, because
those other calls will still use the malloc in libc.