[PATCH] Use correct type for glibc.malloc.perturb in tst-tunconf1.c

Stefan Liebler stli@linux.ibm.com
Mon Jul 13 08:32:53 GMT 2026


On 7/12/26 14:56, Andreas K. Huettel wrote:
> Am Samstag, 11. Juli 2026, 01:35:30 Japanische Normalzeit schrieb DJ Delorie:
>> Stefan Liebler <stli@linux.ibm.com> writes:
>>> According to elf/dl-tunables.list, glibc.malloc.perturb is of type
>>> int32_t (4byte) and not size_t (8byte) which was used for
>>> TUNABLE_GET_FULL inside the testcase.  Therefore the correct 32bit
>>> value 0x2a=42 is written to the to the wrong place and leads to the
>>> comparison failure.
>>
>> I'm wondering how it passed for me...  does it only show up on MSB systems?
> 
> I only saw it on s390x too.
> 
I didn't saw it on x86_64 because there the other half was by chance 0x0.

>>
>>> +  printf("perturb is %d (should be 42, from /etc)\n",
>>> +	 perturb);
>>
>> Do we know that %d matches int32_t on all platforms?  Or should we cast
>> this to (int) ?
> 
> Best I could find in a draft of the C standard floating on the internets, 
> in the section on fprintf %d is specified to be of type int.
> 
> Which is, to my best knowledge, 32bit everywhere we can run Linux.
> 
I've just sent a V2 of this patch using PRId32 and also used %zu for the
other size_t values.

Please have a look:
https://inbox.sourceware.org/libc-alpha/20260713083153.2984552-1-stli@linux.ibm.com/T/#u

Thanks,
Stefan


More information about the Libc-alpha mailing list