llvm-project/libunwind/src
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
..
AddressSpace.hpp [libunwind] Silence warnings about unused variables. NFC. 2022-05-04 22:55:02 +03:00
CMakeLists.txt [runtimes] Introduce object libraries 2022-05-16 08:41:16 -04:00
CompactUnwinder.hpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
DwarfInstructions.hpp [NFC] [libunwind] turn assert into static_assert 2022-06-03 16:32:42 -07:00
DwarfParser.hpp [libunwind] [sparc] Add SPARCv9 support 2022-02-05 13:08:26 -08:00
EHHeaderParser.hpp [libunwind] Add more information to eh_frame_hdr version error 2022-06-01 19:48:19 -07:00
FrameHeaderCache.hpp [libunwind][DWARF] Fix end of .eh_frame calculation 2020-09-16 19:00:57 -07:00
RWMutex.hpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
Registers.hpp [NFC] [libunwind] turn assert into static_assert 2022-06-03 16:32:42 -07:00
Unwind-EHABI.cpp [libunwind,EHABI,ARM] Fix get/set of RA_AUTH_CODE. 2022-06-27 09:36:21 +01:00
Unwind-EHABI.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
Unwind-seh.cpp [libunwind] Don't store a predecremented PC when using SEH 2022-06-06 23:25:24 +03:00
Unwind-sjlj.c [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
UnwindCursor.hpp [libunwind] Don't store a predecremented PC when using SEH 2022-06-06 23:25:24 +03:00
UnwindLevel1-gcc-ext.c [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00
UnwindLevel1.c [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00
UnwindRegistersRestore.S [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
UnwindRegistersSave.S [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
Unwind_AIXExtras.cpp [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00
Unwind_AppleExtras.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
assembly.h [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:29:37 -04:00
cet_unwind.h Add some prototypes to fix -Wstrict-prototypes. NFC 2022-04-09 09:46:39 -07:00
config.h [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
dwarf2.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
libunwind.cpp [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
libunwind_ext.h [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00