Compatibility issues around <sys/platform/x86.h>

Florian Weimer fweimer@redhat.com
Mon Dec 21 13:00:14 GMT 2020


I finally had some time to review the <sys/platform/x86.h> interface.

I have two major concerns:

(a) Placement of struct cpu_features in _rtld_global_ro

This means that backporting new feature support changes the internal
GLIBC_PRIVATE ABI. Consequently, there's a race condition during
in-place updates where loading binaries can fail in obscure ways, due to
the change in _rtld_global_ro offsets.  We should really avoid this.

(c) The COMMON_CPUID_INDEX_MAX handshake does not work.

__x86_get_cpu_features returns NULL if its argument is too large.  This
effectively disables *all* feature bits, not just those beyond
COMMON_CPUID_INDEX_MAX. This means that if you build with a header that
is too new, an application may fail due to the lack of detected features
when running on an older glibc version.  Ideally, only the newly added
CPU features would be detected as missing in this scenario.  Simply
recompiling an application with a newer header should not result in any
detection changes.


Not quite a major concern is that this feature is not usable from IFUNC
resolvers with BIND_NOW, which I consider an important use of CPU
feature selection.  I do not have a good solution here that can be
implemented in time for glibc 2.33.  I expect that a proper solution
will require some binutils work.

I'm going to work on this with priority this week and hope to have
patches posted by the 24th.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list