[PATCH v2 3/3] Linux: Add tests that check that TLS and rseq area are separate

Michael Jeanson mjeanson@efficios.com
Tue Jan 14 15:22:47 GMT 2025


On 2025-01-14 01:40, Florian Weimer wrote:
> * Michael Jeanson:
> 
>> On 2025-01-13 07:33, Florian Weimer wrote:
>>> +static void
>>> +add_rseq (void)
>>> +{
>>> +  if (__rseq_size > 0)
>>> +    add_range ("", "rseq area",
>>> +               (char *) __thread_pointer () + __rseq_offset, __rseq_size);
>>> +}
>>
>> Since there is always an rseq area of at least RSEQ_AREA_SIZE_INITIAL
>> (32 bytes) allocated even when rseq is disabled, we should always add
>> the range to the test, something like that :
>>
>>  +static void
>>  +add_rseq (void)
>>  +{
>>  +  add_range ("", "rseq area", (char *) __thread_pointer () + __rseq_offset,
>>  +  	MAX (__rseq_size, RSEQ_AREA_SIZE_INITIAL));
>>  +}
> 
> Or perhaps round up the size to a multiple of 32?

Right, '__rseq_size' rounded up to '_rseq_align' will give the actual
allocation including the padding, even when rseq is disabled. However,
I'm not sure if we can access '_rseq_aling' in the tests.

> 
> Thanks,
> Florian
> 



More information about the Libc-alpha mailing list