[PATCH v12 14/17] nptl: Introduce RSEQ_GETMEM_VOLATILE and RSEQ_SETMEM

Florian Weimer fw@deneb.enyo.de
Mon Oct 14 06:34:34 GMT 2024


* Michael Jeanson:

> On 2024-09-14 13:19, Florian Weimer wrote:
>> * Michael Jeanson:
>> 
>>> diff --git a/sysdeps/nptl/tcb-access.h b/sysdeps/nptl/tcb-access.h
>>> index 600433766f..9532f30022 100644
>>> --- a/sysdeps/nptl/tcb-access.h
>>> +++ b/sysdeps/nptl/tcb-access.h
>>> @@ -30,3 +30,8 @@
>>>    descr->member = (value)
>>>  #define THREAD_SETMEM_NC(descr, member, idx, value) \
>>>    descr->member[idx] = (value)
>>> +
>>> +#define RSEQ_GETMEM_VOLATILE(descr, member) \
>>> +  THREAD_GETMEM_VOLATILE(descr, member)
>>> +#define RSEQ_SETMEM(descr, member, value) \
>>> +  THREAD_SETMEM(descr, member, value)
>> 
>> Please add a comments to these macros to explain their use.
>
> Ack.
>
>> 
>> I'm not sure if you should use THREAD_GETMEM if you don't use it with
>> THREAD_SELF.  I assume you instead of passing struct pthread *, you are
>> going to pass a struct rseq_abi * here.  This is a bit too bit magic.
>> Maybe use __thread_pointer?  THREAD_GETMEM is only expected to be used
>> in the context of the thread whose data is being accessed.
>
> Should I split these macros out of tcb-access.h in a new header with a
> generic version in 'sysdeps/nptl' and arch specific versions in
> 'sysdeps/ARCH/nptl' ?

I don't think a new separate header is required if you can re-use an
existing header.  Maybe the generic version should just duplicate the
definitions of THREAD_GETMEM_VOLATILE and THREAD_SETMEM?  So that a
port that changes only the THREAD_* functions does not accidentally
use them for RSEQ_*MEM?


More information about the Libc-alpha mailing list