This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHi v2] aarch64: Add split-stack TCB field
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Florian Weimer <fweimer at redhat dot com>, Carlos O'Donell <carlos at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 14 Mar 2017 08:28:01 -0300
- Subject: Re: [PATCHi v2] aarch64: Add split-stack TCB field
- Authentication-results: sourceware.org; auth=none
- References: <1487015120-29166-1-git-send-email-adhemerval.zanella@linaro.org> <bef07cb8-cda0-7569-c337-c7ad09abf488@redhat.com> <0ff4d685-f7f7-50e6-caff-f6a4e4de5a8f@redhat.com> <ea049af8-24ce-dc8b-81cb-676861e5fd76@redhat.com>
On 14/03/2017 03:53, Florian Weimer wrote:
> On 03/14/2017 02:17 AM, Carlos O'Donell wrote:
>> On 02/14/2017 05:03 AM, Florian Weimer wrote:
>>> On 02/13/2017 08:45 PM, Adhemerval Zanella wrote:
>>>> +/* This is the size we need before TCB. Check if there is room
>>>> for + tcbprehead_t in struct pthread's final padding and if not
>>>> add it on + required pre-tcb size. */ +# define TLS_PRE_TCB_SIZE
>>>> \ + (sizeof (struct pthread) \ + +
>>>> (PTHREAD_STRUCT_END_PADDING < sizeof (tcbprehead_t) \ +
>>>> ? ALIGN_UP (sizeof (tcbprehead_t), sizeof (struct pthread)) \ +
>>>> : 0))
>>>
>>> How does this preserve the alignment of struct pthread?
>>>
>>> It's also not clear to me how the “version control” aspect of
>>> __tcb_private_ss is supposed to work. If the intent is to prevent
>>> loading of split-stack binaries with an older glibc, then a data
>>> symbol would be a safer choice.
>>
>> Why is a data symbol a safer choice?
>
> No lazy binding and hence a more well-defined failure mode.
>
> Thanks,
> Florian
>
Carlos, I also see Florian suggestion a better approach. Using a weak
function symbol, it will fail at runtime after symbol resolution with
an undefined jump to a null symbol (for aarch64 it will be a segfault
anyway), while with data symbol loader will explicit dump the missing
symbol.