]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/x86_64/dl-trampoline.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / x86_64 / dl-trampoline.h
index 9ddaafee17b3e70cde862a4dd20b9815b1a521d3..be6627cc498debf2a8497077801b933d370bd17f 100644 (file)
@@ -1,5 +1,5 @@
 /* PLT trampolines.  x86-64 version.
-   Copyright (C) 2009-2017 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 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
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
        .text
 #ifdef _dl_runtime_resolve
@@ -64,6 +64,7 @@
        cfi_startproc
 _dl_runtime_resolve:
        cfi_adjust_cfa_offset(16) # Incorporate PLT
+       _CET_ENDBR
 # if DL_RUNTIME_RESOLVE_REALIGN_STACK
 #  if LOCAL_STORAGE_AREA != 8
 #   error LOCAL_STORAGE_AREA must be 8
@@ -168,6 +169,7 @@ _dl_runtime_resolve:
 _dl_runtime_profile:
        cfi_startproc
        cfi_adjust_cfa_offset(16) # Incorporate PLT
+       _CET_ENDBR
        /* The La_x86_64_regs data structure pointed to by the
           fourth paramater must be VEC_SIZE-byte aligned.  This must
           be explicitly enforced.  We have the set up a dynamically
@@ -440,8 +442,16 @@ _dl_runtime_profile:
 # ifdef RESTORE_AVX
        /* sizeof(La_x86_64_retval).  Need extra space for 2 SSE
           registers to detect if xmm0/xmm1 registers are changed
-          by audit module.  */
-       sub $(LRV_SIZE + XMM_SIZE*2), %RSP_LP
+          by audit module.  Since rsp is aligned to VEC_SIZE, we
+          need to make sure that the address of La_x86_64_retval +
+          LRV_VECTOR0_OFFSET is aligned to VEC_SIZE.  */
+#  define LRV_SPACE (LRV_SIZE + XMM_SIZE*2)
+#  define LRV_MISALIGNED ((LRV_SIZE + LRV_VECTOR0_OFFSET) & (VEC_SIZE - 1))
+#  if LRV_MISALIGNED == 0
+       sub $LRV_SPACE, %RSP_LP
+#  else
+       sub $(LRV_SPACE + VEC_SIZE - LRV_MISALIGNED), %RSP_LP
+#  endif
 # else
        sub $LRV_SIZE, %RSP_LP  # sizeof(La_x86_64_retval)
 # endif