[PATCH] elf: dl-minimal malloc needs to respect fundamental alignment

Florian Weimer fweimer@redhat.com
Mon Jul 11 08:55:00 GMT 2016


On 07/11/2016 04:35 AM, Carlos O'Donell wrote:

> I agree with H.J. here, this should be MALLOC_ALIGNMENT, and if it's larger
> then so be it. It should logically match the behaviour, as best it can, of
> glibc's malloc since we're handing off most commonly to that malloc after
> relocation. Thus I'd like to see the behaviours harmonized.
>
> Other mallocs may not have the same behaviour but that's not a reason to
> avoid MALLOC_ALIGNMENT.

I'm still not convinced.  Obviously, we cannot rely on MALLOC_ALIGNMENT 
anywhere because interposed mallocs may not provide it.  So I still 
don't see the value of compatibility with the main malloc here.

> The discussions about fixing libc malloc's alignment are out of scope for
> this change IMO. We should focus on fixing ld.so's behaviour.
>
> Out of curiosity have you tried to assemble a unit test for these functions
> based on linking directly with dl-minimal.os? It would be nice to run them
> through similar testing as is done by malloc.
>
> OK to checkin if you use MALLOC_ALIGMENT.

This change is not exactly trivial because it's currently defined in 
malloc/malloc.c only.  I will need to post another version for review.

Thanks,
Florian



More information about the Libc-alpha mailing list