This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v1.1 0/7] aarch64: Allow overriding HWCAP_CPUID feature check


On 11/05/2017 11:51, Siddhesh Poyarekar wrote:
> Hi,
> 
> This set of patches moves LD_HWCAP_MASK environment variable to tunables
> as glibc.tune.hwcap_mask and gets all of its uses using tunables instead.
> This is needed to override the HWCAP_CPUID bit for aarch64 to allow
> disabling of the multiarch MIDR check if needed.
> 
> The patchset enhances the tunables framework further for this and as a
> result, the tunable_list is now laid out in the .relro section so that it
> cannot be modified after relocations have been processed.  Also, tunables
> can now be set to have a default value, and can also take unsigned int64
> values.
> 
> I have done a sanity test of this patchset on aarch64 and seems to work
> just fine.  x86 would perhaps benefit from a similar delaying of
> cpu_features reading for static binaries so that they can be overriden by
> tunables in future (an aarch64 patch coming up; spoiler alert: the tunable
> name proposed is glibc.tune.mcpu) but I haven't done that at this time
> since it is not necessary for this patchset.
> 
> Update from last set:
> 
>  - Fixed up removal of dl_hwcap_mask in one case I missed during rebase.

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.


> 
> Siddhesh
> 
> 
> Siddhesh Poyarekar (7):
>   tunables: Specify a default value for tunables
>   tunables: Add support for tunables of uint64_t type
>   tunables: Add hooks to get and update tunables
>   tunables: Add LD_HWCAP_MASK to tunables
>   tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask
>   Delay initialization of CPU features struct in static binaries
>   aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK
> 
>  csu/libc-start.c                               |   6 ++
>  elf/dl-cache.c                                 |   9 +-
>  elf/dl-hwcaps.c                                |  15 ++-
>  elf/dl-support.c                               |   2 +
>  elf/dl-tunable-types.h                         |   1 +
>  elf/dl-tunables.c                              | 142 ++++++++++++++-----------
>  elf/dl-tunables.h                              |  43 +++++---
>  elf/dl-tunables.list                           |   7 ++
>  elf/rtld.c                                     |   4 +
>  scripts/gen-tunables.awk                       |  13 ++-
>  sysdeps/generic/ldsodefs.h                     |   2 +
>  sysdeps/sparc/sparc32/dl-machine.h             |   7 +-
>  sysdeps/unix/sysv/linux/aarch64/cpu-features.c |  15 ++-
>  sysdeps/unix/sysv/linux/aarch64/libc-start.c   |  23 +---
>  sysdeps/x86/cpu-features.c                     |   4 +
>  sysdeps/x86/libc-start.c                       |  23 +---
>  16 files changed, 192 insertions(+), 124 deletions(-)
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]