[PATCH] D157734: [x86][harden-sls] insert int3 trap after __x86_return_thunk jump
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 09:57:58 PDT 2023
nickdesaulniers created this revision.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This ensures that -mharden-sls=all -mfunction-return=thunk-extern
compose well.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157734
Files:
llvm/lib/Target/X86/X86AsmPrinter.cpp
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -441,7 +441,11 @@
if (Subtarget->hardenSlsRet() || Subtarget->hardenSlsIJmp()) {
auto I = MBB.getLastNonDebugInstr();
if (I != MBB.end()) {
- if ((Subtarget->hardenSlsRet() && isSimpleReturn(*I)) ||
+ if ((Subtarget->hardenSlsRet() &&
+ (isSimpleReturn(*I) ||
+ (I->getOpcode() == X86::TAILJMPd && I->getOperand(0).isSymbol() &&
+ !strcmp(I->getOperand(0).getSymbolName(),
+ "__x86_return_thunk")))) ||
(Subtarget->hardenSlsIJmp() && isIndirectBranchOrTailCall(*I))) {
MCInst TmpInst;
TmpInst.setOpcode(X86::INT3);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157734.549448.patch
Type: text/x-patch
Size: 820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230811/378353a9/attachment.bin>
More information about the llvm-commits
mailing list