[PATCH v12 01/17] nptl: Add rseq auxvals

Michael Jeanson mjeanson@efficios.com
Tue Aug 6 13:32:15 GMT 2024


On 2024-08-06 02 h 11, Florian Weimer wrote:
> * Michael Jeanson:
> 
>> diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
>> index ea2a58ecb1..d24daab3fc 100644
>> --- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h
>> +++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
>> @@ -21,6 +21,7 @@
>>   #include <fpu_control.h>
>>   #include <ldsodefs.h>
>>   #include <link.h>
>> +#include <rseq-internal.h>
>>   
>>   typedef ElfW(Addr) dl_parse_auxv_t[AT_MINSIGSTKSZ + 1];
>>   
>> @@ -59,5 +60,9 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values)
>>       GLRO(dl_sysinfo) = auxv_values[AT_SYSINFO];
>>   #endif
>>   
>> +  _rseq_size = MAX (auxv_values[AT_RSEQ_FEATURE_SIZE],
>> +                    RSEQ_AREA_SIZE_INITIAL_USED);
>> +  _rseq_align = MAX (auxv_values[AT_RSEQ_ALIGN], RSEQ_MIN_ALIGN);
>> +
>>     DL_PLATFORM_AUXV
>>   }
> 
> I believe you need an else branch in __tls_init_tp in
> sysdeps/nptl/dl-tls_init_tp.c, to set _rseq_size to 0 if registration
> fails:
> 
>      bool do_rseq = true;
>      do_rseq = TUNABLE_GET (rseq, int, NULL);
>      if (rseq_register_current_thread (pd, do_rseq))
>        _rseq_size = RSEQ_AREA_SIZE_INITIAL_USED;
> 
> Not sure why this doesn't result in a test failure (maybe it's fixed
> again later in the series?).

Before the removal of _dl_rseq_feature_size there was no behavior change 
introduced until "Move the rseq area to the 'extra TLS' block" which is 
where _rseq_size is set to 0 on failure. I agree it would make more 
sense to have it in this patch, I'll queue this change for the next round.

Thanks,

Michael



More information about the Libc-alpha mailing list