[PATCH] elf: dl-minimal malloc needs to respect fundamental alignment
Florian Weimer
fweimer@redhat.com
Tue Jun 21 13:06:00 GMT 2016
On 06/21/2016 03:00 PM, H.J. Lu wrote:
>> MALLOC_ALIGNMENT is potentially larger. malloc/tst-malloc-thread-fail tests
>> for alignment. To my knowledge, it passes on all regularly tested
>> architectures after commit dea39b13e2958a7f0e75b5594a06d97d61cc439f.
>
> MALLOC_ALIGNMENT is kind of mapped to the malloc alignment of
> a psABI. Shouldn't ld.so malloc have the same alignment of libc malloc?
I don't see why. MALLOC_ALIGNMENT has to match both the ABI constraint
and the malloc/malloc.c implementation constraint (which requires a
minimum alignment of 2 * sizeof (size_t)).
Other mallocs do not have matching implementation constraints, and it is
standard practice (in non-glibc mallocs) to lower the alignment for
allocations which are smaller in size than _Alignof (max_align_t),
although this is not compliant with C11.
Florian
More information about the Libc-alpha
mailing list