Skip to content

ppc_aes_gcm_encrypt/ppc_aes_gcm_decrypt failing to restore f14-f22, and f29 registers as required by ABI #28961

@grooverdan

Description

@grooverdan

OpenSSL-3.6.0

The PPC64 ELFv2 ABI required that the callee save and restore the f29 register. An example in MariaDB showed this didn't occur.

ref: https://issues.redhat.com/browse/RHEL-122599
ref: https://jira.mariadb.org/browse/MDEV-33603
ref: 64-bit ELF ABI Specification for OpenPOWER Architecture - v2.1.5 - Table 2.22. Floating-Point Register Roles for Binary Floating-Point Types - f14-f31 are non-volatile who's meaning is at the beginning of 2.2.2 Registers

[buildbot@f40a55dc5abb test]$ LD_LIBRARY_PATH=../ gdb --args ./tls13ccstest ../apps/server.pem  ../apps/server.pem  tls13ccstest
GNU gdb (Red Hat Enterprise Linux) 14.2-4.1.el9_6
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "ppc64le-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
   <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./tls13ccstest...
(No debugging symbols found in ./tls13ccstest)
(gdb) display $f14
1: $f14 = <error: No registers.>
(gdb) display $f15
2: $f15 = <error: No registers.>
(gdb) display $f16
3: $f16 = <error: No registers.>
(gdb) display $f17
4: $f17 = <error: No registers.>
(gdb) display $f18
5: $f18 = <error: No registers.>
(gdb) display $f19
6: $f19 = <error: No registers.>
(gdb) display $f20
7: $f20 = <error: No registers.>
(gdb) display $f21
8: $f21 = <error: No registers.>
(gdb) display $f22
9: $f22 = <error: No registers.>
(gdb) display $f23
10: $f23 = <error: No registers.>
(gdb) display $f24
11: $f24 = <error: No registers.>
(gdb) display $f25
12: $f25 = <error: No registers.>
(gdb) display $f26
13: $f26 = <error: No registers.>
(gdb) display $f27
14: $f27 = <error: No registers.>
(gdb) display $f28
15: $f28 = <error: No registers.>
(gdb) display $f20
16: $f20 = <error: No registers.>
(gdb) display $f29
17: $f29 = <error: No registers.>
(gdb) display $f30
18: $f30 = <error: No registers.>
(gdb) display $f31
19: $f31 = <error: No registers.>
(gdb)  b SSL_do_handshake
Function "SSL_do_handshake" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (SSL_do_handshake) pending.
(gdb) r
Starting program: /build/openssl-3.6.0/test/tls13ccstest ../apps/server.pem ../apps/server.pem tls13ccstest
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
1..1
   # Subtest: test_tls13ccs
   1..12

Breakpoint 1, 0x00003fffb87c8a34 in SSL_do_handshake () from ../libssl.so.3
1: $f14 = 0
2: $f15 = 0
3: $f16 = 0
4: $f17 = 0
5: $f18 = 0
6: $f19 = 0
7: $f20 = 0
8: $f21 = 0
9: $f22 = 0
10: $f23 = 0
11: $f24 = 0
12: $f25 = 0
13: $f26 = 0
14: $f27 = 0
15: $f28 = 0
16: $f20 = 0
17: $f29 = 0
18: $f30 = 0
19: $f31 = 0
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.34-168.el9_6.23.ppc64le
(gdb) set $f14=0.14
(gdb) set $f15=0.15
(gdb) set $f16=0.16
(gdb) set $f17=0.17
(gdb) set $f18=0.18
(gdb) set $f19=0.19
(gdb) set $f20=0.20
(gdb) set $f21=0.21
(gdb) set $f22=0.22
(gdb) set $f23=0.23
(gdb) set $f24=0.24
(gdb) set $f25=0.25
(gdb) set $f26=0.26
(gdb) set $f27=0.27
(gdb) set $f28=0.28
(gdb) set $f29=0.29
(gdb) set $f30=0.30
(gdb) set $f31=0.31
(gdb) s
Single stepping until exit from function SSL_do_handshake,
which has no line number information.
0x00003fffb87c9174 in SSL_connect () from ../libssl.so.3
1: $f14 = 0.14000000000000001
2: $f15 = 0.14999999999999999
3: $f16 = 0.16
4: $f17 = 0.17000000000000001
5: $f18 = 0.17999999999999999
6: $f19 = 0.19
7: $f20 = 0.20000000000000001
8: $f21 = 0.20999999999999999
9: $f22 = 0.22
10: $f23 = 0.23000000000000001
11: $f24 = 0.23999999999999999
12: $f25 = 0.25
13: $f26 = 0.26000000000000001
14: $f27 = 0.27000000000000002
15: $f28 = 0.28000000000000003
16: $f20 = 0.20000000000000001
17: $f29 = 0.28999999999999998
18: $f30 = 0.29999999999999999
19: $f31 = 0.31
(gdb) s
Single stepping until exit from function SSL_connect,
which has no line number information.
0x00000000100090fc in create_bare_ssl_connection_ex ()
1: $f14 = 0.14000000000000001
2: $f15 = 0.14999999999999999
3: $f16 = 0.16
4: $f17 = 0.17000000000000001
5: $f18 = 0.17999999999999999
6: $f19 = 0.19
7: $f20 = 0.20000000000000001
8: $f21 = 0.20999999999999999
9: $f22 = 0.22
10: $f23 = 0.23000000000000001
11: $f24 = 0.23999999999999999
12: $f25 = 0.25
13: $f26 = 0.26000000000000001
14: $f27 = 0.27000000000000002
15: $f28 = 0.28000000000000003
16: $f20 = 0.20000000000000001
17: $f29 = 0.28999999999999998
18: $f30 = 0.29999999999999999
19: $f31 = 0.31
(gdb) s
Single stepping until exit from function create_bare_ssl_connection_ex,
which has no line number information.

Breakpoint 1, 0x00003fffb87c8a34 in SSL_do_handshake () from ../libssl.so.3
1: $f14 = 0.14000000000000001
2: $f15 = 0.14999999999999999
3: $f16 = 0.16
4: $f17 = 0.17000000000000001
5: $f18 = 0.17999999999999999
6: $f19 = 0.19
7: $f20 = 0.20000000000000001
8: $f21 = 0.20999999999999999
9: $f22 = 0.22
10: $f23 = 0.23000000000000001
11: $f24 = 0.23999999999999999
12: $f25 = 0.25
13: $f26 = 0.26000000000000001
14: $f27 = 0.27000000000000002
15: $f28 = 0.28000000000000003
16: $f20 = 0.20000000000000001
17: $f29 = 0.28999999999999998
18: $f30 = 0.29999999999999999
19: $f31 = 0.31
(gdb) s
Single stepping until exit from function SSL_do_handshake,
which has no line number information.
0x00003fffb87c8d64 in SSL_accept () from ../libssl.so.3
1: $f14 = -1.1401504744320569e-17
2: $f15 = -2.17647265888608e-21
3: $f16 = -6.8419872059387868e-90
4: $f17 = -3.189049837857242e+230
5: $f18 = 5.2151008090809153e-109
6: $f19 = 3.3310983171458963e+49
7: $f20 = 2.1337373836080768e+245
8: $f21 = 1.1753164624440392e+128
9: $f22 = -2.9402425673378118e-278
10: $f23 = 0.23000000000000001
11: $f24 = 0.23999999999999999
12: $f25 = 0.25
13: $f26 = 0.26000000000000001
14: $f27 = 0.27000000000000002
15: $f28 = 0.28000000000000003
16: $f20 = 2.1337373836080768e+245
17: $f29 = 0
18: $f30 = 0.29999999999999999
19: $f31 = 0.31

(gdb) info sharedlibrary
From                To                  Syms Read   Shared Object Library
0x00003fffb88efe80  0x00003fffb892f3c0  Yes         /lib64/ld64.so.2
0x00003fffb879c500  0x00003fffb8885a58  Yes (*)     ../libssl.so.3
0x00003fffb80e3000  0x00003fffb84d8f7c  Yes (*)     ../libcrypto.so.3
0x00003fffb7ddcf80  0x00003fffb7f76f0c  Yes (*)     /lib64/libc.so.6
(*): Shared library is missing debugging information.

So registers clobbered who's non-volatility wasn't respectedf14-22, f29

Metadata

Metadata

Assignees

No one assigned

    Labels

    branch: 3.2Applies to openssl-3.2 (EOL)branch: 3.3Applies to openssl-3.3branch: 3.4Applies to openssl-3.4branch: 3.5Applies to openssl-3.5branch: 3.6Applies to openssl-3.6branch: masterApplies to master branchtriaged: bugThe issue/pr is/fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions