mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-29 16:21:07 +00:00
Use R*_LP, sizeSS, oSS_FLAGS, oSS_SP and oSS_SIZE
This commit is contained in:
parent
048073995f
commit
85736dc78b
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2012-05-15 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/Makefile (gen-as-const-headers):
|
||||||
|
Add sigaltstack-offsets.sym.
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Include
|
||||||
|
<sigaltstack-offsets.h>.
|
||||||
|
(CALL_FAIL): Use RSP_LP to operate on stack. Use RDI_LP on
|
||||||
|
longjmp_msg pointer.
|
||||||
|
(____longjmp_chk): Use R8_LP and RDX_LP on SP and PC. Use
|
||||||
|
R*_LP, sizeSS, oSS_FLAGS, oSS_SP and oSS_SIZE for alternate
|
||||||
|
signal stack.
|
||||||
|
* sysdeps/unix/sysv/linux/x86_64/sigaltstack-offsets.sym: New.
|
||||||
|
|
||||||
2012-05-15 Joseph Myers <joseph@codesourcery.com>
|
2012-05-15 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* elf/stackguard-macros.h: Remove file.
|
* elf/stackguard-macros.h: Remove file.
|
||||||
|
@ -17,6 +17,10 @@ ifeq ($(subdir),csu)
|
|||||||
gen-as-const-headers += ucontext_i.sym
|
gen-as-const-headers += ucontext_i.sym
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(subdir),misc)
|
||||||
|
gen-as-const-headers += sigaltstack-offsets.sym
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(subdir),elf)
|
ifeq ($(subdir),elf)
|
||||||
sysdep_routines += dl-vdso
|
sysdep_routines += dl-vdso
|
||||||
endif
|
endif
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include <jmpbuf-offsets.h>
|
#include <jmpbuf-offsets.h>
|
||||||
#include <asm-syntax.h>
|
#include <asm-syntax.h>
|
||||||
|
|
||||||
|
#include <sigaltstack-offsets.h>
|
||||||
|
|
||||||
.section .rodata.str1.1,"aMS",@progbits,1
|
.section .rodata.str1.1,"aMS",@progbits,1
|
||||||
.type longjmp_msg,@object
|
.type longjmp_msg,@object
|
||||||
longjmp_msg:
|
longjmp_msg:
|
||||||
@ -29,18 +31,18 @@ longjmp_msg:
|
|||||||
//#define __longjmp ____longjmp_chk
|
//#define __longjmp ____longjmp_chk
|
||||||
|
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
# define CALL_FAIL subq $8, %rsp; \
|
# define CALL_FAIL sub $8, %RSP_LP; \
|
||||||
cfi_remember_state; \
|
cfi_remember_state; \
|
||||||
cfi_def_cfa_offset(16); \
|
cfi_def_cfa_offset(16); \
|
||||||
leaq longjmp_msg(%rip), %rdi; \
|
lea longjmp_msg(%rip), %RDI_LP; \
|
||||||
call HIDDEN_JUMPTARGET(__fortify_fail); \
|
call HIDDEN_JUMPTARGET(__fortify_fail); \
|
||||||
nop; \
|
nop; \
|
||||||
cfi_restore_state
|
cfi_restore_state
|
||||||
#else
|
#else
|
||||||
# define CALL_FAIL subq $8, %rsp; \
|
# define CALL_FAIL sub $8, %RSP_LP; \
|
||||||
cfi_remember_state; \
|
cfi_remember_state; \
|
||||||
cfi_def_cfa_offset(16); \
|
cfi_def_cfa_offset(16); \
|
||||||
movq $longjmp_msg, %rdi; \
|
mov $longjmp_msg, %RDI_LP; \
|
||||||
call HIDDEN_JUMPTARGET(__fortify_fail); \
|
call HIDDEN_JUMPTARGET(__fortify_fail); \
|
||||||
nop; \
|
nop; \
|
||||||
cfi_restore_state
|
cfi_restore_state
|
||||||
@ -52,16 +54,16 @@ longjmp_msg:
|
|||||||
.text
|
.text
|
||||||
ENTRY(____longjmp_chk)
|
ENTRY(____longjmp_chk)
|
||||||
/* Restore registers. */
|
/* Restore registers. */
|
||||||
movq (JB_RSP*8)(%rdi), %r8
|
mov (JB_RSP*8)(%rdi), %R8_LP
|
||||||
movq (JB_RBP*8)(%rdi), %r9
|
movq (JB_RBP*8)(%rdi), %r9
|
||||||
movq (JB_PC*8)(%rdi), %rdx
|
mov (JB_PC*8)(%rdi), %RDX_LP
|
||||||
#ifdef PTR_DEMANGLE
|
#ifdef PTR_DEMANGLE
|
||||||
PTR_DEMANGLE (%r8)
|
PTR_DEMANGLE (%R8_LP)
|
||||||
PTR_DEMANGLE (%r9)
|
PTR_DEMANGLE (%r9)
|
||||||
PTR_DEMANGLE (%rdx)
|
PTR_DEMANGLE (%RDX_LP)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmpq %r8, %rsp
|
cmp %R8_LP, %RSP_LP
|
||||||
jbe .Lok
|
jbe .Lok
|
||||||
|
|
||||||
/* Save function parameters. */
|
/* Save function parameters. */
|
||||||
@ -71,19 +73,19 @@ ENTRY(____longjmp_chk)
|
|||||||
cfi_register (%rsi, %rbx)
|
cfi_register (%rsi, %rbx)
|
||||||
|
|
||||||
xorl %edi, %edi
|
xorl %edi, %edi
|
||||||
leaq -24(%rsp), %rsi
|
lea -sizeSS(%rsp), %RSI_LP
|
||||||
movl $__NR_sigaltstack, %eax
|
movl $__NR_sigaltstack, %eax
|
||||||
syscall
|
syscall
|
||||||
/* Without working sigaltstack we cannot perform the test. */
|
/* Without working sigaltstack we cannot perform the test. */
|
||||||
testl %eax, %eax
|
testl %eax, %eax
|
||||||
jne .Lok2
|
jne .Lok2
|
||||||
testl $1, -16(%rsp)
|
testl $1, (-sizeSS + oSS_FLAGS)(%rsp)
|
||||||
jz .Lfail
|
jz .Lfail
|
||||||
|
|
||||||
movq -24(%rsp), %rax
|
mov (-sizeSS + oSS_SP)(%rsp), %RAX_LP
|
||||||
addq -8(%rsp), %rax
|
add (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP
|
||||||
subq %r8, %rax
|
sub %R8_LP, %RAX_LP
|
||||||
cmpq -8(%rsp), %rax
|
cmp (-sizeSS + oSS_SIZE)(%rsp), %RAX_LP
|
||||||
jae .Lok2
|
jae .Lok2
|
||||||
|
|
||||||
.Lfail: CALL_FAIL
|
.Lfail: CALL_FAIL
|
||||||
@ -110,7 +112,7 @@ ENTRY(____longjmp_chk)
|
|||||||
movq (JB_R15*8)(%rdi), %r15
|
movq (JB_R15*8)(%rdi), %r15
|
||||||
/* Set return value for setjmp. */
|
/* Set return value for setjmp. */
|
||||||
movl %esi, %eax
|
movl %esi, %eax
|
||||||
movq %r8,%rsp
|
mov %R8_LP, %RSP_LP
|
||||||
movq %r9,%rbp
|
movq %r9,%rbp
|
||||||
jmpq *%rdx
|
jmpq *%rdx
|
||||||
END (____longjmp_chk)
|
END (____longjmp_chk)
|
||||||
|
15
sysdeps/unix/sysv/linux/x86_64/sigaltstack-offsets.sym
Normal file
15
sysdeps/unix/sysv/linux/x86_64/sigaltstack-offsets.sym
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef _XOPEN_EXTENDED
|
||||||
|
# define _XOPEN_EXTENDED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
#define sigaltstack(member) offsetof (stack_t, member)
|
||||||
|
|
||||||
|
sizeSS sizeof (stack_t)
|
||||||
|
oSS_SP sigaltstack (ss_sp)
|
||||||
|
oSS_SIZE sigaltstack (ss_size)
|
||||||
|
oSS_FLAGS sigaltstack (ss_flags)
|
Loading…
Reference in New Issue
Block a user