diff options
Diffstat (limited to 'sysdeps/x86_64/nptl')
-rw-r--r-- | sysdeps/x86_64/nptl/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/pthread-offsets.h | 5 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/pthread_spin_lock.S | 2 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/pthread_spin_trylock.S | 2 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/pthread_spin_unlock.S | 2 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/pthreaddef.h | 2 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/tcb-offsets.sym | 6 | ||||
-rw-r--r-- | sysdeps/x86_64/nptl/tls.h | 59 |
8 files changed, 39 insertions, 41 deletions
diff --git a/sysdeps/x86_64/nptl/Makefile b/sysdeps/x86_64/nptl/Makefile index 9b64b533ee..73024033ee 100644 --- a/sysdeps/x86_64/nptl/Makefile +++ b/sysdeps/x86_64/nptl/Makefile @@ -1,4 +1,4 @@ -# 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 diff --git a/sysdeps/x86_64/nptl/pthread-offsets.h b/sysdeps/x86_64/nptl/pthread-offsets.h new file mode 100644 index 0000000000..16c6b0d9fd --- /dev/null +++ b/sysdeps/x86_64/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +#define __PTHREAD_MUTEX_KIND_OFFSET 16 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 24 diff --git a/sysdeps/x86_64/nptl/pthread_spin_lock.S b/sysdeps/x86_64/nptl/pthread_spin_lock.S index b871241617..730fd65034 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_lock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_lock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. +/* Copyright (C) 2012-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 diff --git a/sysdeps/x86_64/nptl/pthread_spin_trylock.S b/sysdeps/x86_64/nptl/pthread_spin_trylock.S index c9c53171fe..a8f1b72d60 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_trylock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_trylock.S @@ -1,4 +1,4 @@ -/* 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. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/x86_64/nptl/pthread_spin_unlock.S b/sysdeps/x86_64/nptl/pthread_spin_unlock.S index 188de2e8cb..afd114e855 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_unlock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_unlock.S @@ -1,4 +1,4 @@ -/* 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. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/x86_64/nptl/pthreaddef.h b/sysdeps/x86_64/nptl/pthreaddef.h index 9397efc631..036deb5772 100644 --- a/sysdeps/x86_64/nptl/pthreaddef.h +++ b/sysdeps/x86_64/nptl/pthreaddef.h @@ -1,4 +1,4 @@ -/* 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. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/sysdeps/x86_64/nptl/tcb-offsets.sym b/sysdeps/x86_64/nptl/tcb-offsets.sym index aeb752673a..ae8034743b 100644 --- a/sysdeps/x86_64/nptl/tcb-offsets.sym +++ b/sysdeps/x86_64/nptl/tcb-offsets.sym @@ -4,7 +4,6 @@ RESULT offsetof (struct pthread, result) TID offsetof (struct pthread, tid) -PID offsetof (struct pthread, pid) CANCELHANDLING offsetof (struct pthread, cancelhandling) CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf) CLEANUP offsetof (struct pthread, cleanup) @@ -13,9 +12,8 @@ MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock) MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) POINTER_GUARD offsetof (tcbhead_t, pointer_guard) 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) +SSP_BASE_OFFSET offsetof (tcbhead_t, ssp_base) -- Not strictly offsets, but these values are also used in the TCB. TCB_CANCELSTATE_BITMASK CANCELSTATE_BITMASK 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 |