This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v1.1 0/7] aarch64: Allow overriding HWCAP_CPUID feature check
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Siddhesh Poyarekar <siddhesh at gotplt dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, <libc-alpha at sourceware dot org>
- Cc: <nd at arm dot com>
- Date: Fri, 12 May 2017 13:10:47 +0100
- Subject: Re: [PATCH v1.1 0/7] aarch64: Allow overriding HWCAP_CPUID feature check
- Authentication-results: sourceware.org; auth=none
- Authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- References: <1494514306-4167-1-git-send-email-siddhesh@sourceware.org> <89658c48-db20-8e5d-d3e9-b810e6f44768@linaro.org> <d4004280-ee0b-8559-6207-221fe96dc5bd@gotplt.org>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 11/05/17 17:49, Siddhesh Poyarekar wrote:
> On Thursday 11 May 2017 09:08 PM, Adhemerval Zanella wrote:
>> It has fixed x86 build, however I am still seeing a runtime failure with:
>>
>> FAIL: elf/tst-env-setuid
>>
>> Which basically does:
>>
>> $ env GCONV_PATH=/home/azanella/Projects/glibc/build/x86_64-linux-gnu/iconvdata LOCPATH=/home/azanella/Projects/glibc/build/x86_64-linux-gnu/localedata LC_ALL=C MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 LD_HWCAP_MASK=0xffffffff /home/azanella/Projects/glibc/build/x86_64-linux-gnu/elf/tst-env-setuid
>> : error while loading shared libraries: cannot create capability list: Cannot allocate memory
>>
>> It is failing on elf/dl-hwcaps.c:
>>
>> 201 /* The result structure: we use a very compressed way to store the
>> 202 various combinations of capability names. */
>> 203 *sz = 1 << cnt;
>> 204 result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
>> 205 if (result == NULL)
>> 206 _dl_signal_error (ENOMEM, NULL, NULL,
>> 207 N_("cannot create capability list"));
>>
>> With a total value being way too large. I am still digesting why exactly
>> this value is being too large.
>
> Heh, I think I know what is going on. There are two places where it
> fails with the exact same error, and both can be reached when there are
> too many bits set in DL_HWCAP_IMPORTANT. Setting LD_HWCAP_MASK to
> 0xffffffff in the test case is crossing both limits I assume. The fact
> that I don't see the failure and you do seems to be because of malloc
> not failing on my system and failing on yours. This may be due to
> differences in overcommit behaviour.
>
it seems LD_HWCAP_MASK affects ldso behaviour,
(some library search path is computed based on
"important" hwcap names)
so it's probably not a good idea to reuse it for
ifunc dispatch tuning of the libc.
(the exact semantics of the LD_HWCAP_MASK is not
clear to me though)
> Fix is to reduce the number of bits set in the test, so really just this
> (untested) patch should do, can you please confirm?
>
> Thanks,
> Siddhesh
>
> ChangeLog:
>
> * elf/Makefile (tst-env-setuid-ENV): Set LD_HWCAP_MASK to 0x1.
>