Skip to content

Commit 5119926

Browse files
committed
Addressing some feedback
* Add note for `__ptrauth_restricted_intptr` * Rename confusing parameter in set_landing_pad_as_ptr * Rename __ptrauth_unwind_pacret_personality_disc to __ptrauth_unwind_pauthtest_personality_disc
1 parent 44b5f58 commit 5119926

File tree

5 files changed

+29
-20
lines changed

5 files changed

+29
-20
lines changed

compiler-rt/lib/builtins/gcc_personality_v0.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *, PCONTEXT,
3333
#if __has_feature(ptrauth_calls)
3434
#include <ptrauth.h>
3535

36+
// `__ptrauth_restricted_intptr` is a feature of apple clang that predates
37+
// support for direct application of `__ptrauth` to integer types. This
38+
// guard is necessary to support compilation with those compiler.
3639
#if __has_feature(ptrauth_restricted_intptr_qualifier)
3740
#define __ptrauth_gcc_personality_intptr(key, addressDiscriminated, \
3841
discriminator) \

libcxxabi/src/cxa_personality.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
# define __ptrauth_scan_results_landingpad \
4545
__ptrauth(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc)
4646

47+
// `__ptrauth_restricted_intptr` is a feature of apple clang that predates
48+
// support for direct application of `__ptrauth` to integer types. This
49+
// guard is necessary to support compilation with those compiler.
4750
# if __has_extension(ptrauth_restricted_intptr_qualifier)
4851
# define __ptrauth_scan_results_landingpad_intptr \
4952
__ptrauth_restricted_intptr(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc)
@@ -594,13 +597,13 @@ namespace {
594597
// __ptrauth_nop_cast cannot be used here as the authentication schemas include
595598
// address diversification.
596599
template <typename PtrType>
597-
void set_landing_pad_as_ptr(scan_results& results, const PtrType& out) {
600+
void set_landing_pad_as_ptr(scan_results& results, const PtrType& landingPad) {
598601
union {
599602
landing_pad_t* as_landing_pad;
600603
landing_pad_ptr_t* as_pointer;
601604
} u;
602605
u.as_landing_pad = &results.landingPad;
603-
*u.as_pointer = out;
606+
*u.as_pointer = landingPad;
604607
}
605608

606609
static const landing_pad_ptr_t& get_landing_pad_as_ptr(const scan_results& results) {

libunwind/include/libunwind.h

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747

4848
#include <ptrauth.h>
4949

50+
// `__ptrauth_restricted_intptr` is a feature of apple clang that predates
51+
// support for direct application of `__ptrauth` to integer types. This
52+
// guard is necessary to support compilation with those compiler.
5053
#if __has_extension(ptrauth_restricted_intptr_qualifier)
5154
#define __unwind_ptrauth_restricted_intptr(...) \
5255
__ptrauth_restricted_intptr(__VA_ARGS__)
@@ -55,7 +58,7 @@
5558
__ptrauth(__VA_ARGS__)
5659
#endif
5760

58-
// ptrauth_string_discriminator("unw_proc_info_t::handler") == 0x7405
61+
// ptrauth_string_discriminator("unw_proc_info_t::handler") == 0x7405
5962
#define __ptrauth_unwind_upi_handler_disc 0x7405
6063

6164
#define __ptrauth_unwind_upi_handler \
@@ -65,62 +68,62 @@
6568
__unwind_ptrauth_restricted_intptr(ptrauth_key_function_pointer, 1,\
6669
__ptrauth_unwind_upi_handler_disc)
6770

68-
// ptrauth_string_discriminator("unw_proc_info_t::start_ip") == 0xCA2C
71+
// ptrauth_string_discriminator("unw_proc_info_t::start_ip") == 0xCA2C
6972
#define __ptrauth_unwind_upi_startip \
7073
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_independent_code, 1, 0xCA2C)
7174

72-
// ptrauth_string_discriminator("unw_proc_info_t::end_ip") == 0xE183
75+
// ptrauth_string_discriminator("unw_proc_info_t::end_ip") == 0xE183
7376
#define __ptrauth_unwind_upi_endip \
7477
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_independent_code, 1, 0xE183)
7578

76-
// ptrauth_string_discriminator("unw_proc_info_t::lsda") == 0x83DE
79+
// ptrauth_string_discriminator("unw_proc_info_t::lsda") == 0x83DE
7780
#define __ptrauth_unwind_upi_lsda \
7881
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x83DE)
7982

80-
// ptrauth_string_discriminator("unw_proc_info_t::flags") == 0x79A1
83+
// ptrauth_string_discriminator("unw_proc_info_t::flags") == 0x79A1
8184
#define __ptrauth_unwind_upi_flags \
8285
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x79A1)
8386

84-
// ptrauth_string_discriminator("unw_proc_info_t::unwind_info") == 0xC20C
87+
// ptrauth_string_discriminator("unw_proc_info_t::unwind_info") == 0xC20C
8588
#define __ptrauth_unwind_upi_info \
8689
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0xC20C)
8790

88-
// ptrauth_string_discriminator("unw_proc_info_t::extra") == 0x03DF
91+
// ptrauth_string_discriminator("unw_proc_info_t::extra") == 0x03DF
8992
#define __ptrauth_unwind_upi_extra \
9093
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x03DF)
9194

92-
// ptrauth_string_discriminator("Registers_arm64::link_reg_t") == 0x8301
95+
// ptrauth_string_discriminator("Registers_arm64::link_reg_t") == 0x8301
9396
#define __ptrauth_unwind_registers_arm64_link_reg \
9497
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_code, 1, 0x8301)
9598

96-
// ptrauth_string_discriminator("UnwindInfoSections::dso_base") == 0x4FF5
99+
// ptrauth_string_discriminator("UnwindInfoSections::dso_base") == 0x4FF5
97100
#define __ptrauth_unwind_uis_dso_base \
98101
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x4FF5)
99102

100-
// ptrauth_string_discriminator("UnwindInfoSections::dwarf_section") == 0x4974
103+
// ptrauth_string_discriminator("UnwindInfoSections::dwarf_section") == 0x4974
101104
#define __ptrauth_unwind_uis_dwarf_section \
102105
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x4974)
103106

104-
// ptrauth_string_discriminator("UnwindInfoSections::dwarf_section_length") == 0x2A9A
107+
// ptrauth_string_discriminator("UnwindInfoSections::dwarf_section_length") == 0x2A9A
105108
#define __ptrauth_unwind_uis_dwarf_section_length \
106109
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x2A9A)
107110

108-
// ptrauth_string_discriminator("UnwindInfoSections::compact_unwind_section") == 0xA27B
111+
// ptrauth_string_discriminator("UnwindInfoSections::compact_unwind_section") == 0xA27B
109112
#define __ptrauth_unwind_uis_compact_unwind_section \
110113
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0xA27B)
111114

112-
// ptrauth_string_discriminator("UnwindInfoSections::compact_unwind_section_length") == 0x5D0A
115+
// ptrauth_string_discriminator("UnwindInfoSections::compact_unwind_section_length") == 0x5D0A
113116
#define __ptrauth_unwind_uis_compact_unwind_section_length \
114117
__unwind_ptrauth_restricted_intptr(ptrauth_key_process_dependent_data, 1, 0x5D0A)
115118

116-
// ptrauth_string_discriminator("CIE_Info::personality") == 0x6A40
119+
// ptrauth_string_discriminator("CIE_Info::personality") == 0x6A40
117120
#define __ptrauth_unwind_cie_info_personality_disc 0x6A40
118121
#define __ptrauth_unwind_cie_info_personality \
119122
__unwind_ptrauth_restricted_intptr(ptrauth_key_function_pointer, 1, \
120123
__ptrauth_unwind_cie_info_personality_disc)
121124

122-
// ptrauth_string_discriminator("personality") == 0x7EAD)
123-
#define __ptrauth_unwind_pacret_personality_disc 0x7EAD
125+
// ptrauth_string_discriminator("personality") == 0x7EAD)
126+
#define __ptrauth_unwind_pauthtest_personality_disc 0x7EAD
124127

125128
#else
126129

libunwind/src/DwarfParser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie,
409409
const auto oldDiscriminator = resultAddr;
410410
#else
411411
const auto oldDiscriminator = ptrauth_blend_discriminator(
412-
(void *)resultAddr, __ptrauth_unwind_pacret_personality_disc);
412+
(void *)resultAddr, __ptrauth_unwind_pauthtest_personality_disc);
413413
#endif
414414
const auto discriminator = ptrauth_blend_discriminator(
415415
&cieInfo->personality,

libunwind/src/UnwindLevel1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
607607
unw_word_t result;
608608
__unw_get_reg(cursor, UNW_REG_IP, &result);
609609

610-
#if defined(__arm64e__)
610+
#if defined(_LIBUNWIND_TARGET_AARCH64_AUTHENTICATED_UNWINDING)
611611
// If we are in an arm64e frame, then the PC should have been signed with the
612612
// sp
613613
{

0 commit comments

Comments
 (0)