github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h,hpp,c --
libunwind/include/__libunwind_config.h libunwind/include/libunwind.h
libunwind/src/DwarfInstructions.hpp libunwind/src/DwarfParser.hpp
libunwind/src/Registers.hpp libunwind/src/UnwindCursor.hpp
libunwind/src/UnwindLevel1.c libunwind/src/libunwind.cpp
--diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libunwind/src/DwarfInstructions.hpp
b/libunwind/src/DwarfInstructions.hpp
index 2d5b50031..8e80b1c4c 100644
--- a/libunwind/src/DwarfInstructions.hpp
+++ b/libunwind/src/DwarfInstructions.hpp
@@ -76,7 +76,7 @@ private:
}
#if defined(_LIBUNWIND_TARGET_AARCH64)
static pint_t getRASignedState(A &addressSpace, const R ®isters,
- pint_t cfa, const PrologInfo &prolog);
+ pint_t cfa, const PrologInfo &prolog);
#endif
};
@@ -290,9 +290,9 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace,
#if !defined(_LIBUNWIND_IS_NATIVE_ONLY)
return UNW_ECROSSRASIGNING;
#else
- newRegisters.setRASigningScheme(
- raSignState, cieInfo.addressesSignedWithBKey,
- prolog.ptrAuthDiversifier);
+ newRegisters.setRASigningScheme(raSignState,
+ cieInfo.addressesSignedWithBKey,
+ prolog.ptrAuthDiversifier);
#endif
}
#endif
diff --git a/libunwind/src/Registers.hpp b/libunwind/src/Registers.hpp
index 69c057758..6944fcd18 100644
--- a/libunwind/src/Registers.hpp
+++ b/libunwind/src/Registers.hpp
@@ -1847,70 +1847,110 @@ extern "C" void *__libunwind_shstk_get_jump_target() {
#define STRING_IMPL(x) #x
#define STRING(x) STRING_IMPL(x)
-#define RUN_IF_PAUTH_FEATURE_PRESENT(scratchReg, code) \
- "mrs " #scratchReg ", ID_AA64ISAR1_EL1" "\n\t" \
- "lsr " #scratchReg ", " #scratchReg ", #24" "\n\t" \
- "ands " #scratchReg ", " #scratchReg ", #255" "\n\t" \
- "cbnz " #scratchReg ", .Lcheck_pac_code" STRING(__LINE__) "\n\t" \
- "mrs " #scratchReg ", ID_AA64ISAR2_EL1" "\n\t" \
- "lsr " #scratchReg ", " #scratchReg ", #8" "\n\t" \
- "ands " #scratchReg ", " #scratchReg ", #15" "\n\t" \
- "cbnz " #scratchReg ", .Lcheck_pac_code" STRING(__LINE__) "\n\t" \
- "b .Lcheck_pac_end" STRING(__LINE__) "\n\t" \
- ".Lcheck_pac_code" STRING(__LINE__) ":" "\n\t" \
- code "\n\t" \
- ".Lcheck_pac_end" STRING(__LINE__) ":" "\n\t"
+#define RUN_IF_PAUTH_FEATURE_PRESENT(scratchReg, code)
\
+ "mrs " #scratchReg ", ID_AA64ISAR1_EL1"
\
+ "\n\t"
\
+ "lsr " #scratchReg ", " #scratchReg ", #24"
\
+ "\n\t"
\
+ "ands " #scratchReg ", " #scratchReg ", #255"
\
+ "\n\t"
\
+ "cbnz " #scratchReg ", .Lcheck_pac_code" STRING(
\
+ __LINE__) "\n\t"
\
+ "mrs " #scratchReg ", ID_AA64ISAR2_EL1"
\
+ "\n\t"
\
+ "lsr " #scratchReg ", " #scratchReg ", #8"
\
+ "\n\t"
\
+ "ands " #scratchReg ", " #scratchReg ", #15"
\
+ "\n\t"
\
+ "cbnz " #scratchReg ", .Lcheck_pac_code" STRING(
\
+ __LINE__) "\n\t"
\
+ "b .Lcheck_pac_end" STRING(
\
+ __LINE__) "\n\t"
\
+ ".Lcheck_pac_code" STRING(
\
+ __LINE__) ":"
\
+ "\n\t" code "\n\t"
\
+ ".Lcheck_pac_"
\
+ "end" STRING(
\
+ __LINE__) ":"
\
+ "\n\t"
// The '0xc470 + KeyID' trap code is used by LLVM codegen to abort execution
// on auth failure w/o FPAC. Mimic this behavior assuming GA key ID is 4.
#define PACGA_TRAP "brk #0xc474\n\t"
-#define CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY(schemeReg, schemePacReg, \
- modifierReg, scratchReg) \
- RUN_IF_PAUTH_FEATURE_PRESENT( \
- scratchReg, \
- "pacga " #modifierReg ", " #schemeReg ", " #modifierReg "\n\t" \
- "cmp " #modifierReg ", " #schemePacReg "\n\t" \
- "b.eq .Lcheck_integrity_success_" STRING(__LINE__) "\n\t" \
- PACGA_TRAP "\n\t" \
- ".Lcheck_integrity_success_" STRING(__LINE__) ":" "\n\t" \
- )
-
-#define CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(schemeReg) \
- "cmp " #schemeReg ", 5" "\n\t" \
- "b.eq .Lcheck_integrity_for_pauthabi_success_" STRING(__LINE__) "\n\t" \
- PACGA_TRAP "\n\t" \
- ".Lcheck_integrity_for_pauthabi_success_" STRING(__LINE__) ":" "\n\t" \
-
-#define SIGNING_SCHEME_FLAGS_SWITCH(schemeReg, codeIf0, codeIf1, \
- codeIf3, codeIf5, codeIf7) \
- "cmp " #schemeReg ", #0" "\n\t" \
- "b.ne .Lswitch_1_" STRING(__LINE__) "\n\t" \
- codeIf0 "\n\t" \
- "b .Lswitch_end_" STRING(__LINE__) "\n\t" \
- ".Lswitch_1_" STRING(__LINE__) ":" "\n\t" \
- "cmp " #schemeReg ", #1" "\n\t" \
- "b.ne .Lswitch_3_" STRING(__LINE__) "\n\t" \
- codeIf1 "\n\t" \
- "b .Lswitch_end_" STRING(__LINE__) "\n\t" \
- ".Lswitch_3_" STRING(__LINE__) ":" "\n\t" \
- "cmp " #schemeReg ", #3" "\n\t" \
- "b.ne .Lswitch_5_" STRING(__LINE__) "\n\t" \
- codeIf3 "\n\t" \
- "b .Lswitch_end_" STRING(__LINE__) "\n\t" \
- ".Lswitch_5_" STRING(__LINE__) ":" "\n\t" \
- "cmp " #schemeReg ", #5" "\n\t" \
- "b.ne .Lswitch_7_" STRING(__LINE__) "\n\t" \
- codeIf5 "\n\t" \
- "b .Lswitch_end_" STRING(__LINE__) "\n\t" \
- ".Lswitch_7_" STRING(__LINE__) ":" "\n\t" \
- "cmp " #schemeReg ", #7" "\n\t" \
- "b.ne .Lswitch_unexpected" STRING(__LINE__) "\n\t" \
- codeIf7 "\n\t" \
- "b .Lswitch_end_" STRING(__LINE__) "\n\t" \
- ".Lswitch_unexpected" STRING(__LINE__) ":" "\n\t" \
- PACGA_TRAP "\n\t" \
- ".Lswitch_end_" STRING(__LINE__) ":" "\n\t"
+#define CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY(schemeReg, schemePacReg,
\
+ modifierReg, scratchReg)
\
+ RUN_IF_PAUTH_FEATURE_PRESENT(
\
+ scratchReg,
\
+ "pacga " #modifierReg ", " #schemeReg ", " #modifierReg "\n\t"
\
+ "cmp " #modifierReg ", " #schemePacReg "\n\t"
\
+ "b.eq .Lcheck_integrity_success_" STRING(
\
+ __LINE__) "\n\t" PACGA_TRAP "\n\t"
\
+ ".Lcheck_integrity_success_" STRING(__LINE__) ":"
\
+ "\n\t")
+
+#define CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(schemeReg)
\
+ "cmp " #schemeReg ", 5"
\
+ "\n\t"
\
+ "b.eq .Lcheck_integrity_for_pauthabi_success_" STRING(
\
+ __LINE__) "\n\t" PACGA_TRAP "\n\t"
\
+ ".Lcheck_integrity_for_pauthabi_success_" STRING(
\
+ __LINE__) ":"
\
+ "\n\t"
+
+#define SIGNING_SCHEME_FLAGS_SWITCH(schemeReg, codeIf0, codeIf1, codeIf3,
\
+ codeIf5, codeIf7)
\
+ "cmp " #schemeReg ", #0"
\
+ "\n\t"
\
+ "b.ne .Lswitch_1_" STRING(
\
+ __LINE__) "\n\t" codeIf0 "\n\t"
\
+ "b .Lswitch_end_" STRING(
\
+ __LINE__) "\n\t"
\
+ ".Lswitch_1_" STRING(
\
+ __LINE__) ":"
\
+ "\n\t"
\
+ "cmp " #schemeReg ", #1"
\
+ "\n\t"
\
+ "b.ne .Lswitch_3_" STRING(
\
+ __LINE__) "\n\t" codeIf1
\
+ "\n\t"
\
+ "b "
\
+ ".Lswitch_"
\
+ "end_"
STRING(__LINE__) "\n\t"
\
+
".Lswitch_3_" STRING(
\
+
__LINE__) ":"
\
+
"\n\t"
\
+
"cmp " #schemeReg
\
+
", #3"
\
+
"\n\t"
\
+
"b.ne .Lswitch_5_" STRING(
\
+
__LINE__) "\n\t" codeIf3
\
+
"\n\t"
\
+
"b .Lswitch_end_" STRING(__LINE__) "\n\t"
\
+
".Lswitch_5_" STRING(__LINE__) ":"
\
+
"\n\t"
\
+
"cmp " #schemeReg
\
+
", #5"
\
+
"\n\t"
\
+
"b.ne .Lswitch_7_" STRING(__LINE__) "\n\t" codeIf5
\
+
"\n\t"
\
+
"b .Lswitch_end_"
STRING(__LINE__) "\n\t"
\
+
".Lswitch_7_" STRING(__LINE__) ":"
\
+
"\n\t"
\
+
"cmp " #schemeReg
\
+
", #7"
\
+
"\n\t"
\
+
"b.ne .Lswitch_unexpected" STRING(
\
+
__LINE__) "\n\t" codeIf7
\
+
"\n\t"
\
+
"b .Lswitch_end_"
STRING(__LINE__) "\n\t" \
+
".Lswitch_unexpected" STRING( \
+
__LINE__) ":" \
+
"\n\t" PACGA_TRAP \
+
"\n\t" \
+
".Lswitch_end_" STRING( \
+
__LINE__) ":" \
+
"\n\t"
#endif
@@ -1972,31 +2012,34 @@ public:
/*schemeReg=*/x12, /*schemePacReg=*/x11,
/*modifierReg=*/x13, /*scratchReg=*/x10)
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
- CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x12)
+
CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x12)
#endif
- SIGNING_SCHEME_FLAGS_SWITCH(
- /*schemeReg=*/x12,
- /*codeIf0=*/"",
- /*codeIf1=*/"hint 0xc \n\t" // autia1716
- "mov x16, x14\n\t"
- "hint 0x8 \n\t", // pacia1716
- /*codeIf3=*/"hint 0x27 \n\t" // pacm
- "hint 0xc \n\t" // autia1716
- "mov x16, x14\n\t"
- "hint 0x27 \n\t" // pacm
- "hint 0x8 \n\t", // pacia1716
- /*codeIf5=*/"hint 0xe \n\t" // autib1716
- "mov x16, x14\n\t"
- "hint 0xa \n\t", // pacib1716
- /*codeIf7=*/"hint 0x27 \n\t" // pacm
- "hint 0xe \n\t" // autib1716
- "mov x16, x14\n\t"
- "hint 0x27 \n\t" // pacm
- "hint 0xa \n\t" // pacib1716
- )
+ SIGNING_SCHEME_FLAGS_SWITCH(
+ /*schemeReg=*/x12,
+ /*codeIf0=*/"",
+ /*codeIf1=*/
+ "hint 0xc \n\t" // autia1716
+ "mov x16, x14\n\t"
+ "hint 0x8 \n\t", // pacia1716
+ /*codeIf3=*/
+ "hint 0x27 \n\t" // pacm
+ "hint 0xc \n\t" // autia1716
+ "mov x16, x14\n\t"
+ "hint 0x27 \n\t" // pacm
+ "hint 0x8 \n\t", // pacia1716
+ /*codeIf5=*/
+ "hint 0xe \n\t" // autib1716
+ "mov x16, x14\n\t"
+ "hint 0xa \n\t", // pacib1716
+ /*codeIf7=*/
+ "hint 0x27 \n\t" // pacm
+ "hint 0xe \n\t" // autib1716
+ "mov x16, x14\n\t"
+ "hint 0x27 \n\t" // pacm
+ "hint 0xa \n\t" // pacib1716
+ )
: "+r"(x17)
- : "r"(x16), "r"(x15), "r"(x14), "r"(x13), "r"(x12), "r"(x11)
- );
+ : "r"(x16), "r"(x15), "r"(x14), "r"(x13), "r"(x12), "r"(x11));
return x17;
#else
if (_registers.__ra_signing_scheme.__flags != 0)
@@ -2026,31 +2069,34 @@ public:
/*schemeReg=*/x12, /*schemePacReg=*/x11, /*modifierReg=*/x13,
/*scratchReg=*/x10)
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
- CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x12)
+
CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x12)
#endif
- SIGNING_SCHEME_FLAGS_SWITCH(
- /*schemeReg=*/x12,
- /*codeIf0=*/"",
- /*codeIf1=*/"hint 0xc \n\t" // autia1716
- "mov x16, x14\n\t"
- "hint 0x8 \n\t", // pacia1716
- /*codeIf3=*/"hint 0x27 \n\t" // pacm
- "hint 0xc \n\t" // autia1716
- "mov x16, x14\n\t"
- "hint 0x27 \n\t" // pacm
- "hint 0x8 \n\t", // pacia1716
- /*codeIf5=*/"hint 0xe \n\t" // autib1716
- "mov x16, x14\n\t"
- "hint 0xa \n\t", // pacib1716
- /*codeIf7=*/"hint 0x27 \n\t" // pacm
- "hint 0xe \n\t" // autib1716
- "mov x16, x14\n\t"
- "hint 0x27 \n\t" // pacm
- "hint 0xa \n\t" // pacib1716
- )
+ SIGNING_SCHEME_FLAGS_SWITCH(
+ /*schemeReg=*/x12,
+ /*codeIf0=*/"",
+ /*codeIf1=*/
+ "hint 0xc \n\t" // autia1716
+ "mov x16, x14\n\t"
+ "hint 0x8 \n\t", // pacia1716
+ /*codeIf3=*/
+ "hint 0x27 \n\t" // pacm
+ "hint 0xc \n\t" // autia1716
+ "mov x16, x14\n\t"
+ "hint 0x27 \n\t" // pacm
+ "hint 0x8 \n\t", // pacia1716
+ /*codeIf5=*/
+ "hint 0xe \n\t" // autib1716
+ "mov x16, x14\n\t"
+ "hint 0xa \n\t", // pacib1716
+ /*codeIf7=*/
+ "hint 0x27 \n\t" // pacm
+ "hint 0xe \n\t" // autib1716
+ "mov x16, x14\n\t"
+ "hint 0x27 \n\t" // pacm
+ "hint 0xa \n\t" // pacib1716
+ )
: "+r"(x17)
- : "r"(x16), "r"(x15), "r"(x14), "r"(x13), "r"(x12), "r"(x11)
- );
+ : "r"(x16), "r"(x15), "r"(x14), "r"(x13), "r"(x12), "r"(x11));
_registers.__pc = x17;
#else
if (_registers.__ra_signing_scheme.__flags != 0)
@@ -2086,21 +2132,22 @@ public:
/*schemeReg=*/x12, /*schemePacReg=*/x11, /*modifierReg=*/x13,
/*scratchReg=*/x10)
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
- CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x12)
+
CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x12)
#endif
- SIGNING_SCHEME_FLAGS_SWITCH(
- /*schemeReg=*/x12,
- /*codeIf0=*/"",
- /*codeIf1=*/"hint 0xc \n\t", // autia1716
- /*codeIf3=*/"hint 0x27\n\t" // pacm
- "hint 0xc \n\t", // autia1716
- /*codeIf5=*/"hint 0xe \n\t", // autib1716
- /*codeIf7=*/"hint 0x27\n\t" // pacm
- "hint 0xe \n\t" // autib1716
- )
+ SIGNING_SCHEME_FLAGS_SWITCH(
+ /*schemeReg=*/x12,
+ /*codeIf0=*/"",
+ /*codeIf1=*/"hint 0xc \n\t", // autia1716
+ /*codeIf3=*/
+ "hint 0x27\n\t" // pacm
+ "hint 0xc \n\t", // autia1716
+ /*codeIf5=*/"hint 0xe \n\t", // autib1716
+ /*codeIf7=*/
+ "hint 0x27\n\t" // pacm
+ "hint 0xe \n\t" // autib1716
+ )
: "+r"(x17)
- : "r"(x16), "r"(x15), "r"(x13), "r"(x12), "r"(x11)
- );
+ : "r"(x16), "r"(x15), "r"(x13), "r"(x12), "r"(x11));
*referenceAuthedLinkRegister = x17;
#else
if (_registers.__ra_signing_scheme.__flags != 0)
@@ -2111,8 +2158,8 @@ public:
#if defined(_LIBUNWIND_IS_NATIVE_ONLY)
void setRASigningScheme(uint64_t raSignState,
- bool isRASigningSchemeedWithBKey,
- uint64_t secondModifier) {
+ bool isRASigningSchemeedWithBKey,
+ uint64_t secondModifier) {
register uint64_t x16 __asm("x16") =
raSignState + (isRASigningSchemeedWithBKey ? 4 : 0);
register uint64_t x17 __asm("x17") =
@@ -2123,28 +2170,36 @@ public:
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x16)
#endif
- SIGNING_SCHEME_FLAGS_SWITCH(
- /*schemeReg=*/x16,
- /*codeIf0=*/"cbnz x15, .Lsetscheme_unexpected\n\t",
- /*codeIf1=*/"cbnz x15, .Lsetscheme_unexpected\n\t",
- /*codeIf3=*/"cbz x15, .Lsetscheme_unexpected\n\t",
- /*codeIf5=*/"cbnz x15, .Lsetscheme_unexpected\n\t",
- /*codeIf7=*/"cbz x15, .Lsetscheme_unexpected\n\t"
- )
- "b .Lsetscheme_ok \n\t"
- ".Lsetscheme_unexpected:\n\t"
- PACGA_TRAP "\n\t"
- ".Lsetscheme_ok: \n\t"
- "str x16, [x17, #0] \n\t"
- RUN_IF_PAUTH_FEATURE_PRESENT(
- /*scratchReg=*/x14,
- "pacga x16, x16, x17 \n\t"
- "str x16, [x17, #8]\n\t"
- )
- "str x15, [x17, #16]\n\t"
+ SIGNING_SCHEME_FLAGS_SWITCH(
+ /*schemeReg=*/x16,
+ /*codeIf0=*/"cbnz x15, .Lsetscheme_unexpected\n\t",
+ /*codeIf1=*/"cbnz x15, .Lsetscheme_unexpected\n\t",
+ /*codeIf3=*/"cbz x15, .Lsetscheme_unexpected\n\t",
+ /*codeIf5=*/"cbnz x15, .Lsetscheme_unexpected\n\t",
+ /*codeIf7=*/
+ "cbz x15, .Lsetscheme_unexpected\n\t") "b .Lsetscheme_ok
"
+ " \n\t"
+ ".Lsetscheme_"
+ "unexpected:"
+ "\n\t" PACGA_TRAP
+ "\n\t"
+ ".Lsetscheme_ok:
"
+ " \n\t"
+ "str x16, [x17, #0]
"
+ " "
+ "\n"
+ "\t"
RUN_IF_PAUTH_FEATURE_PRESENT(
+
/*scratchReg=*/x14,
+ "pacga x16, x16, "
+ "x17 \n\t"
+ "str x16, [x17,
"
+ "#8]\n\t") "str
"
+ "x15, "
+ "[x17,
"
+ "#16]"
+ "\n\t"
:
- : "r"(x17), "r"(x16), "r"(x15)
- );
+ : "r"(x17), "r"(x16), "r"(x15));
}
#endif // defined(_LIBUNWIND_IS_NATIVE_ONLY)
@@ -2162,22 +2217,18 @@ private:
register uint64_t x17 __asm("x17") =
reinterpret_cast<uint64_t>(&_registers.__ra_signing_scheme.__flags);
- asm(// Ensure that second modifier is zero
+ asm( // Ensure that second modifier is zero
"ldr x16, [x17, #16]\n\t"
- "cbz .Lsetzero_ok \n\t"
- PACGA_TRAP "\n\t"
+ "cbz .Lsetzero_ok \n\t" PACGA_TRAP "\n\t"
".Lsetzero_ok: \n\t"
// Assign zero to signing scheme flags field
"str xzr, [x17, #0] \n\t"
// Compute PAC for signing scheme flags field
RUN_IF_PAUTH_FEATURE_PRESENT(
- /*scratchReg=*/x14,
- "pacga x16, xzr, x17 \n\t"
- "str x16, [x17, #8]\n\t"
- )
+ /*scratchReg=*/x14, "pacga x16, xzr, x17 \n\t"
+ "str x16, [x17, #8]\n\t")
:
- : "r"(x17)
- );
+ : "r"(x17));
}
void recomputeSigningSchemeFlagsPAC(const uint8_t *oldModifier) {
@@ -2192,16 +2243,13 @@ private:
/*schemeReg=*/x16, /*schemePacReg=*/x15,
/*modifierReg=*/x17, /*scratchReg=*/x13)
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
- CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x16)
+
CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x16)
#endif
- RUN_IF_PAUTH_FEATURE_PRESENT(
- /*scratchReg=*/x13,
- "pacga x16, x16, x14 \n\t"
- "str x16, [x14, #8]\n\t"
- )
+ RUN_IF_PAUTH_FEATURE_PRESENT(
+ /*scratchReg=*/x13, "pacga x16, x16, x14 \n\t"
+ "str x16, [x14, #8]\n\t")
:
- : "r"(x17), "r"(x16), "r"(x15), "r"(x14)
- );
+ : "r"(x17), "r"(x16), "r"(x15), "r"(x14));
}
// Is PAuth is available, returns signing scheme flags value with embedded
@@ -2222,16 +2270,14 @@ private:
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI(/*schemeReg=*/x16)
#endif
- RUN_IF_PAUTH_FEATURE_PRESENT(
- /*scratchReg=*/x13,
- "pacga x17, x16, x17 \n\t"
- "cmp x17, x15 \n\t"
- "b.eq .Lget_ra_scheme_success\n\t"
- PACGA_TRAP "\n\t"
- ".Lget_ra_scheme_success: \n\t"
- "pacga x14, x16, x14 \n\t"
- "orr x16, x14, x16 \n\t"
- )
+ RUN_IF_PAUTH_FEATURE_PRESENT(
+ /*scratchReg=*/x13,
+ "pacga x17, x16, x17 \n\t"
+ "cmp x17, x15 \n\t"
+ "b.eq .Lget_ra_scheme_success\n\t" PACGA_TRAP "\n\t"
+ ".Lget_ra_scheme_success: \n\t"
+ "pacga x14, x16, x14 \n\t"
+ "orr x16, x14, x16 \n\t")
: "+r"(x16)
: "r"(x17), "r"(x15), "r"(x14));
return x16;
@@ -2322,8 +2368,8 @@ inline Registers_arm64::Registers_arm64(const void
*registers) {
memmove(&pcRegister, ((uint8_t *)&_registers) + offsetof(GPRs, __pc),
sizeof(pcRegister));
#if defined(_LIBUNWIND_IS_NATIVE_ONLY)
- recomputeSigningSchemeFlagsPAC(
- (const uint8_t *)registers + offsetof(GPRs,
__ra_signing_scheme.__flags));
+ recomputeSigningSchemeFlagsPAC((const uint8_t *)registers +
+ offsetof(GPRs, __ra_signing_scheme.__flags));
#endif
setIP(pcRegister);
}
@@ -2336,7 +2382,8 @@ inline Registers_arm64 &
Registers_arm64::operator=(const Registers_arm64 &other) {
memmove(static_cast<void *>(this), &other, sizeof(*this));
#if defined(_LIBUNWIND_IS_NATIVE_ONLY)
- recomputeSigningSchemeFlagsPAC((const uint8_t
*)&other._registers.__ra_signing_scheme.__flags);
+ recomputeSigningSchemeFlagsPAC(
+ (const uint8_t *)&other._registers.__ra_signing_scheme.__flags);
#endif
// We perform this step to ensure that we correctly authenticate and re-sign
// the pc after the bitwise copy.
diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c
index 8c7a5f20f..ce3fc75dd 100644
--- a/libunwind/src/UnwindLevel1.c
+++ b/libunwind/src/UnwindLevel1.c
@@ -663,8 +663,8 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct
_Unwind_Context *context) {
".Lpacga_success: \n\t"
".Lno_pauth: \n\t"
- // See also CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI
- // in Registers.hpp.
+ // See also CHECK_SIGNING_SCHEME_FLAGS_INTEGRITY_FOR_PAUTHABI
+ // in Registers.hpp.
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
"cmp x14, 5 \n\t"
"b.eq .Lpauthabi_success\n\t"
@@ -708,8 +708,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct
_Unwind_Context *context) {
".Lswitch_end:\n\t"
: "+r"(x17)
- : "r"(x16), "r"(x15), "r"(x14), "r"(x13)
- );
+ : "r"(x16), "r"(x15), "r"(x14), "r"(x13));
result = x17;
}
#endif
diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
index 5e58c109e..a298157c4 100644
--- a/libunwind/src/libunwind.cpp
+++ b/libunwind/src/libunwind.cpp
@@ -165,7 +165,8 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor,
unw_regnum_t regNum,
_LIBUNWIND_ABORT("Bad unwind with PAuth-enabled ABI");
}
}
-#elif defined(_LIBUNWIND_TARGET_AARCH64) && defined(_LIBUNWIND_IS_NATIVE_ONLY)
&& \
+#elif defined(_LIBUNWIND_TARGET_AARCH64) &&
\
+ defined(_LIBUNWIND_IS_NATIVE_ONLY) &&
\
!(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32))
// We expect IP register value to be signed only for a full-fledged
// PAuth ABI such as Apple's arm64e or Linux's pauthtest. Otherwise,
``````````
</details>
https://github.com/llvm/llvm-project/pull/173878
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
