Re: [RFC PATCH 2/4] rseq: Allow extending struct rseq

From: Mathieu Desnoyers
Date: Wed Jul 15 2020 - 11:26:38 EST


----- On Jul 15, 2020, at 10:58 AM, Florian Weimer fweimer@xxxxxxxxxx wrote:

> * Mathieu Desnoyers:
>
>> ----- On Jul 15, 2020, at 9:42 AM, Florian Weimer fweimer@xxxxxxxxxx wrote:
>>> * Mathieu Desnoyers:
>>>
>> [...]
>>>> How would this allow early-rseq-adopter libraries to interact with
>>>> glibc ?
>>>
>>> Under all extension proposals I've seen so far, early adopters are
>>> essentially incompatible with glibc rseq registration. I don't think
>>> you can have it both ways.
>>
>> The basic question I'm not sure about is whether we are allowed to increase
>> the size and alignement of __rseq_abi from e.g. glibc 2.32 to glibc 2.33.
>
> With the current mechanism (global TLS data symbol), we can do that
> using symbol versioning. That means that we can only do this on a
> release boundary,

That should not be a problem.

> and that it's incompatible with other libraries which
> use an interposing unversioned symbol.

We have the freedom to define the ABI of this shared __rseq_abi symbol
right now. Maybe it's not such a good thing to let early adopters use
unversioned __rseq_abi symbols.

Let me wrap my head around this scenario then, please let me know if
I'm misunderstanding something:

1) glibc 2.32 exposes:
__rseq_abi (GLIBC_2.32) with size == 32.
__rseq_abi with size == 32 is available as a private symbol within glibc
- both symbols alias the same contents.

2) glibc 2.33 exposes:
__rseq_abi (GLIBC_2.32) with size == 32.
__rseq_abi (GLIBC_2.33) with size == 64.
__rseq_abi with size == 64 is available as a private symbol within glibc
- the three symbols alias the same contents.

Then what happens if we have a program or preloaded library defining
__rseq_abi (without version) with size == 32 loaded with a glibc 2.33 ?

Or what happens if we have a program or preloaded libary defining
__rseq_abi (GLIBC_2.32) with size == 32 loaded with a glibc 2.33 ?

I wonder if "GLIBC_*" is the right version namespace for this. Considering
that the layout of this structure is defined by the Linux kernel UAPI, maybe
we'd want version named as "RSEQ_1.0", "RSEQ_2.0" or something similar.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com