Skip to content

Commit c8e5a5b

Browse files
committed
fixup: Use "shstk" instead of "ss" as the new name
1 parent fc75200 commit c8e5a5b

File tree

4 files changed

+27
-28
lines changed

4 files changed

+27
-28
lines changed

libunwind/src/Registers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class _LIBUNWIND_HIDDEN Registers_x86;
4848
extern "C" void __libunwind_Registers_x86_jumpto(Registers_x86 *);
4949

5050
#if defined(_LIBUNWIND_USE_CET)
51-
extern "C" void *__libunwind_ss_get_jump_target() {
51+
extern "C" void *__libunwind_shstk_get_jump_target() {
5252
return reinterpret_cast<void *>(&__libunwind_Registers_x86_jumpto);
5353
}
5454
#endif
@@ -268,7 +268,7 @@ class _LIBUNWIND_HIDDEN Registers_x86_64;
268268
extern "C" void __libunwind_Registers_x86_64_jumpto(Registers_x86_64 *);
269269

270270
#if defined(_LIBUNWIND_USE_CET)
271-
extern "C" void *__libunwind_ss_get_jump_target() {
271+
extern "C" void *__libunwind_shstk_get_jump_target() {
272272
return reinterpret_cast<void *>(&__libunwind_Registers_x86_64_jumpto);
273273
}
274274
#endif
@@ -1817,7 +1817,7 @@ class _LIBUNWIND_HIDDEN Registers_arm64;
18171817
extern "C" void __libunwind_Registers_arm64_jumpto(Registers_arm64 *);
18181818

18191819
#if defined(_LIBUNWIND_USE_GCS)
1820-
extern "C" void *__libunwind_ss_get_jump_target() {
1820+
extern "C" void *__libunwind_shstk_get_jump_target() {
18211821
return reinterpret_cast<void *>(&__libunwind_Registers_arm64_jumpto);
18221822
}
18231823
#endif

libunwind/src/UnwindCursor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3122,7 +3122,7 @@ bool UnwindCursor<A, R>::isReadableAddr(const pint_t addr) const {
31223122
#endif
31233123

31243124
#if defined(_LIBUNWIND_USE_CET) || defined(_LIBUNWIND_USE_GCS)
3125-
extern "C" void *__libunwind_ss_get_registers(unw_cursor_t *cursor) {
3125+
extern "C" void *__libunwind_shstk_get_registers(unw_cursor_t *cursor) {
31263126
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
31273127
return co->get_registers();
31283128
}

libunwind/src/UnwindLevel1.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// target is not tempered with. When unwinding, we're skipping the normal return
4343
// procedure for multiple frames and thus need to pop the return addresses of
4444
// the skipped frames from shadow stack to avoid triggering an exception (using
45-
// `_LIBUNWIND_POP_SS_SSP()`). Also, some architectures, like the x86-family
45+
// `_LIBUNWIND_POP_SHSTK_SSP()`). Also, some architectures, like the x86-family
4646
// CET, push the return adddresses onto shadow stack with common call
4747
// instructions, so for these architectures, normal function calls should be
4848
// avoided when invoking the `jumpto()` function. To do this, we use inline
@@ -54,38 +54,38 @@
5454
__unw_resume((cursor)); \
5555
} while (0)
5656
#elif defined(_LIBUNWIND_TARGET_I386)
57-
#define __shadow_stack_step_size (4)
57+
#define __shstk_step_size (4)
5858
#define __unw_phase2_resume(cursor, fn) \
5959
do { \
60-
_LIBUNWIND_POP_SS_SSP((fn)); \
61-
void *ssRegContext = __libunwind_ss_get_registers((cursor)); \
62-
void *ssJumpAddress = __libunwind_ss_get_jump_target(); \
60+
_LIBUNWIND_POP_SHSTK_SSP((fn)); \
61+
void *shstkRegContext = __libunwind_shstk_get_registers((cursor)); \
62+
void *shstkJumpAddress = __libunwind_shstk_get_jump_target(); \
6363
__asm__ volatile("push %%edi\n\t" \
6464
"sub $4, %%esp\n\t" \
65-
"jmp *%%edx\n\t" ::"D"(ssRegContext), \
66-
"d"(ssJumpAddress)); \
65+
"jmp *%%edx\n\t" ::"D"(shstkRegContext), \
66+
"d"(shstkJumpAddress)); \
6767
} while (0)
6868
#elif defined(_LIBUNWIND_TARGET_X86_64)
69-
#define __shadow_stack_step_size (8)
69+
#define __shstk_step_size (8)
7070
#define __unw_phase2_resume(cursor, fn) \
7171
do { \
72-
_LIBUNWIND_POP_SS_SSP((fn)); \
73-
void *ssRegContext = __libunwind_ss_get_registers((cursor)); \
74-
void *ssJumpAddress = __libunwind_ss_get_jump_target(); \
75-
__asm__ volatile("jmpq *%%rdx\n\t" ::"D"(ssRegContext), \
76-
"d"(ssJumpAddress)); \
72+
_LIBUNWIND_POP_SHSTK_SSP((fn)); \
73+
void *shstkRegContext = __libunwind_shstk_get_registers((cursor)); \
74+
void *shstkJumpAddress = __libunwind_shstk_get_jump_target(); \
75+
__asm__ volatile("jmpq *%%rdx\n\t" ::"D"(shstkRegContext), \
76+
"d"(shstkJumpAddress)); \
7777
} while (0)
7878
#elif defined(_LIBUNWIND_TARGET_AARCH64)
79-
#define __shadow_stack_step_size (8)
79+
#define __shstk_step_size (8)
8080
#define __unw_phase2_resume(cursor, fn) \
8181
do { \
82-
_LIBUNWIND_POP_SS_SSP((fn)); \
83-
void *ssRegContext = __libunwind_ss_get_registers((cursor)); \
84-
void *ssJumpAddress = __libunwind_ss_get_jump_target(); \
82+
_LIBUNWIND_POP_SHSTK_SSP((fn)); \
83+
void *shstkRegContext = __libunwind_shstk_get_registers((cursor)); \
84+
void *shstkJumpAddress = __libunwind_shstk_get_jump_target(); \
8585
__asm__ volatile("mov x0, %0\n\t" \
8686
"br %1\n\t" \
8787
: \
88-
: "r"(ssRegContext), "r"(ssJumpAddress) \
88+
: "r"(shstkRegContext), "r"(shstkJumpAddress) \
8989
: "x0"); \
9090
} while (0)
9191
#endif
@@ -267,8 +267,7 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
267267
unw_word_t retInNormalStack;
268268
__unw_get_reg(cursor, UNW_REG_IP, &retInNormalStack);
269269
unsigned long retInShadowStack =
270-
*(unsigned long *)(shadowStackTop +
271-
__shadow_stack_step_size * framesWalked);
270+
*(unsigned long *)(shadowStackTop + __shstk_step_size * framesWalked);
272271
if (retInNormalStack != retInShadowStack)
273272
return _URC_FATAL_PHASE2_ERROR;
274273
}

libunwind/src/shadow_stack_unwind.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <cet.h>
2222
#include <immintrin.h>
2323

24-
#define _LIBUNWIND_POP_SS_SSP(x) \
24+
#define _LIBUNWIND_POP_SHSTK_SSP(x) \
2525
do { \
2626
unsigned long ssp = _get_ssp(); \
2727
if (ssp != 0) { \
@@ -46,7 +46,7 @@
4646
#define _LIBUNWIND_USE_GCS 1
4747
#endif
4848

49-
#define _LIBUNWIND_POP_SS_SSP(x) \
49+
#define _LIBUNWIND_POP_SHSTK_SSP(x) \
5050
do { \
5151
if (__chkfeat(_CHKFEAT_GCS)) { \
5252
unsigned tmp = (x); \
@@ -57,7 +57,7 @@
5757

5858
#endif
5959

60-
extern void *__libunwind_ss_get_registers(unw_cursor_t *);
61-
extern void *__libunwind_ss_get_jump_target(void);
60+
extern void *__libunwind_shstk_get_registers(unw_cursor_t *);
61+
extern void *__libunwind_shstk_get_jump_target(void);
6262

6363
#endif

0 commit comments

Comments
 (0)