diff options
Diffstat (limited to 'libunwind/src')
| -rw-r--r-- | libunwind/src/DwarfParser.hpp | 10 | ||||
| -rw-r--r-- | libunwind/src/assembly.h | 2 | ||||
| -rw-r--r-- | libunwind/src/shadow_stack_unwind.h | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/libunwind/src/DwarfParser.hpp b/libunwind/src/DwarfParser.hpp index dbd7d65..2b04ae2 100644 --- a/libunwind/src/DwarfParser.hpp +++ b/libunwind/src/DwarfParser.hpp @@ -842,12 +842,10 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace, results->savedRegisters[UNW_AARCH64_RA_SIGN_STATE].value ^ 0x3; results->setRegisterValue(UNW_AARCH64_RA_SIGN_STATE, value, initialState); - // When calculating the value of the PC, it is assumed that the CFI - // instruction is placed before the signing instruction, however it is - // placed after. Because of this, we need to take into account the CFI - // instruction is one instruction call later than expected, and reduce - // the PC value by 4 bytes to compensate. - results->ptrAuthDiversifier = fdeInfo.pcStart + codeOffset - 0x4; + // When using Feat_PAuthLR, the PC value needs to be captured so that + // during unwinding, the correct PC value is used for re-authentication. + // It is assumed that the CFI is placed before the signing instruction. + results->ptrAuthDiversifier = fdeInfo.pcStart + codeOffset; _LIBUNWIND_TRACE_DWARF( "DW_CFA_AARCH64_negate_ra_state_with_pc(pc=0x%" PRIx64 ")\n", static_cast<uint64_t>(results->ptrAuthDiversifier)); diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h index f8e83e1..f0fcd00 100644 --- a/libunwind/src/assembly.h +++ b/libunwind/src/assembly.h @@ -15,7 +15,7 @@ #ifndef UNWIND_ASSEMBLY_H #define UNWIND_ASSEMBLY_H -#if defined(__linux__) && defined(__CET__) +#if defined(__CET__) #include <cet.h> #define _LIBUNWIND_CET_ENDBR _CET_ENDBR #else diff --git a/libunwind/src/shadow_stack_unwind.h b/libunwind/src/shadow_stack_unwind.h index 1f229d8..b00ca2c 100644 --- a/libunwind/src/shadow_stack_unwind.h +++ b/libunwind/src/shadow_stack_unwind.h @@ -12,8 +12,8 @@ #include "libunwind.h" -// Currently, CET is implemented on Linux x86 platforms. -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(__CET__) && defined(__SHSTK__) +// Currently, CET is implemented on some ELF x86 platforms. +#if defined(__CET__) && defined(__SHSTK__) #define _LIBUNWIND_USE_CET 1 #endif |
