Skip to content

Commit

Permalink
add __CET__ check guards to trampoline assembly
Browse files Browse the repository at this point in the history
Fixes #38680
  • Loading branch information
vtjnash committed Dec 3, 2020
1 parent 49b8e61 commit b680fb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cli/trampolines/trampolines_i686.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
#define DEBUGINFO(name)
#endif

#if defined(__CET__) && __CET__ & 1 != 0
#define CET_START() endbr32
#else
#define CET_START()
#endif

#define XX(name) \
DEBUGINFO(name); \
.global name; \
.cfi_startproc; \
name##:; \
endbr32; \
CET_START(); \
jmpl *(CNAME(name##_addr)); \
ud2; \
.cfi_endproc; \
Expand Down
8 changes: 7 additions & 1 deletion cli/trampolines/trampolines_x86_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@
#define SEH_END()
#endif

#if defined(__CET__) && __CET__ & 1 != 0
#define CET_START() endbr64
#else
#define CET_START()
#endif

#define XX(name) \
DEBUGINFO(name); \
.global name; \
.cfi_startproc; \
SEH_START1(name); \
name##:; \
SEH_START2(); \
endbr64; \
CET_START(); \
mov CNAME(name##_addr)(%rip),%rax; \
jmpq *%rax; \
ud2; \
Expand Down

0 comments on commit b680fb7

Please sign in to comment.