]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64, libgcc: Fix unwinding from pac-ret to normal frames [PR94514]
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 3 Apr 2020 09:35:41 +0000 (09:35 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 14 May 2020 11:57:37 +0000 (12:57 +0100)
commit6173489dbfe5828b2c4082d7a450a766779f87c7
tree81ff3b42e3d6dd740b49ef288dc65b87c0f2fda0
parenta357a7b9d53342a35f7e77e3cdfe72f58f3ac346
aarch64, libgcc: Fix unwinding from pac-ret to normal frames [PR94514]

With -mbranch-protection=pac-ret the debug info toggles the
signedness state of the return address so the unwinder knows when
the return address needs pointer authentication.

The unwind context flags were not updated according to the dwarf
frame info.

This causes unwinding across frames that were built without pac-ret
to incorrectly authenticate the return address wich corrupts the
return address on a system where PAuth is enabled.

Note: This even affects systems where all code use pac-ret because
unwinding across a signal frame the return address is not signed.

gcc/testsuite/ChangeLog:

Backport from mainline.
2020-04-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR target/94514
* g++.target/aarch64/pr94514.C: Require lp64.
* gcc.target/aarch64/pr94514.c: Likewise.

Backport from mainline.
2020-04-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR target/94514
* g++.target/aarch64/pr94514.C: New test.
* gcc.target/aarch64/pr94514.c: New test.

libgcc/ChangeLog:

Backport from mainline.
2020-04-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>

PR target/94514
* config/aarch64/aarch64-unwind.h (aarch64_frob_update_context):
Update context->flags accroding to the frame state.
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/aarch64/pr94514.C [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/pr94514.c [new file with mode: 0644]
libgcc/ChangeLog
libgcc/config/aarch64/aarch64-unwind.h