On Fri, Jul 13, 2018 at 11:51 AM, 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. > >> >> H.J. >> ---- >> feature_1 has X86_FEATURE_1_IBT and X86_FEATURE_1_SHSTK bits for CET >> run-time control. >> >> CET_ENABLED, IBT_ENABLED and SHSTK_ENABLED are defined to 1 or 0 to >> indicate that if CET, IBT and SHSTK are enabled. > > OK. > >> >> [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. >> * sysdeps/x86/sysdep.h (X86_FEATURE_1_IBT): New. >> (X86_FEATURE_1_SHSTK): Likewise. >> (CET_ENABLED): Likewise. >> (IBT_ENABLED): Likewise. >> (SHSTK_ENABLED): Likewise. >> --- >> nptl/pthread_create.c | 5 +++++ >> sysdeps/i386/nptl/tcb-offsets.sym | 1 + >> sysdeps/i386/nptl/tls.h | 5 ++++- >> sysdeps/unix/sysv/linux/x86/pthreaddef.h | 24 +++++++++++++++++++++ >> sysdeps/x86/sysdep.h | 27 ++++++++++++++++++++++++ >> sysdeps/x86_64/nptl/tcb-offsets.sym | 1 + >> sysdeps/x86_64/nptl/tls.h | 5 ++++- >> 7 files changed, 66 insertions(+), 2 deletions(-) >> create mode 100644 sysdeps/unix/sysv/linux/x86/pthreaddef.h >> >> diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c >> index 92c945b12b..16998f4bbd 100644 >> --- a/nptl/pthread_create.c >> +++ b/nptl/pthread_create.c >> @@ -712,6 +712,11 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, >> THREAD_COPY_POINTER_GUARD (pd); >> #endif >> >> + /* Copy additonal info. */ >> +#ifdef THREAD_COPY_ADDITONAL_INFO >> + THREAD_COPY_ADDITONAL_INFO (pd); >> +#endif > > This is a typo-prone macro API. > > Please find a way to define this unconditionally. > Here is the V3 patch. I added to set up thread-local data. OK for master? Thanks. -- H.J.