This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: V2: [PATCH 01/24] x86: Rename __glibc_reserved1 to feature_1 in tcbhead_t [BZ #22563]


On 07/13/2018 01:05 PM, Carlos O'Donell wrote:
> On 07/13/2018 02:55 PM, Jeff Law wrote:
>> On 07/13/2018 12:51 PM, Carlos O'Donell wrote:
>>> On 07/13/2018 09:19 AM, H.J. Lu wrote:
>>>> On Wed, Jun 13, 2018 at 08:31:44AM -0700, H.J. Lu wrote:
>>>>> This will be used by CET run-time control.
>>>>>
>>>>> 	[BZ #22563]
>>>>> 	* nptl/pthread_create.c (__pthread_create_2_1): Use
>>>>> 	THREAD_COPY_ADDITONAL_INFO to copy additonal info if defined.
>>>>> 	* sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
>>>>> 	* sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET):
>>>>> 	Likewise.
>>>>> 	* sysdeps/i386/nptl/tls.h (tcbhead_t): Rename __glibc_reserved1
>>>>> 	to feature_1.
>>>>> 	* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise.
>>>>> 	* sysdeps/unix/sysv/linux/x86/pthreaddef.h: New file.
>>>>
>>>> Here is the updated patch to add feature_1 to tcbhead_t and
>>>> introduce macros for CET enabling.  OK for master?
>>>
>>> Fix the typo-prone macro API and post a v3 please.
>>>
>>> Thank you.
>> Umm, has this been tested with the sanitizers?  I thought they used that
>> field.
> 
> The size of tcbhead_t has not changed, which is something that might impact
> the santiziers.
> 
> But now that you mention it, why do I vaguely remember a conversation about
> the santizers using the reserved bytes as storage for themselves?
> 
> Is that what you are talking about?
> 
> HJ, could you look into this please?
> 
> I think the sanitizers are not within their rights to use any bytes in the
> tcbhead_t structure, particularly reserved bytes. We should coordinate with
> them, but that should not stop the acceptance of this patch in 2.28.
sanitizer_common/sanitizer_linux.cc:

static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
  static const u32 kEsrMagic = 0x45535201;
  u8 *aux = ucontext->uc_mcontext.__reserved;
  while (true) {
    _aarch64_ctx *ctx = (_aarch64_ctx *)aux;
    if (ctx->size == 0) break;
    if (ctx->magic == kEsrMagic) {
      *esr = ((__sanitizer_esr_context *)ctx)->esr;
      return true;
    }
    aux += ctx->size;
  }
  return false;
}

It's seriously lame that they're abusing the reserved field like that...

I see that HJ is just changing x86, so we may be OK here since the
sanitizer code in question is aarch64 specific.


Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]