aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/i386/makecontext.S
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-05 10:36:40 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-09 13:55:51 -0300
commit25f1e16ef03a6a8fb1701c4647d46c564480d88c (patch)
treec4f2b8148ab0fe004bae19105d8f8169ab9922a7 /sysdeps/unix/sysv/linux/i386/makecontext.S
parentb7fc4a07f206a640e6d807d72f5c1ee3ea7a25b6 (diff)
downloadglibc-25f1e16ef03a6a8fb1701c4647d46c564480d88c.tar
glibc-25f1e16ef03a6a8fb1701c4647d46c564480d88c.tar.gz
glibc-25f1e16ef03a6a8fb1701c4647d46c564480d88c.tar.bz2
glibc-25f1e16ef03a6a8fb1701c4647d46c564480d88c.zip
i386: Remove CET support
CET is only support for x86_64, this patch reverts: - faaee1f07ed x86: Support shadow stack pointer in setjmp/longjmp. - be9ccd27c09 i386: Add _CET_ENDBR to indirect jump targets in add_n.S/sub_n.S - c02695d7764 x86/CET: Update vfork to prevent child return - 5d844e1b725 i386: Enable CET support in ucontext functions - 124bcde683 x86: Add _CET_ENDBR to functions in crti.S - 562837c002 x86: Add _CET_ENDBR to functions in dl-tlsdesc.S - f753fa7dea x86: Support IBT and SHSTK in Intel CET [BZ #21598] - 825b58f3fb i386-mcount.S: Add _CET_ENDBR to _mcount and __fentry__ - 7e119cd582 i386: Use _CET_NOTRACK in i686/memcmp.S - 177824e232 i386: Use _CET_NOTRACK in memcmp-sse4.S - 0a899af097 i386: Use _CET_NOTRACK in memcpy-ssse3-rep.S - 7fb613361c i386: Use _CET_NOTRACK in memcpy-ssse3.S - 77a8ae0948 i386: Use _CET_NOTRACK in memset-sse2-rep.S - 00e7b76a8f i386: Use _CET_NOTRACK in memset-sse2.S - 90d15dc577 i386: Use _CET_NOTRACK in strcat-sse2.S - f1574581c7 i386: Use _CET_NOTRACK in strcpy-sse2.S - 4031d7484a i386/sub_n.S: Add a missing _CET_ENDBR to indirect jump - target - Checked on i686-linux-gnu.
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/makecontext.S')
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S123
1 files changed, 0 insertions, 123 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index 814127d130..7ee56300fa 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -17,7 +17,6 @@
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <asm/prctl.h>
#include "ucontext_i.h"
@@ -68,127 +67,6 @@ ENTRY(__makecontext)
jnz 1b
2:
-#if SHSTK_ENABLED
- /* Check if Shadow Stack is enabled. */
- testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET
- jz L(skip_ssp)
-
- /* Reload the pointer to ucontext. */
- movl 4(%esp), %eax
-
- /* Shadow stack is enabled. We need to allocate a new shadow
- stack. */
- subl oSS_SP(%eax), %edx
- shrl $STACK_SIZE_TO_SHADOW_STACK_SIZE_SHIFT, %edx
-
- /* Align shadow stack size to 8 bytes. */
- addl $7, %edx
- andl $-8, %edx
-
- /* Store shadow stack size in __ssp[2]. */
- movl %edx, (oSSP + 8)(%eax)
-
- /* Save ESI in the second scratch register slot. */
- movl %esi, oSCRATCH2(%eax)
- /* Save EDI in the third scratch register slot. */
- movl %edi, oSCRATCH3(%eax)
-
- /* Save the pointer to ucontext. */
- movl %eax, %edi
-
- /* Get the original shadow stack pointer. */
- rdsspd %esi
-
- /* Align the saved original shadow stack pointer to the next
- 8 byte aligned boundary. */
- andl $-8, %esi
-
- /* Load the top of the new stack into EDX. */
- movl oESP(%eax), %edx
-
- /* We need to terminate the FDE here because the unwinder looks
- at ra-1 for unwind information. */
- cfi_endproc
-
- /* Swap the original stack pointer with the top of the new
- stack. */
- xchgl %esp, %edx
-
- /* Add 4 bytes since CALL will push the 4-byte return address
- onto stack. */
- addl $4, %esp
-
- /* Allocate the new shadow stack. Save EBX in the first scratch
- register slot. */
- movl %ebx, oSCRATCH1(%eax)
-
- /* CET syscall takes 64-bit sizes. */
- subl $16, %esp
- movl (oSSP + 8)(%eax), %ecx
- movl %ecx, (%esp)
- movl $0, 4(%esp)
- movl %ecx, 8(%esp)
- movl $0, 12(%esp)
- movl %esp, %ecx
-
- movl $ARCH_CET_ALLOC_SHSTK, %ebx
- movl $__NR_arch_prctl, %eax
- ENTER_KERNEL
- testl %eax, %eax
- jne L(hlt) /* This should never happen. */
-
- /* Copy the base address of the new shadow stack to __ssp[1]. */
- movl (%esp), %eax
- movl %eax, (oSSP + 4)(%edi)
-
- addl $16, %esp
-
- /* Restore EBX from the first scratch register slot. */
- movl oSCRATCH1(%edi), %ebx
-
- /* Get the size of the new shadow stack. */
- movl (oSSP + 8)(%edi), %ecx
-
- /* Use the restore stoken to restore the new shadow stack. */
- rstorssp -8(%eax, %ecx)
-
- /* Save the restore token at the next 8 byte aligned boundary
- on the original shadow stack. */
- saveprevssp
-
- /* Push the address of "jmp exitcode" onto the new stack as
- well as the new shadow stack. */
- call 1f
- jmp L(exitcode)
-1:
-
- /* Get the new shadow stack pointer. */
- rdsspd %eax
-
- /* Use the restore stoken to restore the original shadow stack. */
- rstorssp -8(%esi)
-
- /* Save the restore token on the new shadow stack. */
- saveprevssp
-
- /* Store the new shadow stack pointer in __ssp[0]. */
- movl %eax, oSSP(%edi)
-
- /* Restore the original stack. */
- mov %edx, %esp
-
- cfi_startproc
-
- /* Restore ESI from the second scratch register slot. */
- movl oSCRATCH2(%edi), %esi
- /* Restore EDI from the third scratch register slot. */
- movl oSCRATCH3(%edi), %edi
-
- ret
-
-L(skip_ssp):
-#endif
-
/* If the function we call returns we must continue with the
context which is given in the uc_link element. To do this
set the return address for the function the user provides
@@ -244,7 +122,6 @@ L(call_exit):
call HIDDEN_JUMPTARGET(exit)
/* The 'exit' call should never return. In case it does cause
the process to terminate. */
-L(hlt):
hlt
cfi_startproc
END(__makecontext)