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

H.J. Lu hjl.tools@gmail.com
Mon Dec 21 17:05:06 GMT 2020


On Mon, Dec 21, 2020 at 5:00 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> 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.

This applies to all members in _rtld_global_ro.

> (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

Can you open a glibc bug?  It shouldn't be too hard to fix.  I can take
a look if you don't have time.

> 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.

Can you open a glibc bug?

> 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
>


-- 
H.J.


More information about the Libc-alpha mailing list