[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:25:59 GMT 2025
On 2025-01-14 10:22, Michael Jeanson wrote:
> 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.
Well, answering my own question, we can just use:
size_t rseq_align = MAX (getauxval (AT_RSEQ_ALIGN), RSEQ_MIN_ALIGN);
>
>>
>> Thanks,
>> Florian
>>
>
More information about the Libc-alpha
mailing list