diff options
31 files changed, 75 insertions, 770 deletions
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index 302c00ac62..bb83609d57 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -19,55 +19,14 @@ #include <sysdep.h> #include <pointer_guard.h> #include <jmpbuf-offsets.h> -#include <jmp_buf-ssp.h> #include <asm-syntax.h> #include <stap-probe.h> -/* Don't restore shadow stack register if - 1. Shadow stack isn't enabled. Or - 2. __longjmp is defined for __longjmp_cancel. - */ -#if !SHSTK_ENABLED || defined __longjmp -# undef SHADOW_STACK_POINTER_OFFSET -#endif - .text ENTRY (__longjmp) #ifdef PTR_DEMANGLE movl 4(%esp), %eax /* User's jmp_buf in %eax. */ -# ifdef SHADOW_STACK_POINTER_OFFSET -# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET - /* Check if Shadow Stack is enabled. */ - testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET - jz L(skip_ssp) -# else - xorl %edx, %edx -# endif - /* Check and adjust the Shadow-Stack-Pointer. */ - rdsspd %edx - /* And compare it with the saved ssp value. */ - subl SHADOW_STACK_POINTER_OFFSET(%eax), %edx - je L(skip_ssp) - /* Count the number of frames to adjust and adjust it - with incssp instruction. The instruction can adjust - the ssp by [0..255] value only thus use a loop if - the number of frames is bigger than 255. */ - negl %edx - shrl $2, %edx - /* NB: We saved Shadow-Stack-Pointer of setjmp. Since we are - restoring Shadow-Stack-Pointer of setjmp's caller, we - need to unwind shadow stack by one more frame. */ - addl $1, %edx - movl $255, %ebx -L(loop): - cmpl %ebx, %edx - cmovb %edx, %ebx - incsspd %ebx - subl %ebx, %edx - ja L(loop) -L(skip_ssp): -# endif /* Save the return address now. */ movl (JB_PC*4)(%eax), %edx /* Get the stack pointer. */ @@ -98,38 +57,6 @@ L(skip_ssp): #else movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */ movl 8(%esp), %eax /* Second argument is return value. */ -# ifdef SHADOW_STACK_POINTER_OFFSET -# if IS_IN (libc) && defined SHARED - /* Check if Shadow Stack is enabled. */ - testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET - jz L(skip_ssp) -# endif - /* Check and adjust the Shadow-Stack-Pointer. */ - xorl %edx, %edx - /* Get the current ssp. */ - rdsspd %edx - /* And compare it with the saved ssp value. */ - subl SHADOW_STACK_POINTER_OFFSET(%ecx), %edx - je L(skip_ssp) - /* Count the number of frames to adjust and adjust it - with incssp instruction. The instruction can adjust - the ssp by [0..255] value only thus use a loop if - the number of frames is bigger than 255. */ - negl %edx - shrl $2, %edx - /* NB: We saved Shadow-Stack-Pointer of setjmp. Since we are - restoring Shadow-Stack-Pointer of setjmp's caller, we - need to unwind shadow stack by one more frame. */ - addl $1, %edx - movl $255, %ebx -L(loop): - cmpl %ebx, %edx - cmovb %edx, %ebx - incsspd %ebx - subl %ebx, %edx - ja L(loop) -L(skip_ssp): -# endif /* Save the return address now. */ movl (JB_PC*4)(%ecx), %edx LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx) diff --git a/sysdeps/i386/add_n.S b/sysdeps/i386/add_n.S index d4af6d92ec..c1b7098b1c 100644 --- a/sysdeps/i386/add_n.S +++ b/sysdeps/i386/add_n.S @@ -40,13 +40,6 @@ ENTRY (__mpn_add_n) cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx - -#if IBT_ENABLED - pushl %ebx - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) -#endif - movl %ecx,%eax shrl $3,%ecx /* compute count for unrolled loop */ negl %eax @@ -58,9 +51,6 @@ ENTRY (__mpn_add_n) subl %eax,%esi /* ... by a constant when we ... */ subl %eax,%edx /* ... enter the loop */ shrl $2,%eax /* restore previous value */ -#if IBT_ENABLED - leal -4(,%eax,4),%ebx /* Count for 4-byte endbr32 */ -#endif #ifdef PIC /* Calculate start address in loop for PIC. Due to limitations in some assemblers, Loop-L0-3 cannot be put into the leal */ @@ -75,39 +65,29 @@ L(0): leal (%eax,%eax,8),%eax /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax #endif -#if IBT_ENABLED - addl %ebx,%eax /* Adjust for endbr32 */ -#endif jmp *%eax /* jump into loop */ ALIGN (3) L(oop): movl (%esi),%eax adcl (%edx),%eax movl %eax,(%edi) - _CET_ENDBR movl 4(%esi),%eax adcl 4(%edx),%eax movl %eax,4(%edi) - _CET_ENDBR movl 8(%esi),%eax adcl 8(%edx),%eax movl %eax,8(%edi) - _CET_ENDBR movl 12(%esi),%eax adcl 12(%edx),%eax movl %eax,12(%edi) - _CET_ENDBR movl 16(%esi),%eax adcl 16(%edx),%eax movl %eax,16(%edi) - _CET_ENDBR movl 20(%esi),%eax adcl 20(%edx),%eax movl %eax,20(%edi) - _CET_ENDBR movl 24(%esi),%eax adcl 24(%edx),%eax movl %eax,24(%edi) - _CET_ENDBR movl 28(%esi),%eax adcl 28(%edx),%eax movl %eax,28(%edi) @@ -120,11 +100,6 @@ L(oop): movl (%esi),%eax sbbl %eax,%eax negl %eax -#if IBT_ENABLED - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#endif popl %esi cfi_adjust_cfa_offset (-4) cfi_restore (esi) diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S index eb3ac9c8e9..5fd671a477 100644 --- a/sysdeps/i386/bsd-_setjmp.S +++ b/sysdeps/i386/bsd-_setjmp.S @@ -23,18 +23,12 @@ #include <sysdep.h> #include <pointer_guard.h> #include <jmpbuf-offsets.h> -#include <jmp_buf-ssp.h> #include <stap-probe.h> #define PARMS 4 /* no space for saved regs */ #define JMPBUF PARMS #define SIGMSK JMPBUF+4 -/* Don't save shadow stack register if shadow stack isn't enabled. */ -#if !SHSTK_ENABLED -# undef SHADOW_STACK_POINTER_OFFSET -#endif - ENTRY (_setjmp) xorl %eax, %eax @@ -58,21 +52,6 @@ ENTRY (_setjmp) movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ movl %eax, JB_SIZE(%edx) /* No signal mask set. */ -#ifdef SHADOW_STACK_POINTER_OFFSET -# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET - /* Check if Shadow Stack is enabled. */ - testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET - jz L(skip_ssp) -# else - xorl %ecx, %ecx -# endif - /* Get the current Shadow-Stack-Pointer and save it. */ - rdsspd %ecx - movl %ecx, SHADOW_STACK_POINTER_OFFSET(%edx) -# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET -L(skip_ssp): -# endif -#endif ret END (_setjmp) libc_hidden_def (_setjmp) diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S index c03f235d0f..13338a6480 100644 --- a/sysdeps/i386/bsd-setjmp.S +++ b/sysdeps/i386/bsd-setjmp.S @@ -23,18 +23,12 @@ #include <sysdep.h> #include <pointer_guard.h> #include <jmpbuf-offsets.h> -#include <jmp_buf-ssp.h> #include <stap-probe.h> #define PARMS 4 /* no space for saved regs */ #define JMPBUF PARMS #define SIGMSK JMPBUF+4 -/* Don't save shadow stack register if shadow stack isn't enabled. */ -#if !SHSTK_ENABLED -# undef SHADOW_STACK_POINTER_OFFSET -#endif - ENTRY (setjmp) /* Note that we have to use a non-exported symbol in the next jump since otherwise gas will emit it as a jump through the @@ -58,21 +52,6 @@ ENTRY (setjmp) #endif movl %ecx, (JB_PC*4)(%eax) movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ -#ifdef SHADOW_STACK_POINTER_OFFSET -# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET - /* Check if Shadow Stack is enabled. */ - testl $X86_FEATURE_1_SHSTK, %gs:FEATURE_1_OFFSET - jz L(skip_ssp) -# else - xorl %ecx, %ecx -# endif - /* Get the current Shadow-Stack-Pointer and save it. */ - rdsspd %ecx - movl %ecx, SHADOW_STACK_POINTER_OFFSET(%eax) -# if IS_IN (libc) && defined SHARED && defined FEATURE_1_OFFSET -L(skip_ssp): -# endif -#endif /* Call __sigjmp_save. */ pushl $1 diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S index 71d19b698c..f9662eeb5a 100644 --- a/sysdeps/i386/crti.S +++ b/sysdeps/i386/crti.S @@ -61,7 +61,6 @@ .hidden _init .type _init, @function _init: - _CET_ENDBR pushl %ebx /* Maintain 16-byte stack alignment for called functions. */ subl $8, %esp @@ -82,7 +81,6 @@ _init: .hidden _fini .type _fini, @function _fini: - _CET_ENDBR pushl %ebx subl $8, %esp LOAD_PIC_REG (bx) diff --git a/sysdeps/i386/dl-tlsdesc.S b/sysdeps/i386/dl-tlsdesc.S index 318b82a561..90d93caa0c 100644 --- a/sysdeps/i386/dl-tlsdesc.S +++ b/sysdeps/i386/dl-tlsdesc.S @@ -37,7 +37,6 @@ cfi_startproc .align 16 _dl_tlsdesc_return: - _CET_ENDBR movl 4(%eax), %eax ret cfi_endproc @@ -59,7 +58,6 @@ _dl_tlsdesc_return: cfi_startproc .align 16 _dl_tlsdesc_undefweak: - _CET_ENDBR movl 4(%eax), %eax subl %gs:0, %eax ret @@ -101,7 +99,6 @@ _dl_tlsdesc_dynamic (struct tlsdesc *tdp) cfi_startproc .align 16 _dl_tlsdesc_dynamic: - _CET_ENDBR /* Like all TLS resolvers, preserve call-clobbered registers. We need two scratch regs anyway. */ subl $28, %esp diff --git a/sysdeps/i386/dl-trampoline.S b/sysdeps/i386/dl-trampoline.S index ecba034958..2632020145 100644 --- a/sysdeps/i386/dl-trampoline.S +++ b/sysdeps/i386/dl-trampoline.S @@ -26,7 +26,6 @@ .align 16 _dl_runtime_resolve: cfi_adjust_cfa_offset (8) - _CET_ENDBR pushl %eax # Preserve registers otherwise clobbered. cfi_adjust_cfa_offset (4) pushl %ecx @@ -53,7 +52,6 @@ _dl_runtime_resolve: .align 16 _dl_runtime_resolve_shstk: cfi_adjust_cfa_offset (8) - _CET_ENDBR pushl %eax # Preserve registers otherwise clobbered. cfi_adjust_cfa_offset (4) pushl %edx @@ -78,7 +76,6 @@ _dl_runtime_resolve_shstk: .align 16 _dl_runtime_profile_shstk: cfi_adjust_cfa_offset (8) - _CET_ENDBR pushl %esp cfi_adjust_cfa_offset (4) addl $8, (%esp) # Account for the pushed PLT data @@ -123,7 +120,6 @@ _dl_runtime_profile_shstk: .align 16 _dl_runtime_profile: cfi_adjust_cfa_offset (8) - _CET_ENDBR pushl %esp cfi_adjust_cfa_offset (4) addl $8, (%esp) # Account for the pushed PLT data diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S index 8066649f8e..6082e1a7de 100644 --- a/sysdeps/i386/i386-mcount.S +++ b/sysdeps/i386/i386-mcount.S @@ -29,7 +29,6 @@ .type C_SYMBOL_NAME(_mcount), @function .align ALIGNARG(4) C_LABEL(_mcount) - _CET_ENDBR /* Save the caller-clobbered registers. */ pushl %eax pushl %ecx @@ -58,7 +57,6 @@ weak_alias (_mcount, mcount) .type C_SYMBOL_NAME(__fentry__), @function .align ALIGNARG(4) C_LABEL(__fentry__) - _CET_ENDBR /* Save the caller-clobbered registers. */ pushl %eax pushl %ecx diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S index c2bc798187..bbc0cc71a2 100644 --- a/sysdeps/i386/i686/add_n.S +++ b/sysdeps/i386/i686/add_n.S @@ -44,13 +44,6 @@ ENTRY (__mpn_add_n) cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx - -#if IBT_ENABLED - pushl %ebx - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) -#endif - movl %ecx,%eax shrl $3,%ecx /* compute count for unrolled loop */ negl %eax @@ -62,9 +55,6 @@ ENTRY (__mpn_add_n) subl %eax,%esi /* ... by a constant when we ... */ subl %eax,%edx /* ... enter the loop */ shrl $2,%eax /* restore previous value */ -#if IBT_ENABLED - leal -4(,%eax,4),%ebx /* Count for 4-byte endbr32 */ -#endif #ifdef PIC /* Calculate start address in loop for PIC. */ leal (L(oop)-L(0)-3)(%eax,%eax,8),%eax @@ -74,39 +64,29 @@ L(0): /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax #endif -#if IBT_ENABLED - addl %ebx,%eax /* Adjust for endbr32 */ -#endif jmp *%eax /* jump into loop */ ALIGN (3) L(oop): movl (%esi),%eax adcl (%edx),%eax movl %eax,(%edi) - _CET_ENDBR movl 4(%esi),%eax adcl 4(%edx),%eax movl %eax,4(%edi) - _CET_ENDBR movl 8(%esi),%eax adcl 8(%edx),%eax movl %eax,8(%edi) - _CET_ENDBR movl 12(%esi),%eax adcl 12(%edx),%eax movl %eax,12(%edi) - _CET_ENDBR movl 16(%esi),%eax adcl 16(%edx),%eax movl %eax,16(%edi) - _CET_ENDBR movl 20(%esi),%eax adcl 20(%edx),%eax movl %eax,20(%edi) - _CET_ENDBR movl 24(%esi),%eax adcl 24(%edx),%eax movl %eax,24(%edi) - _CET_ENDBR movl 28(%esi),%eax adcl 28(%edx),%eax movl %eax,28(%edi) @@ -119,11 +99,6 @@ L(oop): movl (%esi),%eax sbbl %eax,%eax negl %eax -#if IBT_ENABLED - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#endif popl %esi cfi_adjust_cfa_offset (-4) cfi_restore (esi) diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S index 94600f5e53..0738ee94fd 100644 --- a/sysdeps/i386/i686/memcmp.S +++ b/sysdeps/i386/i686/memcmp.S @@ -80,7 +80,7 @@ L(not_1): LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx) addl %ecx, %edx addl %ecx, %esi - _CET_NOTRACK jmp *%ebx + jmp *%ebx ALIGN (4) L(28bytes): @@ -326,7 +326,7 @@ L(32bytesormore): LOAD_JUMP_TABLE_ENTRY (L(table_32bytes), %ecx) addl %ecx, %edx addl %ecx, %esi - _CET_NOTRACK jmp *%ebx + jmp *%ebx L(load_ecx_28): addl $0x4, %edx diff --git a/sysdeps/i386/i686/multiarch/memcmp-sse4.S b/sysdeps/i386/i686/multiarch/memcmp-sse4.S index f0b2d8429f..2cdda5f80d 100644 --- a/sysdeps/i386/i686/multiarch/memcmp-sse4.S +++ b/sysdeps/i386/i686/multiarch/memcmp-sse4.S @@ -58,7 +58,7 @@ absolute address. */ \ addl (%ebx,INDEX,SCALE), %ebx; \ /* We loaded the jump table and adjusted EDX/ESI. Go. */ \ - _CET_NOTRACK jmp *%ebx + jmp *%ebx # else # define JMPTBL(I, B) I @@ -66,7 +66,7 @@ jump table with relative offsets. INDEX is a register contains the index into the jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) + jmp *TABLE(,INDEX,SCALE) # endif diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S index abdde55001..a7e80dcd90 100644 --- a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S +++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S @@ -64,7 +64,7 @@ absolute address. */ \ addl (%ebx,INDEX,SCALE), %ebx; \ /* We loaded the jump table. Go. */ \ - _CET_NOTRACK jmp *%ebx + jmp *%ebx # define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) \ addl $(TABLE - .), %ebx @@ -72,7 +72,7 @@ # define BRANCH_TO_JMPTBL_ENTRY_TAIL(TABLE, INDEX, SCALE) \ addl (%ebx,INDEX,SCALE), %ebx; \ /* We loaded the jump table. Go. */ \ - _CET_NOTRACK jmp *%ebx + jmp *%ebx #else # define PARMS 4 # define ENTRANCE @@ -84,12 +84,12 @@ absolute offsets. INDEX is a register contains the index into the jump table. SCALE is the scale of INDEX. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE, INDEX, SCALE) \ - _CET_NOTRACK jmp *TABLE(,INDEX,SCALE) + jmp *TABLE(,INDEX,SCALE) # define BRANCH_TO_JMPTBL_ENTRY_VALUE(TABLE) # define BRANCH_TO_JMPTBL_ENTRY_ |
