|
|
5de29b |
# MPX Support for glibc:
|
|
|
5de29b |
#
|
|
|
5de29b |
# Note: Renamed configure.ac changes to configure.in changes.
|
|
|
5de29b |
#
|
|
|
5de29b |
# commit ea8ba7cd14d0f479bae8365ae5c4ef177bdd0aad
|
|
|
5de29b |
# Author: Igor Zamyatin <igor.zamyatin@intel.com>
|
|
|
5de29b |
# Date: Wed Apr 16 14:43:16 2014 -0700
|
|
|
5de29b |
#
|
|
|
5de29b |
# Save/restore bound registers for _dl_runtime_profile
|
|
|
5de29b |
#
|
|
|
5de29b |
# This patch saves and restores bound registers in x86-64 PLT for
|
|
|
5de29b |
# ld.so profile and LD_AUDIT:
|
|
|
5de29b |
#
|
|
|
5de29b |
# * sysdeps/x86_64/bits/link.h (La_x86_64_regs): Add lr_bnd.
|
|
|
5de29b |
# (La_x86_64_retval): Add lrv_bnd0 and lrv_bnd1.
|
|
|
5de29b |
# * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Save
|
|
|
5de29b |
# Intel MPX bound registers before _dl_profile_fixup.
|
|
|
5de29b |
# * sysdeps/x86_64/dl-trampoline.h: Restore Intel MPX bound
|
|
|
5de29b |
# registers after _dl_profile_fixup. Save and restore bound
|
|
|
5de29b |
# registers bnd0/bnd1 when calling _dl_call_pltexit.
|
|
|
5de29b |
# * sysdeps/x86_64/link-defines.sym (BND_SIZE): New.
|
|
|
5de29b |
# (LR_BND_OFFSET): Likewise.
|
|
|
5de29b |
# (LRV_BND0_OFFSET): Likewise.
|
|
|
5de29b |
# (LRV_BND1_OFFSET): Likewise.
|
|
|
5de29b |
#
|
|
|
5de29b |
# commit a4c75cfd56e536c2b18556e8a482d88dffa0fffc
|
|
|
5de29b |
# Author: Igor Zamyatin <igor.zamyatin@intel.com>
|
|
|
5de29b |
# Date: Tue Apr 1 10:16:04 2014 -0700
|
|
|
5de29b |
#
|
|
|
5de29b |
# Save/restore bound registers in _dl_runtime_resolve
|
|
|
5de29b |
#
|
|
|
5de29b |
# This patch saves and restores bound registers in symbol lookup for x86-64:
|
|
|
5de29b |
#
|
|
|
5de29b |
# 1. Branches without BND prefix clear bound registers.
|
|
|
5de29b |
# 2. x86-64 pass bounds in bound registers as specified in MPX psABI
|
|
|
5de29b |
# extension on hjl/mpx/master branch at
|
|
|
5de29b |
#
|
|
|
5de29b |
# https://github.com/hjl-tools/x86-64-psABI
|
|
|
5de29b |
# https://groups.google.com/forum/#!topic/x86-64-abi/KFsB0XTgWYc
|
|
|
5de29b |
#
|
|
|
5de29b |
# Binutils has been updated to create an alternate PLT to add BND prefix
|
|
|
5de29b |
# when branching to ld.so.
|
|
|
5de29b |
#
|
|
|
5de29b |
# * config.h.in (HAVE_MPX_SUPPORT): New #undef.
|
|
|
5de29b |
# * sysdeps/x86_64/configure.ac: Set HAVE_MPX_SUPPORT.
|
|
|
5de29b |
# * sysdeps/x86_64/configure: Regenerated.
|
|
|
5de29b |
# * sysdeps/x86_64/dl-trampoline.S (REGISTER_SAVE_AREA): New
|
|
|
5de29b |
# macro.
|
|
|
5de29b |
# (REGISTER_SAVE_RAX): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_RCX): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_RDX): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_RSI): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_RDI): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_R8): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_R9): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_BND0): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_BND1): Likewise.
|
|
|
5de29b |
# (REGISTER_SAVE_BND2): Likewise.
|
|
|
5de29b |
# (_dl_runtime_resolve): Use them. Save and restore Intel MPX
|
|
|
5de29b |
# bound registers when calling _dl_fixup.
|
|
|
5de29b |
#
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/config.h.in glibc-2.17-c758a686/config.h.in
|
|
|
5de29b |
--- glibc-2.17-c758a686/config.h.in 2014-09-10 23:26:03.467045808 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/config.h.in 2014-09-10 23:27:41.532851928 -0400
|
|
|
5de29b |
@@ -107,6 +107,9 @@
|
|
|
5de29b |
/* Define if assembler supports AVX512. */
|
|
|
5de29b |
#undef HAVE_AVX512_ASM_SUPPORT
|
|
|
5de29b |
|
|
|
5de29b |
+/* Define if assembler supports Intel MPX. */
|
|
|
5de29b |
+#undef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+
|
|
|
5de29b |
/* Define if gcc supports FMA4. */
|
|
|
5de29b |
#undef HAVE_FMA4_SUPPORT
|
|
|
5de29b |
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86/bits/link.h glibc-2.17-c758a686/sysdeps/x86/bits/link.h
|
|
|
5de29b |
--- glibc-2.17-c758a686/sysdeps/x86/bits/link.h 2014-09-10 23:26:03.467045808 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86/bits/link.h 2014-09-10 23:27:41.533851926 -0400
|
|
|
5de29b |
@@ -93,6 +93,9 @@
|
|
|
5de29b |
uint64_t lr_rsp;
|
|
|
5de29b |
La_x86_64_xmm lr_xmm[8];
|
|
|
5de29b |
La_x86_64_vector lr_vector[8];
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+ __int128 lr_bnd[4];
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
} La_x86_64_regs;
|
|
|
5de29b |
|
|
|
5de29b |
/* Return values for calls from PLT on x86-64. */
|
|
|
5de29b |
@@ -106,6 +109,10 @@
|
|
|
5de29b |
long double lrv_st1;
|
|
|
5de29b |
La_x86_64_vector lrv_vector0;
|
|
|
5de29b |
La_x86_64_vector lrv_vector1;
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+ __int128 lrv_bnd0;
|
|
|
5de29b |
+ __int128 lrv_bnd1;
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
} La_x86_64_retval;
|
|
|
5de29b |
|
|
|
5de29b |
#define La_x32_regs La_x86_64_regs
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/configure glibc-2.17-c758a686/sysdeps/x86_64/configure
|
|
|
5de29b |
--- glibc-2.17-c758a686/sysdeps/x86_64/configure 2014-09-10 23:26:03.573045598 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86_64/configure 2014-09-10 23:27:41.532851928 -0400
|
|
|
5de29b |
@@ -212,6 +212,33 @@
|
|
|
5de29b |
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5
|
|
|
5de29b |
$as_echo "$libc_cv_cc_novzeroupper" >&6; }
|
|
|
5de29b |
|
|
|
5de29b |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Intel MPX support" >&5
|
|
|
5de29b |
+$as_echo_n "checking for Intel MPX support... " >&6; }
|
|
|
5de29b |
+if ${libc_cv_asm_mpx+:} false; then :
|
|
|
5de29b |
+ $as_echo_n "(cached) " >&6
|
|
|
5de29b |
+else
|
|
|
5de29b |
+ cat > conftest.s <<\EOF
|
|
|
5de29b |
+ bndmov %bnd0,(%rsp)
|
|
|
5de29b |
+EOF
|
|
|
5de29b |
+if { ac_try='${CC-cc} -c $ASFLAGS conftest.s 1>&5'
|
|
|
5de29b |
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
|
|
5de29b |
+ (eval $ac_try) 2>&5
|
|
|
5de29b |
+ ac_status=$?
|
|
|
5de29b |
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
|
5de29b |
+ test $ac_status = 0; }; }; then
|
|
|
5de29b |
+ libc_cv_asm_mpx=yes
|
|
|
5de29b |
+else
|
|
|
5de29b |
+ libc_cv_asm_mpx=no
|
|
|
5de29b |
+fi
|
|
|
5de29b |
+rm -f conftest*
|
|
|
5de29b |
+fi
|
|
|
5de29b |
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_mpx" >&5
|
|
|
5de29b |
+$as_echo "$libc_cv_asm_mpx" >&6; }
|
|
|
5de29b |
+if test $libc_cv_asm_mpx == yes; then
|
|
|
5de29b |
+ $as_echo "#define HAVE_MPX_SUPPORT 1" >>confdefs.h
|
|
|
5de29b |
+
|
|
|
5de29b |
+fi
|
|
|
5de29b |
+
|
|
|
5de29b |
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
|
|
|
5de29b |
|
|
|
5de29b |
# work around problem with autoconf and empty lines at the end of files
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/configure.in glibc-2.17-c758a686/sysdeps/x86_64/configure.in
|
|
|
5de29b |
--- glibc-2.17-c758a686/sysdeps/x86_64/configure.in 2014-09-10 23:26:03.468045806 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86_64/configure.in 2014-09-10 23:27:41.532851928 -0400
|
|
|
5de29b |
@@ -70,6 +70,21 @@
|
|
|
5de29b |
[libc_cv_cc_novzeroupper=no])
|
|
|
5de29b |
])
|
|
|
5de29b |
|
|
|
5de29b |
+dnl Check whether asm supports Intel MPX
|
|
|
5de29b |
+AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl
|
|
|
5de29b |
+cat > conftest.s <<\EOF
|
|
|
5de29b |
+ bndmov %bnd0,(%rsp)
|
|
|
5de29b |
+EOF
|
|
|
5de29b |
+if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
|
|
|
5de29b |
+ libc_cv_asm_mpx=yes
|
|
|
5de29b |
+else
|
|
|
5de29b |
+ libc_cv_asm_mpx=no
|
|
|
5de29b |
+fi
|
|
|
5de29b |
+rm -f conftest*])
|
|
|
5de29b |
+if test $libc_cv_asm_mpx == yes; then
|
|
|
5de29b |
+ AC_DEFINE(HAVE_MPX_SUPPORT)
|
|
|
5de29b |
+fi
|
|
|
5de29b |
+
|
|
|
5de29b |
dnl It is always possible to access static and hidden symbols in an
|
|
|
5de29b |
dnl position independent way.
|
|
|
5de29b |
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.h glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.h
|
|
|
5de29b |
--- glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.h 2014-09-10 23:26:03.468045806 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.h 2014-09-10 23:27:41.535851922 -0400
|
|
|
5de29b |
@@ -63,6 +63,20 @@
|
|
|
5de29b |
movaps (LR_XMM_OFFSET + XMM_SIZE*6)(%rsp), %xmm6
|
|
|
5de29b |
movaps (LR_XMM_OFFSET + XMM_SIZE*7)(%rsp), %xmm7
|
|
|
5de29b |
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+# ifdef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+ bndmov (LR_BND_OFFSET)(%rsp), %bnd0 # Restore bound
|
|
|
5de29b |
+ bndmov (LR_BND_OFFSET + BND_SIZE)(%rsp), %bnd1 # registers.
|
|
|
5de29b |
+ bndmov (LR_BND_OFFSET + BND_SIZE*2)(%rsp), %bnd2
|
|
|
5de29b |
+ bndmov (LR_BND_OFFSET + BND_SIZE*3)(%rsp), %bnd3
|
|
|
5de29b |
+# else
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x84,0x24;.long (LR_BND_OFFSET)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x8c,0x24;.long (LR_BND_OFFSET + BND_SIZE)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x94,0x24;.long (LR_BND_OFFSET + BND_SIZE*2)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x9c,0x24;.long (LR_BND_OFFSET + BND_SIZE*3)
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
+
|
|
|
5de29b |
#ifdef RESTORE_AVX
|
|
|
5de29b |
/* Check if any xmm0-xmm7 registers are changed by audit
|
|
|
5de29b |
module. */
|
|
|
5de29b |
@@ -222,6 +236,16 @@
|
|
|
5de29b |
vmovdqa %xmm1, (LRV_SIZE + XMM_SIZE)(%rcx)
|
|
|
5de29b |
#endif
|
|
|
5de29b |
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+# ifdef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+ bndmov %bnd0, LRV_BND0_OFFSET(%rcx) # Preserve returned bounds.
|
|
|
5de29b |
+ bndmov %bnd1, LRV_BND1_OFFSET(%rcx)
|
|
|
5de29b |
+# else
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x81;.long (LRV_BND0_OFFSET)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x89;.long (LRV_BND1_OFFSET)
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
+
|
|
|
5de29b |
fstpt LRV_ST0_OFFSET(%rcx)
|
|
|
5de29b |
fstpt LRV_ST1_OFFSET(%rcx)
|
|
|
5de29b |
|
|
|
5de29b |
@@ -254,6 +278,16 @@
|
|
|
5de29b |
1:
|
|
|
5de29b |
#endif
|
|
|
5de29b |
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+# ifdef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+ bndmov LRV_BND0_OFFSET(%rcx), %bnd0 # Restore bound registers.
|
|
|
5de29b |
+ bndmov LRV_BND1_OFFSET(%rcx), %bnd1
|
|
|
5de29b |
+# else
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x81;.long (LRV_BND0_OFFSET)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x89;.long (LRV_BND1_OFFSET)
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
+
|
|
|
5de29b |
fldt LRV_ST1_OFFSET(%rsp)
|
|
|
5de29b |
fldt LRV_ST0_OFFSET(%rsp)
|
|
|
5de29b |
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.S glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.S
|
|
|
5de29b |
--- glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.S 2014-09-10 23:26:03.468045806 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86_64/dl-trampoline.S 2014-09-10 23:27:41.534851924 -0400
|
|
|
5de29b |
@@ -24,6 +24,30 @@
|
|
|
5de29b |
# error RTLD_SAVESPACE_SSE must be aligned to 32 bytes
|
|
|
5de29b |
#endif
|
|
|
5de29b |
|
|
|
5de29b |
+/* Area on stack to save and restore registers used for parameter
|
|
|
5de29b |
+ passing when calling _dl_fixup. */
|
|
|
5de29b |
+#ifdef __ILP32__
|
|
|
5de29b |
+/* X32 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX. */
|
|
|
5de29b |
+# define REGISTER_SAVE_AREA (8 * 7)
|
|
|
5de29b |
+# define REGISTER_SAVE_RAX 0
|
|
|
5de29b |
+#else
|
|
|
5de29b |
+/* X86-64 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as BND0,
|
|
|
5de29b |
+ BND1, BND2, BND3. */
|
|
|
5de29b |
+# define REGISTER_SAVE_AREA (8 * 7 + 16 * 4)
|
|
|
5de29b |
+/* Align bound register save area to 16 bytes. */
|
|
|
5de29b |
+# define REGISTER_SAVE_BND0 0
|
|
|
5de29b |
+# define REGISTER_SAVE_BND1 (REGISTER_SAVE_BND0 + 16)
|
|
|
5de29b |
+# define REGISTER_SAVE_BND2 (REGISTER_SAVE_BND1 + 16)
|
|
|
5de29b |
+# define REGISTER_SAVE_BND3 (REGISTER_SAVE_BND2 + 16)
|
|
|
5de29b |
+# define REGISTER_SAVE_RAX (REGISTER_SAVE_BND3 + 16)
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
+#define REGISTER_SAVE_RCX (REGISTER_SAVE_RAX + 8)
|
|
|
5de29b |
+#define REGISTER_SAVE_RDX (REGISTER_SAVE_RCX + 8)
|
|
|
5de29b |
+#define REGISTER_SAVE_RSI (REGISTER_SAVE_RDX + 8)
|
|
|
5de29b |
+#define REGISTER_SAVE_RDI (REGISTER_SAVE_RSI + 8)
|
|
|
5de29b |
+#define REGISTER_SAVE_R8 (REGISTER_SAVE_RDI + 8)
|
|
|
5de29b |
+#define REGISTER_SAVE_R9 (REGISTER_SAVE_R8 + 8)
|
|
|
5de29b |
+
|
|
|
5de29b |
.text
|
|
|
5de29b |
.globl _dl_runtime_resolve
|
|
|
5de29b |
.type _dl_runtime_resolve, @function
|
|
|
5de29b |
@@ -31,28 +55,63 @@
|
|
|
5de29b |
cfi_startproc
|
|
|
5de29b |
_dl_runtime_resolve:
|
|
|
5de29b |
cfi_adjust_cfa_offset(16) # Incorporate PLT
|
|
|
5de29b |
- subq $56,%rsp
|
|
|
5de29b |
- cfi_adjust_cfa_offset(56)
|
|
|
5de29b |
- movq %rax,(%rsp) # Preserve registers otherwise clobbered.
|
|
|
5de29b |
- movq %rcx, 8(%rsp)
|
|
|
5de29b |
- movq %rdx, 16(%rsp)
|
|
|
5de29b |
- movq %rsi, 24(%rsp)
|
|
|
5de29b |
- movq %rdi, 32(%rsp)
|
|
|
5de29b |
- movq %r8, 40(%rsp)
|
|
|
5de29b |
- movq %r9, 48(%rsp)
|
|
|
5de29b |
- movq 64(%rsp), %rsi # Copy args pushed by PLT in register.
|
|
|
5de29b |
- movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_index
|
|
|
5de29b |
+ subq $REGISTER_SAVE_AREA,%rsp
|
|
|
5de29b |
+ cfi_adjust_cfa_offset(REGISTER_SAVE_AREA)
|
|
|
5de29b |
+ # Preserve registers otherwise clobbered.
|
|
|
5de29b |
+ movq %rax, REGISTER_SAVE_RAX(%rsp)
|
|
|
5de29b |
+ movq %rcx, REGISTER_SAVE_RCX(%rsp)
|
|
|
5de29b |
+ movq %rdx, REGISTER_SAVE_RDX(%rsp)
|
|
|
5de29b |
+ movq %rsi, REGISTER_SAVE_RSI(%rsp)
|
|
|
5de29b |
+ movq %rdi, REGISTER_SAVE_RDI(%rsp)
|
|
|
5de29b |
+ movq %r8, REGISTER_SAVE_R8(%rsp)
|
|
|
5de29b |
+ movq %r9, REGISTER_SAVE_R9(%rsp)
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+ # We also have to preserve bound registers. These are nops if
|
|
|
5de29b |
+ # Intel MPX isn't available or disabled.
|
|
|
5de29b |
+# ifdef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+ bndmov %bnd0, REGISTER_SAVE_BND0(%rsp)
|
|
|
5de29b |
+ bndmov %bnd1, REGISTER_SAVE_BND1(%rsp)
|
|
|
5de29b |
+ bndmov %bnd2, REGISTER_SAVE_BND2(%rsp)
|
|
|
5de29b |
+ bndmov %bnd3, REGISTER_SAVE_BND3(%rsp)
|
|
|
5de29b |
+# else
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x44,0x24,REGISTER_SAVE_BND0
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x4c,0x24,REGISTER_SAVE_BND1
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x54,0x24,REGISTER_SAVE_BND2
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x5c,0x24,REGISTER_SAVE_BND3
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
+ # Copy args pushed by PLT in register.
|
|
|
5de29b |
+ # %rdi: link_map, %rsi: reloc_index
|
|
|
5de29b |
+ movq (REGISTER_SAVE_AREA + 8)(%rsp), %rsi
|
|
|
5de29b |
+ movq REGISTER_SAVE_AREA(%rsp), %rdi
|
|
|
5de29b |
call _dl_fixup # Call resolver.
|
|
|
5de29b |
movq %rax, %r11 # Save return value
|
|
|
5de29b |
- movq 48(%rsp), %r9 # Get register content back.
|
|
|
5de29b |
- movq 40(%rsp), %r8
|
|
|
5de29b |
- movq 32(%rsp), %rdi
|
|
|
5de29b |
- movq 24(%rsp), %rsi
|
|
|
5de29b |
- movq 16(%rsp), %rdx
|
|
|
5de29b |
- movq 8(%rsp), %rcx
|
|
|
5de29b |
- movq (%rsp), %rax
|
|
|
5de29b |
- addq $72, %rsp # Adjust stack(PLT did 2 pushes)
|
|
|
5de29b |
- cfi_adjust_cfa_offset(-72)
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+ # Restore bound registers. These are nops if Intel MPX isn't
|
|
|
5de29b |
+ # avaiable or disabled.
|
|
|
5de29b |
+# ifdef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+ bndmov REGISTER_SAVE_BND3(%rsp), %bnd3
|
|
|
5de29b |
+ bndmov REGISTER_SAVE_BND2(%rsp), %bnd2
|
|
|
5de29b |
+ bndmov REGISTER_SAVE_BND1(%rsp), %bnd1
|
|
|
5de29b |
+ bndmov REGISTER_SAVE_BND0(%rsp), %bnd0
|
|
|
5de29b |
+# else
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x5c,0x24,REGISTER_SAVE_BND3
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x54,0x24,REGISTER_SAVE_BND2
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x4c,0x24,REGISTER_SAVE_BND1
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1a,0x44,0x24,REGISTER_SAVE_BND0
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
+ # Get register content back.
|
|
|
5de29b |
+ movq REGISTER_SAVE_R9(%rsp), %r9
|
|
|
5de29b |
+ movq REGISTER_SAVE_R8(%rsp), %r8
|
|
|
5de29b |
+ movq REGISTER_SAVE_RDI(%rsp), %rdi
|
|
|
5de29b |
+ movq REGISTER_SAVE_RSI(%rsp), %rsi
|
|
|
5de29b |
+ movq REGISTER_SAVE_RDX(%rsp), %rdx
|
|
|
5de29b |
+ movq REGISTER_SAVE_RCX(%rsp), %rcx
|
|
|
5de29b |
+ movq REGISTER_SAVE_RAX(%rsp), %rax
|
|
|
5de29b |
+ # Adjust stack(PLT did 2 pushes)
|
|
|
5de29b |
+ addq $(REGISTER_SAVE_AREA + 16), %rsp
|
|
|
5de29b |
+ cfi_adjust_cfa_offset(-(REGISTER_SAVE_AREA + 16))
|
|
|
5de29b |
jmp *%r11 # Jump to function address.
|
|
|
5de29b |
cfi_endproc
|
|
|
5de29b |
.size _dl_runtime_resolve, .-_dl_runtime_resolve
|
|
|
5de29b |
@@ -130,6 +189,20 @@
|
|
|
5de29b |
movaps %xmm6, (LR_XMM_OFFSET + XMM_SIZE*6)(%rsp)
|
|
|
5de29b |
movaps %xmm7, (LR_XMM_OFFSET + XMM_SIZE*7)(%rsp)
|
|
|
5de29b |
|
|
|
5de29b |
+# ifndef __ILP32__
|
|
|
5de29b |
+# ifdef HAVE_MPX_SUPPORT
|
|
|
5de29b |
+ bndmov %bnd0, (LR_BND_OFFSET)(%rsp) # Preserve bound
|
|
|
5de29b |
+ bndmov %bnd1, (LR_BND_OFFSET + BND_SIZE)(%rsp) # registers. Nops if
|
|
|
5de29b |
+ bndmov %bnd2, (LR_BND_OFFSET + BND_SIZE*2)(%rsp) # MPX not available
|
|
|
5de29b |
+ bndmov %bnd3, (LR_BND_OFFSET + BND_SIZE*3)(%rsp) # or disabled.
|
|
|
5de29b |
+# else
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x84,0x24;.long (LR_BND_OFFSET)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x8c,0x24;.long (LR_BND_OFFSET + BND_SIZE)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x84,0x24;.long (LR_BND_OFFSET + BND_SIZE*2)
|
|
|
5de29b |
+ .byte 0x66,0x0f,0x1b,0x8c,0x24;.long (LR_BND_OFFSET + BND_SIZE*3)
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+# endif
|
|
|
5de29b |
+
|
|
|
5de29b |
# if defined HAVE_AVX_SUPPORT || defined HAVE_AVX512_ASM_SUPPORT
|
|
|
5de29b |
.data
|
|
|
5de29b |
L(have_avx):
|
|
|
12745e |
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/link-defines.sym glibc-2.17-c758a686/sysdeps/x86_64/link-defines.sym
|
|
|
5de29b |
--- glibc-2.17-c758a686/sysdeps/x86_64/link-defines.sym 2014-09-10 23:26:03.468045806 -0400
|
|
|
12745e |
+++ glibc-2.17-c758a686/sysdeps/x86_64/link-defines.sym 2014-09-10 23:27:41.535851922 -0400
|
|
|
5de29b |
@@ -6,6 +6,7 @@
|
|
|
5de29b |
XMM_SIZE sizeof (La_x86_64_xmm)
|
|
|
5de29b |
YMM_SIZE sizeof (La_x86_64_ymm)
|
|
|
5de29b |
ZMM_SIZE sizeof (La_x86_64_zmm)
|
|
|
5de29b |
+BND_SIZE sizeof (__int128)
|
|
|
5de29b |
|
|
|
5de29b |
LR_SIZE sizeof (struct La_x86_64_regs)
|
|
|
5de29b |
LR_RDX_OFFSET offsetof (struct La_x86_64_regs, lr_rdx)
|
|
|
5de29b |
@@ -18,6 +19,9 @@
|
|
|
5de29b |
LR_RSP_OFFSET offsetof (struct La_x86_64_regs, lr_rsp)
|
|
|
5de29b |
LR_XMM_OFFSET offsetof (struct La_x86_64_regs, lr_xmm)
|
|
|
5de29b |
LR_VECTOR_OFFSET offsetof (struct La_x86_64_regs, lr_vector)
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+LR_BND_OFFSET offsetof (struct La_x86_64_regs, lr_bnd)
|
|
|
5de29b |
+#endif
|
|
|
5de29b |
|
|
|
5de29b |
LRV_SIZE sizeof (struct La_x86_64_retval)
|
|
|
5de29b |
LRV_RAX_OFFSET offsetof (struct La_x86_64_retval, lrv_rax)
|
|
|
5de29b |
@@ -28,3 +32,7 @@
|
|
|
5de29b |
LRV_ST1_OFFSET offsetof (struct La_x86_64_retval, lrv_st1)
|
|
|
5de29b |
LRV_VECTOR0_OFFSET offsetof (struct La_x86_64_retval, lrv_vector0)
|
|
|
5de29b |
LRV_VECTOR1_OFFSET offsetof (struct La_x86_64_retval, lrv_vector1)
|
|
|
5de29b |
+#ifndef __ILP32__
|
|
|
5de29b |
+LRV_BND0_OFFSET offsetof (struct La_x86_64_retval, lrv_bnd0)
|
|
|
5de29b |
+LRV_BND1_OFFSET offsetof (struct La_x86_64_retval, lrv_bnd1)
|
|
|
5de29b |
+#endif
|