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

Florian Weimer fweimer@redhat.com
Tue Dec 22 13:32:27 GMT 2020


* H. J. Lu via Libc-alpha:

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

Correct, it's always a trade-off backporting something that changes the
offsets.  We can avoid this by using an indirection.

I'd also like to avoid reliance on the preprocessor and switch to a
compressed bit array, without a function call.  This will allow
automation of binding generation for other languages, and eventually a
special relocation could be used to initialize the pointer and length
early.  The last part would enable use in IFUNC selectors.  I've
attached a draft version of the installed header (obviously untested).

For the time being and uses in libc.so.6, we can generalize the existing
_dl_var_init mechanism, but apply this before relocation, right after we
recognize that we have loaded libc.so.6 in _dl_map_object_from_fd.
Something like this is also needed to fix bug 20802.

I'm slightly behind with implementing this, though.

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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: x86.h
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20201222/73baf9e8/attachment.h>


More information about the Libc-alpha mailing list