Fix unwind info for some trivial functions
While stack unwinding works with gdb here, the function _Unwind_Backtrace gives up when something outside .cfi_startproc/.cfi_endproc is found in the call stack, like OPENSSL_cleanse, OPENSSL_atomic_add, OPENSSL_rdtsc, CRYPTO_memcmp and other trivial functions which don't save anything in the stack. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/10635)
This commit is contained in:
parent
f64f262204
commit
8913378a55
1 changed files with 16 additions and 0 deletions
|
@ -41,6 +41,7 @@ print<<___;
|
||||||
.type OPENSSL_atomic_add,\@abi-omnipotent
|
.type OPENSSL_atomic_add,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_atomic_add:
|
OPENSSL_atomic_add:
|
||||||
|
.cfi_startproc
|
||||||
movl ($arg1),%eax
|
movl ($arg1),%eax
|
||||||
.Lspin: leaq ($arg2,%rax),%r8
|
.Lspin: leaq ($arg2,%rax),%r8
|
||||||
.byte 0xf0 # lock
|
.byte 0xf0 # lock
|
||||||
|
@ -49,16 +50,19 @@ OPENSSL_atomic_add:
|
||||||
movl %r8d,%eax
|
movl %r8d,%eax
|
||||||
.byte 0x48,0x98 # cltq/cdqe
|
.byte 0x48,0x98 # cltq/cdqe
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
|
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
|
||||||
|
|
||||||
.globl OPENSSL_rdtsc
|
.globl OPENSSL_rdtsc
|
||||||
.type OPENSSL_rdtsc,\@abi-omnipotent
|
.type OPENSSL_rdtsc,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_rdtsc:
|
OPENSSL_rdtsc:
|
||||||
|
.cfi_startproc
|
||||||
rdtsc
|
rdtsc
|
||||||
shl \$32,%rdx
|
shl \$32,%rdx
|
||||||
or %rdx,%rax
|
or %rdx,%rax
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
|
.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
|
||||||
|
|
||||||
.globl OPENSSL_ia32_cpuid
|
.globl OPENSSL_ia32_cpuid
|
||||||
|
@ -234,6 +238,7 @@ OPENSSL_ia32_cpuid:
|
||||||
.type OPENSSL_cleanse,\@abi-omnipotent
|
.type OPENSSL_cleanse,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_cleanse:
|
OPENSSL_cleanse:
|
||||||
|
.cfi_startproc
|
||||||
xor %rax,%rax
|
xor %rax,%rax
|
||||||
cmp \$15,$arg2
|
cmp \$15,$arg2
|
||||||
jae .Lot
|
jae .Lot
|
||||||
|
@ -263,12 +268,14 @@ OPENSSL_cleanse:
|
||||||
cmp \$0,$arg2
|
cmp \$0,$arg2
|
||||||
jne .Little
|
jne .Little
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_cleanse,.-OPENSSL_cleanse
|
.size OPENSSL_cleanse,.-OPENSSL_cleanse
|
||||||
|
|
||||||
.globl CRYPTO_memcmp
|
.globl CRYPTO_memcmp
|
||||||
.type CRYPTO_memcmp,\@abi-omnipotent
|
.type CRYPTO_memcmp,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
CRYPTO_memcmp:
|
CRYPTO_memcmp:
|
||||||
|
.cfi_startproc
|
||||||
xor %rax,%rax
|
xor %rax,%rax
|
||||||
xor %r10,%r10
|
xor %r10,%r10
|
||||||
cmp \$0,$arg3
|
cmp \$0,$arg3
|
||||||
|
@ -297,6 +304,7 @@ CRYPTO_memcmp:
|
||||||
shr \$63,%rax
|
shr \$63,%rax
|
||||||
.Lno_data:
|
.Lno_data:
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size CRYPTO_memcmp,.-CRYPTO_memcmp
|
.size CRYPTO_memcmp,.-CRYPTO_memcmp
|
||||||
___
|
___
|
||||||
|
|
||||||
|
@ -305,6 +313,7 @@ print<<___ if (!$win64);
|
||||||
.type OPENSSL_wipe_cpu,\@abi-omnipotent
|
.type OPENSSL_wipe_cpu,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_wipe_cpu:
|
OPENSSL_wipe_cpu:
|
||||||
|
.cfi_startproc
|
||||||
pxor %xmm0,%xmm0
|
pxor %xmm0,%xmm0
|
||||||
pxor %xmm1,%xmm1
|
pxor %xmm1,%xmm1
|
||||||
pxor %xmm2,%xmm2
|
pxor %xmm2,%xmm2
|
||||||
|
@ -331,6 +340,7 @@ OPENSSL_wipe_cpu:
|
||||||
xorq %r11,%r11
|
xorq %r11,%r11
|
||||||
leaq 8(%rsp),%rax
|
leaq 8(%rsp),%rax
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
|
.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
|
||||||
___
|
___
|
||||||
print<<___ if ($win64);
|
print<<___ if ($win64);
|
||||||
|
@ -367,6 +377,7 @@ print<<___;
|
||||||
.type OPENSSL_instrument_bus,\@abi-omnipotent
|
.type OPENSSL_instrument_bus,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_instrument_bus:
|
OPENSSL_instrument_bus:
|
||||||
|
.cfi_startproc
|
||||||
mov $arg1,$out # tribute to Win64
|
mov $arg1,$out # tribute to Win64
|
||||||
mov $arg2,$cnt
|
mov $arg2,$cnt
|
||||||
mov $arg2,$max
|
mov $arg2,$max
|
||||||
|
@ -393,12 +404,14 @@ OPENSSL_instrument_bus:
|
||||||
|
|
||||||
mov $max,%rax
|
mov $max,%rax
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_instrument_bus,.-OPENSSL_instrument_bus
|
.size OPENSSL_instrument_bus,.-OPENSSL_instrument_bus
|
||||||
|
|
||||||
.globl OPENSSL_instrument_bus2
|
.globl OPENSSL_instrument_bus2
|
||||||
.type OPENSSL_instrument_bus2,\@abi-omnipotent
|
.type OPENSSL_instrument_bus2,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_instrument_bus2:
|
OPENSSL_instrument_bus2:
|
||||||
|
.cfi_startproc
|
||||||
mov $arg1,$out # tribute to Win64
|
mov $arg1,$out # tribute to Win64
|
||||||
mov $arg2,$cnt
|
mov $arg2,$cnt
|
||||||
mov $arg3,$max
|
mov $arg3,$max
|
||||||
|
@ -441,6 +454,7 @@ OPENSSL_instrument_bus2:
|
||||||
mov $redzone(%rsp),%rax
|
mov $redzone(%rsp),%rax
|
||||||
sub $cnt,%rax
|
sub $cnt,%rax
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_instrument_bus2,.-OPENSSL_instrument_bus2
|
.size OPENSSL_instrument_bus2,.-OPENSSL_instrument_bus2
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
@ -452,6 +466,7 @@ print<<___;
|
||||||
.type OPENSSL_ia32_${rdop}_bytes,\@abi-omnipotent
|
.type OPENSSL_ia32_${rdop}_bytes,\@abi-omnipotent
|
||||||
.align 16
|
.align 16
|
||||||
OPENSSL_ia32_${rdop}_bytes:
|
OPENSSL_ia32_${rdop}_bytes:
|
||||||
|
.cfi_startproc
|
||||||
xor %rax, %rax # return value
|
xor %rax, %rax # return value
|
||||||
cmp \$0,$arg2
|
cmp \$0,$arg2
|
||||||
je .Ldone_${rdop}_bytes
|
je .Ldone_${rdop}_bytes
|
||||||
|
@ -488,6 +503,7 @@ OPENSSL_ia32_${rdop}_bytes:
|
||||||
.Ldone_${rdop}_bytes:
|
.Ldone_${rdop}_bytes:
|
||||||
xor %r10,%r10 # Clear sensitive data from register
|
xor %r10,%r10 # Clear sensitive data from register
|
||||||
ret
|
ret
|
||||||
|
.cfi_endproc
|
||||||
.size OPENSSL_ia32_${rdop}_bytes,.-OPENSSL_ia32_${rdop}_bytes
|
.size OPENSSL_ia32_${rdop}_bytes,.-OPENSSL_ia32_${rdop}_bytes
|
||||||
___
|
___
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue