]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Add feature_1 to tcbhead_t [BZ #22563]
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 19 Dec 2017 10:45:16 +0000 (02:45 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 19 Dec 2017 10:45:34 +0000 (02:45 -0800)
On x86, padding in struct __jmp_buf_tag is used for shadow stack pointer
to support Shadow Stack in Intel Control-flow Enforcemen Technology.
cancel_jmp_buf has been updated to include saved_mask so that it is as
large as struct __jmp_buf_tag.  We must suport the old cancel_jmp_buf
in existing binaries.  Since symbol versioning doesn't work on
cancel_jmp_buf, feature_1 is added to tcbhead_t so that setjmp and
longjmp can check if shadow stack is enabled.  NB: Shadow stack is
enabled only if all modules are shadow stack enabled.

[BZ #22563]
* sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
* sysdeps/i386/nptl/tls.h (tcbhead_t): Add feature_1.
* sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Rename __glibc_unused1
to feature_1.

ChangeLog
sysdeps/i386/nptl/tcb-offsets.sym
sysdeps/i386/nptl/tls.h
sysdeps/x86_64/nptl/tcb-offsets.sym
sysdeps/x86_64/nptl/tls.h

index 73dea64520f2fa4e24cc4563e9e200ccea498fcc..c408eb235089855e2379c098fb36ad47a71dc3c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-12-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #22563]
+       * sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
+       * sysdeps/i386/nptl/tls.h (tcbhead_t): Add feature_1.
+       * sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
+       * sysdeps/x86_64/nptl/tls.h (tcbhead_t): Rename __glibc_unused1
+       to feature_1.
+
 2017-12-19  H.J. Lu  <hongjiu.lu@intel.com>
 
        [BZ #22563]
index 695a810386370172ace4ae7b6172d0c42cd58381..250f1a6e13e966bcd55d08e188ff3ddb50bc151b 100644 (file)
@@ -15,3 +15,4 @@ POINTER_GUARD         offsetof (tcbhead_t, pointer_guard)
 #ifndef __ASSUME_PRIVATE_FUTEX
 PRIVATE_FUTEX          offsetof (tcbhead_t, private_futex)
 #endif
+FEATURE_1_OFFSET       offsetof (tcbhead_t, feature_1)
index f9a6b11ecf3df941593d79b9d0822bdbdeb6dbf8..7d4b18c16ad1bcc0af71005e44ee7b0fda89faaf 100644 (file)
@@ -50,6 +50,10 @@ typedef struct
   void *__private_tm[4];
   /* GCC split stack support.  */
   void *__private_ss;
+  /* Bit 0: IBT.
+     Bit 1: SHSTK.
+   */
+  unsigned int feature_1;
 } tcbhead_t;
 
 # define TLS_MULTIPLE_THREADS_IN_TCB 1
index 8a25c482cb09a86fc83a4ed5d0ab9a0ee493cb7f..03b6dba5c3e9511654c3eeba4237eb92c5b8bba7 100644 (file)
@@ -15,6 +15,7 @@ VGETCPU_CACHE_OFFSET  offsetof (tcbhead_t, vgetcpu_cache)
 #ifndef __ASSUME_PRIVATE_FUTEX
 PRIVATE_FUTEX          offsetof (tcbhead_t, private_futex)
 #endif
+FEATURE_1_OFFSET       offsetof (tcbhead_t, feature_1)
 
 -- Not strictly offsets, but these values are also used in the TCB.
 TCB_CANCELSTATE_BITMASK         CANCELSTATE_BITMASK
index 9b8ad82550f9ed719a5a18cf16c5b9fc346cdd28..cec864f231da08faf8561f6d2c33237a7532f553 100644 (file)
@@ -56,7 +56,10 @@ typedef struct
 # else
   int __glibc_reserved1;
 # endif
-  int __glibc_unused1;
+  /* Bit 0: IBT.
+     Bit 1: SHSTK.
+   */
+  unsigned int feature_1;
   /* Reservation of some values for the TM ABI.  */
   void *__private_tm[4];
   /* GCC split stack support.  */