From dc5b59f02bbee81d3e277f9fe7787ace09e3bbca Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Tue, 23 Apr 2024 13:34:59 +0200 Subject: [PATCH] Remove accidentally duplicated shadow stack handling --- src/asm/jump_x86_64_sysv_elf_gas.S | 8 -------- src/asm/make_x86_64_sysv_elf_gas.S | 29 ----------------------------- 2 files changed, 37 deletions(-) diff --git a/src/asm/jump_x86_64_sysv_elf_gas.S b/src/asm/jump_x86_64_sysv_elf_gas.S index be264bdc..ff303bfa 100644 --- a/src/asm/jump_x86_64_sysv_elf_gas.S +++ b/src/asm/jump_x86_64_sysv_elf_gas.S @@ -67,14 +67,6 @@ jump_fcontext: movq %rbx, 0x30(%rsp) /* save RBX */ movq %rbp, 0x38(%rsp) /* save RBP */ -#if BOOST_CONTEXT_SHADOW_STACK - /* grow the stack to reserve space for shadow stack pointer(SSP) */ - leaq -0x8(%rsp), %rsp - /* read the current SSP and store it */ - rdsspq %rcx - movq %rcx, (%rsp) -#endif - #if BOOST_CONTEXT_SHADOW_STACK /* grow the stack to reserve space for shadow stack pointer(SSP) */ leaq -0x8(%rsp), %rsp diff --git a/src/asm/make_x86_64_sysv_elf_gas.S b/src/asm/make_x86_64_sysv_elf_gas.S index b0d0c034..df947243 100644 --- a/src/asm/make_x86_64_sysv_elf_gas.S +++ b/src/asm/make_x86_64_sysv_elf_gas.S @@ -91,35 +91,6 @@ make_fcontext: /* will be entered after context-function returns */ movq %rcx, 0x38(%rax) -#if BOOST_CONTEXT_SHADOW_STACK - /* Populate the shadow stack and normal stack */ - /* get original SSP */ - rdsspq %r8 - /* restore new shadow stack */ - rstorssp -0x8(%r9) - /* save the restore token on the original shadow stack */ - saveprevssp - /* push the address of "jmp trampoline" to the new shadow stack */ - /* as well as the stack */ - call 1f - jmp trampoline -1: - /* save address of "jmp trampoline" as return-address */ - /* for context-function */ - pop 0x38(%rax) - /* Get the new SSP. */ - rdsspq %r9 - /* restore original shadow stack */ - rstorssp -0x8(%r8) - /* save the restore token on the new shadow stack. */ - saveprevssp - - /* reserve space for the new SSP */ - leaq -0x8(%rax), %rax - /* save the new SSP to this fcontext */ - movq %r9, (%rax) -#endif - #if BOOST_CONTEXT_SHADOW_STACK /* Populate the shadow stack */