llvm/libunwind
Simon Tatham 43c84e4634 [libunwind,EHABI,ARM] Fix get/set of RA_AUTH_CODE.
According to EHABI32 §8.5.2, the PAC for the return address of a
function described in an exception table is supposed to be addressed
in the _Unwind_VRS_{Get,Set} API by setting regclass=_UVRSC_PSEUDO and
regno=0. (The space of 'regno' values is independent for each
regclass, and for _UVRSC_PSEUDO, there is only one valid regno so far.)

That is indeed what libunwind's _Unwind_VRS_{Get,Set} functions expect
to receive. But at two call sites, the wrong values are passed in:
regno is being set to UNW_ARM_RA_AUTH_CODE (0x8F) instead of 0, and in
one case, regclass is _UVRSC_CORE instead of _UVRSC_PSEUDO.

As a result, those calls to _Unwind_VRS_{Get,Set} return
_UVRSR_FAILED, which their callers ignore. So if you compile in the
AUTG instruction that actually validates the PAC, it will try to
validate what's effectively an uninitialised register as an
authentication code, and trigger a CPU fault even on correct exception
unwinding.

Reviewed By: danielkiss

Differential Revision: https://reviews.llvm.org/D128522
2022-06-27 09:36:21 +01:00
..
cmake [libunwind][CMake] Fix name of LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG 2022-05-27 09:20:57 +03:00
docs
include [libunwind] Fix SEH unwinding on ARM 2022-06-06 23:23:35 +03:00
src [libunwind,EHABI,ARM] Fix get/set of RA_AUTH_CODE. 2022-06-27 09:36:21 +01:00
test [libunwind] Ensure test/libunwind_01.pass is not completely inlined 2022-06-20 09:05:49 +00:00
.clang-format
CMakeLists.txt [runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows 2022-05-18 20:31:51 +03:00
LICENSE.TXT