This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Check GLIBC_IFUNC to enable/disable ifunc features
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, Carlos O'Donell <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, Siddhesh Poyarekar <sid at reserved-bit dot com>
- Cc: <nd at arm dot com>
- Date: Thu, 30 Jun 2016 15:39:23 +0100
- Subject: Re: PATCH: Check GLIBC_IFUNC to enable/disable ifunc features
- Authentication-results: sourceware.org; auth=none
- Nodisclaimer: True
- References: <CAMe9rOq1+_rMbs1mt3=Md=Wx=7ZxUbD+BhOx-qrO5TBRBrRLww at mail dot gmail dot com> <20160630013716 dot GY4685 at vapier dot lan> <CAMe9rOrgshV6t5quE01r_oc91ps0JJ7fYfAC=MuQOs96qNv1uQ at mail dot gmail dot com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 30/06/16 03:56, H.J. Lu wrote:
> The environment
> variable, GLIBC_IFUNC=xxx=0:yyy=1:zzz=0...., can be used to enable
> CPU/ARCH feature yyy, disable CPU/ARCH feature yyy and zzz, where the
> feature name is case-sensitive and has to match the ones in
> cpu-features.h. It can be used by glibc developers to override the
> IFUNC selection to improve performance for a particular workload or
> tune for a new processor.
>
since it is for glibc devs only is it expected to be
stable across glibc versions?
may be the env var name could reflect that it is not
a public api.
> Since all CPU/ARCH features are hardware optimizations without security
> implication, except for Prefer_MAP_32BIT_EXEC, which can only be disabled,
> we check GLIBC_IFUNC for programs, including set*id ones.
>
i think it can have security implications, but probably not significant.
> NOTE: the IFUNC selection may change over time. Please check all
> multiarch implementations when experimenting.
>
> +init_cpu_features (struct cpu_features *cpu_features, char **env)
...
> + while (*env != NULL)
> + {
> + const char *p, *end;
> + size_t len = sizeof ("GLIBC_IFUNC=");
> +
> + end = *env;
> + for (p = end; *p != '\0'; p++)
> + if (--len == 0 && equal (end, "GLIBC_IFUNC=", 12))
> + {
> + len = strlen (p);
is this x86_64 only?
how can strlen work before ifunc is done?
(i think strlen is ifunc resolved on i386)
i know ld.so is careful about this, but i think
with static linking ifunc resolved functions
should not be called before apply_irel is done