summaryrefslogtreecommitdiff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-07-25 04:39:26 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-07-25 04:39:39 -0700
commit9aa3113a42d94d7bbf9bb4d50ef0d23b95e66123 (patch)
treefa63d539e751cddd5df0acde94a2ecc808642a0f /sysdeps/i386
parent9c79cec8cd2a6996a73aa83d79b360ffd4bebde6 (diff)
x86: Rename __glibc_reserved2 to ssp_base in tcbhead_t
This will be used to record the current shadow stack base for shadow stack switching by getcontext, makecontext, setcontext and swapcontext. If the target shadow stack base is the same as the current shadow stack base, we unwind the shadow stack. Otherwise it is a stack switch and we look for a restore token to restore the target shadow stack. * sysdeps/i386/nptl/tcb-offsets.sym (SSP_BASE_OFFSET): New. * sysdeps/i386/nptl/tls.h (tcbhead_t): Replace __glibc_reserved2 with ssp_base. * sysdeps/x86_64/nptl/tcb-offsets.sym (SSP_BASE_OFFSET): New. * sysdeps/x86_64/nptl/tls.h (tcbhead_t): Replace __glibc_reserved2 with ssp_base.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/nptl/tcb-offsets.sym1
-rw-r--r--sysdeps/i386/nptl/tls.h3
2 files changed, 3 insertions, 1 deletions
diff --git a/sysdeps/i386/nptl/tcb-offsets.sym b/sysdeps/i386/nptl/tcb-offsets.sym
index fbac241c45..2ec9e787c1 100644
--- a/sysdeps/i386/nptl/tcb-offsets.sym
+++ b/sysdeps/i386/nptl/tcb-offsets.sym
@@ -13,3 +13,4 @@ CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev)
MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock)
POINTER_GUARD offsetof (tcbhead_t, pointer_guard)
FEATURE_1_OFFSET offsetof (tcbhead_t, feature_1)
+SSP_BASE_OFFSET offsetof (tcbhead_t, ssp_base)
diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h
index 21e23cd809..12285d3217 100644
--- a/sysdeps/i386/nptl/tls.h
+++ b/sysdeps/i386/nptl/tls.h
@@ -49,7 +49,8 @@ typedef struct
void *__private_tm[3];
/* GCC split stack support. */
void *__private_ss;
- void *__glibc_reserved2;
+ /* The lowest address of shadow stack, */
+ unsigned long ssp_base;
} tcbhead_t;
/* morestack.S in libgcc uses offset 0x30 to access __private_ss, */