summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/nptl/tls.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86_64/nptl/tls.h')
-rw-r--r--sysdeps/x86_64/nptl/tls.h59
1 files changed, 27 insertions, 32 deletions
diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h
index 2b061a07c6..e88561c934 100644
--- a/sysdeps/x86_64/nptl/tls.h
+++ b/sysdeps/x86_64/nptl/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. nptl/x86_64 version.
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,8 +26,9 @@
# include <stdint.h>
# include <stdlib.h>
# include <sysdep.h>
-# include <libc-internal.h>
+# include <libc-pointer-arith.h> /* For cast_to_integer. */
# include <kernel-features.h>
+# include <dl-dtv.h>
/* Replacement type for __m128 since this file is included by ld.so,
which is compiled with -mno-sse. It must not change the alignment
@@ -38,18 +39,6 @@ typedef struct
} __128bits;
-/* Type for the dtv. */
-typedef union dtv
-{
- size_t counter;
- struct
- {
- void *val;
- bool is_static;
- } pointer;
-} dtv_t;
-
-
typedef struct
{
void *tcb; /* Pointer to the TCB. Not necessarily the
@@ -62,17 +51,17 @@ typedef struct
uintptr_t stack_guard;
uintptr_t pointer_guard;
unsigned long int vgetcpu_cache[2];
-# ifndef __ASSUME_PRIVATE_FUTEX
- int private_futex;
-# else
- int __glibc_reserved1;
-# endif
+ /* Bit 0: X86_FEATURE_1_IBT.
+ Bit 1: X86_FEATURE_1_SHSTK.
+ */
+ unsigned int feature_1;
int __glibc_unused1;
/* Reservation of some values for the TM ABI. */
void *__private_tm[4];
/* GCC split stack support. */
void *__private_ss;
- long int __glibc_reserved2;
+ /* The lowest address of shadow stack, */
+ unsigned long long int ssp_base;
/* Must be kept even if it is no longer used by glibc since programs,
like AddressSanitizer, depend on the size of tcbhead_t. */
__128bits __glibc_unused2[8][4] __attribute__ ((aligned (32)));
@@ -80,6 +69,23 @@ typedef struct
void *__padding[8];
} tcbhead_t;
+# ifdef __ILP32__
+/* morestack.S in libgcc uses offset 0x40 to access __private_ss, */
+_Static_assert (offsetof (tcbhead_t, __private_ss) == 0x40,
+ "offset of __private_ss != 0x40");
+/* NB: ssp_base used to be "long int __glibc_reserved2", which was
+ changed from 32 bits to 64 bits. Make sure that the offset of the
+ next field, __glibc_unused2, is unchanged. */
+_Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x60,
+ "offset of __glibc_unused2 != 0x60");
+# else
+/* morestack.S in libgcc uses offset 0x70 to access __private_ss, */
+_Static_assert (offsetof (tcbhead_t, __private_ss) == 0x70,
+ "offset of __private_ss != 0x70");
+_Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
+ "offset of __glibc_unused2 != 0x80");
+# endif
+
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>
#endif
@@ -337,18 +343,6 @@ typedef struct
abort (); })
-# define CALL_THREAD_FCT(descr) \
- ({ void *__res; \
- asm volatile ("movq %%fs:%P2, %%rdi\n\t" \
- "callq *%%fs:%P1" \
- : "=a" (__res) \
- : "i" (offsetof (struct pthread, start_routine)), \
- "i" (offsetof (struct pthread, arg)) \
- : "di", "si", "cx", "dx", "r8", "r9", "r10", "r11", \
- "memory", "cc"); \
- __res; })
-
-
/* Set the stack guard field in TCB head. */
# define THREAD_SET_STACK_GUARD(value) \
THREAD_SETMEM (THREAD_SELF, header.stack_guard, value)
@@ -366,6 +360,7 @@ typedef struct
/* Get and set the global scope generation counter in the TCB head. */
+# define THREAD_GSCOPE_IN_TCB 1
# define THREAD_GSCOPE_FLAG_UNUSED 0
# define THREAD_GSCOPE_FLAG_USED 1
# define THREAD_GSCOPE_FLAG_WAIT 2