[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:35:41 GMT 2025
On 2025-01-14 10:25, Michael Jeanson wrote:
>>> 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);
>
The full function:
static void
add_rseq (void)
{
size_t rseq_align = MAX (getauxval (AT_RSEQ_ALIGN), RSEQ_MIN_ALIGN);
/* When rseq is disabled, cap the alignment to RSEQ_MIN_ALIGN (32). */
if (__rseq_size == 0)
rseq_align = RSEQ_MIN_ALIGN;
add_range ("", "rseq area",
(char *) __thread_pointer () + __rseq_offset,
roundup (__rseq_size, rseq_align);
}
More information about the Libc-alpha
mailing list