[LibOS] glibc: make shim_tcb_t in glibc tcb compile time option

This is a follow up patch of #556.
https://github.com/oscarlab/graphene/pull/556
With #556, LibOS doesn't always stash libos tcb into glibc tcb
depending on compile time option.
This patch makes it compile time option to add shim_tcb_t to glibc tcb.
So make it optional to embed shim_tcb_t into glibc tcb.

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
This commit is contained in:
Isaku Yamahata
2019-04-09 15:08:55 -07:00
parent 7535273ecc
commit 0dd44206da
3 changed files with 23 additions and 19 deletions
+8
View File
@@ -59,6 +59,14 @@ GLIBC_PATCHES = \
glibc-fix-warning.patch \
glibc-no-pie.patch
# TODO: configuration
# SHIM_TCB_USE_GS=yes
SHIM_TCB_USE_GS=
ifneq (SHIM_THREAD_USE_GS, "yes")
GLIBC_PATCHES += \
glibc-add-shim-tcb.patch
endif
$(GLIBC_SRC)/configure: $(GLIBC_PATCHES) Makefile
[ -f $(GLIBC_SRC).tar.gz ] || \
for MIRROR in $(GLIBC_MIRRORS); do \
-19
View File
@@ -1350,25 +1350,6 @@ index cbb5e9e..9b87e25 100644
/* Replacement type for __m128 since this file is included by ld.so,
which is compiled with -mno-sse. It must not change the alignment
@@ -67,6 +69,10 @@ typedef struct
# else
int __glibc_reserved1;
# endif
+
+ shim_tcb_t shim_tcb; /* For graphene, we allocate a shim_tcb
+ in the real tcb. */
+
int rtld_must_xmm_save;
/* Reservation of some values for the TM ABI. */
void *__private_tm[4];
@@ -137,7 +143,6 @@ typedef struct
# define GET_DTV(descr) \
(((tcbhead_t *) (descr))->dtv)
-
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched.
@@ -154,7 +159,7 @@ typedef struct
_head->self = _thrdescr; \
\
+15
View File
@@ -0,0 +1,15 @@
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index cbb5e9e..9b87e25 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -67,6 +67,10 @@ typedef struct
# else
int __glibc_reserved1;
# endif
+
+ shim_tcb_t shim_tcb; /* For graphene, we allocate a shim_tcb
+ in the real tcb. */
+
int rtld_must_xmm_save;
/* Reservation of some values for the TM ABI. */
void *__private_tm[4];