Fix some CFI issues in x86_64 assembly
authorDavid Benjamin <davidben@google.com>
Tue, 29 Jan 2019 05:12:15 +0000 (05:12 +0000)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 17 Feb 2019 22:41:11 +0000 (23:41 +0100)
commit2086edb799acf6ad5ef0bb53aa3b17abf4f7f992
tree61748f8dc16f4bcfc8e871a53306e1f2bc7c33ff
parented48d2032d29a82c6aebbddf0fbf530ac2d2521d
Fix some CFI issues in x86_64 assembly

The add/double shortcut in ecp_nistz256-x86_64.pl left one instruction
point that did not unwind, and the "slow" path in AES_cbc_encrypt was
not annotated correctly. For the latter, add
.cfi_{remember,restore}_state support to perlasm.

Next, fill in a bunch of functions that are missing no-op .cfi_startproc
and .cfi_endproc blocks. libunwind cannot unwind those stack frames
otherwise.

Finally, work around a bug in libunwind by not encoding rflags. (rflags
isn't a callee-saved register, so there's not much need to annotate it
anyway.)

These were found as part of ABI testing work in BoringSSL.

Reviewed-by: Richard Levitte <levitte@openssl.org>
GH: #8109
(cherry picked from commit c0e8e5007ba5234d4d448e82a1567e0c4467e629)
crypto/aes/asm/aes-x86_64.pl
crypto/aes/asm/aesni-x86_64.pl
crypto/aes/asm/bsaes-x86_64.pl
crypto/aes/asm/vpaes-x86_64.pl
crypto/bn/asm/rsaz-avx2.pl
crypto/bn/asm/x86_64-mont5.pl
crypto/ec/asm/ecp_nistz256-x86_64.pl
crypto/modes/asm/ghash-x86_64.pl
crypto/perlasm/x86_64-xlate.pl